分类 wifidog安装 下的文章

Red Hat Enterprise Linux install wifidog auth server

Step-by-step instructions

Install prerequisites

up2date postgresql-client postgresql-server
up2date gcc flex libxml2-devel postgresql-devel httpd-devel libtool libpng-devel subversion

Note: With Centos5, at least, "postgresql-client" is replaced by "postgresql." This appears to be true for RHEL5 as well.
Install PHP5 from source
RHEL4 doesn't have a recent enough PHP to run the wifidog auth server. We will have to compile one from source

Download PHP5 sources http://www.php.net/get/php-5.1.6.tar.bz2/from/a/mirror:

cd folder_where_you_downloaded
tar -jxvf php-5.1.6.tar.bz2

Compile PHP with the required options:

cd php-5.1.6
./configure --with-pgsql --with-apxs2 --with-gettext --with-zlib --with-gd --enable-mbstring --with-config-file-path=/etc 
make
sudo make install
sudo cp php.ini-dist /etc/php.ini

Install the auth server

svn checkout https://dev.wifidog.org/svn/trunk/wifidog-auth
sudo mv wifidog-auth/ /var/www/

Install auth server external dependencies
Install required PEAR modules:

sudo pear install --alldeps Image_Graph-alpha

FCKEditor:

wget http://umn.dl.sourceforge.net/sourceforge/fckeditor/FCKeditor_2.3.1.tar.gz 
tar -zxvf FCKeditor_2.3.1.tar.gz
cd FCKeditor
sudo mv * /var/www/wifidog-auth/wifidog/lib/FCKeditor/ 

Note: Attempting to use a specific Sourceforge server, e.g. http://umn.dl.sourceforge.net/ is likely to time out or otherwise fail. Instead, use the "generic" download address, like this:

wget http://dl.sourceforge.net/sourceforge/fckeditor/FCKeditor_2.3.1.tar.gz

Configure apache
In file /etc/httpd/conf/httpd.conf:

Add php to the DirectoryIndex? directive:

DirectoryIndex index.html index.html.var index.php

Add the following new directive:

AddType application/x-httpd-php .php

Change DocumentRoot? to

DocumentRoot "/var/www/wifidog-auth/wifidog/"

Optional: Setup a ssl self signed key

Make sure you don't already have a proper key, this will destroy it!

cd /etc/httpd/conf/
rm ssl.key/server.key
rm ssl.crt/server.crt
make genkey
cd /usr/share/ssl/certs
make testcert
cd /etc/httpd/conf/ssl.key
cp server.key server.key.encrypted
openssl rsa -in server.key.encrypted -out server.key
chmod 400 server.key

Configure postgresql
While Postgres 8+ would be much faster on modern machines, version 7.4 in RHEL4 is NOT sufficient to run wifidog.

Note: For a completely new installation, the files listed below will not exist until the PostgreSQL service has been started for the first time. You must then either SIGHUP or restart the service after making changes.

Add the following line to /var/lib/pgsql/data/postgresql.conf:

tcpip_socket = true

Note: 8.0 has replaced the tcpip_socket flag with the listen_addresses setting. PostgreSQL 8.0 and up will not start with "tcpip_socket" in the configuration. If you are using PostgreSQL 8.0 and up, use the following instead:

'listen_addresses = 'localhost'

As this is the default, it may not be necessary to make a change to postgresql.conf.

You probably also want to add

log_destination = 'syslog' 

to the "Reporting and Logging" section of postgresql.conf, or otherwise make sure that server error messages are put someplace where you can find them.

Add the following lines to /var/lib/pgsql/data/pg_hba.conf:

host wifidog wifidog 127.0.0.1/32            md5
local wifidog wifidog           md5

Configure the auth server
Go to http://your_server_adress_here/install.php and follow the instructions.

Note: As you follow the instructions, you will be asked to create a database and user, and to assign a password. The configuration file contains a hard-coded password: wifidogtest. If you are experimenting, use that password when you set up the PostgreSQL user. Otherwise, you must edit config.php with your desired password before you start the installation process. Changing local.config.php doesn't work at this point in the installation.

本文章由 http://www.wifidog.pro/2015/03/02/Red-Hat-install-wifidog-auth-server.html 整理编辑,转载请注明出处

wifidog的luci管理界面,基于openwert的可编译package

wifidog的luci管理界面,基于openwert的可编译package

注意:里面的脚本要注意文件格式及可执行属性,到了linux系统里要用chmod及dos2unix命令作适当调整

/etc/init.d/wifidog /etc/uci-defaults/luci-wifidog

