Oauth for OpenWrt routers aims to support authentication via OAuth services (Google, Facebook...) and run on the same box with WifiDog. It is using Luci and provides an alternative to single Auth Server for WifiDog. There is no need to setup a separated machine for authentication.
How does it work?
When a new guest uses Wifi from a router to go to the Internet, he/she will be presented a login page where he/she can use his Facebook or Google accounts to log in order to have permission of using our Wifi to access the Internet. When the session of using the Internet is over, a page with a message informing that the user is unauthenticated is displayed, and he/she is withdrawn the Internet access permission. This means he/she must be login again to have the permission.
System requirements
The followings are all you need to successfully deploy Oauth for OpenWrt:
- OpenWrt firmware.
- LuCi package.
- Wifidog package.
- Standard wget package.
- Oauth for OpenWrt package.
a. Install Wifidog package:
- Connect with your router via SSH.
- Use this command to install Wifidog: opkg install wifidog.
Note: if you can not install wifidog, let's first use this command: “opkg update”, and then install it again.
b. Modify Wifidog's configuration file:
The configuration file of Wifidog is in /etc/wifidog.conf.
- Use this command to access the file: vi /etc/wifidog.conf.
- There are some parameters that you need to alter, according to your
system: + ExternalInterface. + GatewayInterface. + GatewayAddress
(your router) + AuthServer (your router) + GatewayPort.
c. Install Oauth for OpenWrt package:
We provide an ipk package to easily install via opkg.
You can also build your own from source (https://github.com/hongquan/Oauth for OpenWrt):
- Copy the source folder to openwrt/package (source tree).
- Rename Makefile_build_standalone to Makefile (replace the old
Makefile).
- Rename "dist" folder to "root" Choose the luci-app-Oauth for OpenWrt
in"make menuconfig".
- Run "make package/luci-app-Oauth for OpenWrt/compile V=99" to build.
After finishing the whole things above, let's do some more steps following to make Oauth for OpenWrt works:
- In Terminal, connect to your router via SSH.
- Run wifidog via this command: “/etc/init.d/wifidog start” (or
“wifidog -d 7 -f” to see log information)
- On your web browser, access your router via its IP address. After
logging in, select tab “Network/Oauth for OpenWrt/Status”. Then,
press “Apply” button.
Oauth for OpenWrt is now ready to work.
Configure Oauth for OpenWrt
We have created some nice stuffs for you to make Oauth for OpenWrt work as you like. First of all, you need to access the admin page of router by typing the your router address. There are some options that you can choose to bend the Oauth for OpenWrt with your needs.
本文章由 http://www.wifidog.pro/2015/04/07/wifidog%E5%AE%89%E8%A3%85%E6%8E%88%E6%9D%83.html 整理编辑,转载请注明出处