编译是sdk环境中要有wifidog选项:
1.将该包放到 package目录,可以在根目录或任意子目录中
2.执行make menuconfig,在LuCI ->3. Applications->luci-app-wifidog 找到该包,勾选上
3.编译整个skd,或者 make package/luci-wifidog/install 单独编译。

本文章由 http://www.wifidog.pro/2015/03/02/openwrt-wifidog-luci.html 整理编辑,转载请注明出处

OpenWrt固件安装wifidog

1.系统需求
硬件

  • 已安装了OpenWrt固件的无线路由器(典型的有Linksys WRT54G系列)

软件

  • Wifidog

你可以尝试执行以下命令安装Wifidog:
opkg update # Optional
opkg install wifidog

将无线路由器接入Internet。
设置并启用无线网络,即,使用无线路由器创建一个可用的Access Point。

2.在Web控制面板中创建热点
登录到Web控制面板,访问http://cp.wiwiz.com/as/
点击“我的热点”,在接下来的页面中点击“创建热点”。根据页面的提示完成各项设置,点击保存。
你将会看到你刚创建热点的Hotspot ID。记下它,接下来的步骤将会用到它。

3.安装与设置HotSpot Builder Utility组件
将一台PC机连接至你的无线路由器,用SSH方式连接到无线路由器。执行以下命令:

cd; wget http://dl.wiwiz.com/hsbuilder-util-latest-OpenWrt.tar.gz
cd /; tar -zxf /root/hsbuilder-util-latest-OpenWrt.tar.gz
/usr/local/hsbuilder/hsbuilder_setup4openwrt.sh setup

然后按照提示完成设置。
特别地,你需要输入的Hotspot ID就是你在Web控制面板中创建的热点的Hotspot ID(不是热点的名称)。User Name是你在控制面板注册的用户名。

提示:
安装时你将会被提示输入External NIC 与 Internal NIC。External NIC 代表的是连接Internet的网络接口。Internal NIC 代表的是连接局域网的网络接口。如果你不确定,可以执行ifconfig命令,并从执行结果中找到它们。

现在,如果没有报错信息,那么安装已经完成了。

你可以使用一个Wi-Fi客户端(如带WLAN适配器的PC或者支持Wi-Fi的移动电话)测试一下你的热点:

  • 搜索可用Wi-Fi热点,并连接到你的热点。
  • 打开Web浏览器,输入任何一个HTTP开头的网址。如果你的热点的认证页面能够显示出来,就说明你的热点已经正常运转了。

本文章由 http://www.wifidog.pro/2015/02/28/openwrt%E5%AE%89%E8%A3%85WiFidog-3.html 整理编辑,转载请注明出处

编写自己的WifiDog认证服务器

这次我使用的是php来编写auth_server服务器,因为这样比较简单。
1.首先是login.php

<?php
 include './tool/MySQLHelper.php';
 if (!empty($_GET["mac"])){
     $result = selectMacByToken($_GET["mac"]);
     if (!empty($result)){
         header("location: http://192.168.1.1:2060/wifidog/auth?token=".$result);
     }
     else {
         header("location: http://xxxxx/WelcomePage.php?mac=".$_GET["mac"]);
     }
 } else {
     header("location: http://xxxxx/WelcomePage.php?mac=".$_GET["mac"]);
 }
?> 

2.ping.php:

<?php echo "Pong"; ?>

这里没有做额外的处理,只是简单地向wifidog回应一个Pong。
3.auth.php

<?php // 后门
 if ($_GET["token"] == "123"){
     echo "Auth: 1";
     return;
 }
  if (!empty($_GET["token"]) && isset($_GET["token"])){
     //获取$result的过程//
     isValidate($result);
     //**后续处理**//
     return;
 } else if((!empty ($_GET["mac"])) && isset($_GET["mac"])){
     //**获取result*//
     $result = isSubscribeByMac($_GET["mac"]);
     isValidate($result);
     return; } else {
     echo "Auth: 0";
 }  
// 输出是否合法. 
function isValidate($result){
     if ($result == 1){
         echo "Auth: 1";
     }
     else {
         echo "Auth: 0";
     }
 }
 ?>

这里根据一些参数来获取$result,从而决定是否允许认证。
4.welcomePage.php以及Portal.html就不一一列举了。

本文章由 http://www.wifidog.pro/2015/02/28/wifidog%E8%AE%A4%E8%AF%81%E6%9C%8D%E5%8A%A1%E5%99%A8-3.html 整理编辑,转载请注明出处