2015年2月

公共场所wifi认证解决方案wifidog+authpuppy(2)

二、 配置服务器和插件管理
1、 访问http://localhost ,通过管理员账户登录,配置authserver
1.png

配置完成后再次访问http://localhost 就会出现如下界面
2.png

2、 点击Manageplugins,点击View all available plugins and updates添加插件,点击后发现无法跳转,原因应该是插件的网站被墙了,大家让服务器科学上网一下就可以了。
安装apAuthLocalUserPlugin这个插件,并启用,就可以对登录账号进行管理了,更多插件的使用可以自己慢慢摸索。
3.png

三、 配置网络结点和路由器认证
1、 访问http://localhost 以管理员身份登录,点击Managenodes进行结点的管理,服务器默认为我们创建了一个叫My first node的结点,我们对其进行编辑,修改Name :wifidog,gw id:123456,deployment status 选择Deployed

2、 配置路由器,路由器在编译openwrt固件的时候,makemenuconfig后,在Network–>Captive Portals中选择wifidog.这样在刷完固件后路由器就有wifidog插件了:
4.png

3、 通过命令行访问路由器,windows下可以使用putty登录,执行如下命令,启动wifidog

/etc/init.d/wifidogenable
/etc/init.d/wifidog start

此时会报错,因为此时还没配置好服务器的信息。
4、 编辑/etc/wifidog.conf,window用户如果不会用vi等编辑器,可以使用winscp软件访问并修改,需要配置的主要有三项:

#这个需要与服务器中gw id相对应
GatewayID 123456
#查看自己的路由器进行配置,外网接口
ExternalInterfaceeth0.2
#路由器内网接口
GatewayInterface br-lan
#服务器配置
AuthServer {
    #服务器的ip地址
    Hostname192.168.0.224
    SSLAvailable yes
    Path /
}

5、 重启wifidog,连接该无线网络,开始验证。

四、wifidog的认证需要https的,于是开始安装https服务
1、 安装ssl

sudo apt-get install apache2

複製代碼
2、 开启ssl

sudo a2enmod ssl

複製代碼
3、 重启apache

sudo service apache2 restart

複製代碼
4、 创建一个ssl目录

sudo mkdir /etc/apache2/ssl

複製代碼
5、 创建一个自己认证的证书

sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

複製代碼
输入信息得到:/etc/apache2/ssl/apache.key
7、 配置证书

sudo gedit /etc/apache2/sites-available/default-ssl.conf

複製代碼
8、 在ServerAdmin下添加一行,服务器域名或者ip地址

ServerName 127.0.1.1:443
ServerAlias authpuppy.test<span style="line-height: 1.5; background-color: rgb(255, 255, 255);">                          </span>

複製代碼
并修改如下内容:

SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

複製代碼
9、 开启ssl并重启apache

sudo a2ensite default-ssl
sudo service apache2 reload

複製代碼
10、 此时访问https://localhost 可以访问,但是localhost下的其他路径时404错误
修改/etc/apache2/sites-enabled/default-ssl.conf 添加443虚拟目录

<VirtualHost *:443>
        DocumentRoot /var/www/html/authpuppy/web
        ServerName authpuppy.localhost
        SSLEngine on
        SSLCertificateFile /etc/apache2/ssl/apache.crt
        SSLCertificateKeyFile /etc/apache2/ssl/apache.key

        DocumentRoot /var/www/html/authpuppy/web
        DirectoryIndex index.php
        <Directory /var/www/html/authpuppy/web/>
               Options Indexes FollowSymLinks MultiViews
               AllowOverride All
               Order allow,deny
               allow from all
        </Directory>
</VirtualHost>

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

公共场所wifi认证解决方案wifidog+authpuppy(1)

服务器:ubuntu 14.04 + authpuppy
路由器:MERCURY MW4530R + wifidog

一、安装authpuppy服务端验证
1、 安装php开发环境:

sudo apt-get install apache2 php5-mysql libapache2-mod-php5 mysql-server

2、 启用apache rewrite,否则会出现(Therequested URL /install/3 was not found on this server.)错误

sudo a2enmod rewrite

3、 到https://launchpad.net/authpuppy 下载最新源码authpuppy-1.0.0-stable,解压并剪切到/var/www/html/authpuppy目录

sudo mv authpuppy /var/www/html/authpuppy

4、 为authpuppy赋予权限

chmod 777 /var/www/html/authpuppy/ -R

5、 修改/etc/apache2/sites-enabled/000-default.conf替换所有内容

sudo gedit /etc/apache2/sites-enabled/000-default.conf

如下:

<VirtualHost *:80>
       ServerAdmin webmaster@localhost
       ServerName authpuppy.localhost
       ServerAlias authpuppy.test

       DocumentRoot /var/www/html/authpuppy/web
       DirectoryIndex index.php
       <Directory /var/www/html/authpuppy/web/>
               Options Indexes FollowSymLinks MultiViews
               AllowOverride All
               Order allow,deny
               allow from all
       </Directory>

       Alias /sf /var/www/html/authpuppy/lib/vendor/symfony/data/web/sf
       <Directory "/var/www/html/authpuppy/lib/vendor/symfony/data/web/sf">
               AllowOverride All
               Allow from All
       </Directory>

       #ErrorLog /var/log/apache2/authpuppy/error.log

       # Possible values include: debug, info, notice, warn, error, crit,
       # alert, emerg.
       LogLevel warn

       #CustomLog /var/log/apache2/authpuppy/access.log combined

  </VirtualHost>

6、 重启apache

sudo service apache2 restart

7、访问http://localhost 出现authpuppy配置页面
1.png

8、 点击下一步继续,这一步会检测系统的环境是否满足authpuppy的要求,不满足的会显示红色,按要求配置好就可以点击下一步了。
2.png

9、创建数据库wifidog,并填写数据库名字、账号密码等信息,此处为了方便,使用root登录,读者可以新建一个user用于访问。
3.png

10、一直点击下一步,直到出现管理员用户配置页面,配置用户信息:
4.png

11、 最后配置成功,出现如下页面,此时authpuppy的基本配置完成:
5.png

12、以后再次访问http://localhost,就会出现如下页面,不需要重新配置了:
6.png

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

install AuthPuppy On OpenWRT with Lighttpd

  1. Install OpenWRT on an X86 platform.
    Following the instructions here (http://blog.ich8.com/post/4494), which could install a clean installtion of OpenWRT on an x86 platform with version 14.03.

  2. Setup LAMP
    It has been a while that the default sources on OpenWRT is wrong, that the offical sources has re-archit the directories. Here are some instructions.

2.1 Base part

source: http://downloads.openwrt.org/barrier_breaker/14.07/x86/generic/packages/base/
package list: libexpat libgd libjpeg libncurses libncursesw libopenssl libpcre libpng libpthread libreadline librt iptables-mod-extra iptables-mod-nat-extra

Note after install libpcre, system may not find the proper libpcre.so.0, just make a soft link from libpcre.so.1 in /usr/lib will make it work.

2.2 Lighttpd

source: http://downloads.openwrt.org/barrier_breaker/14.07/x86/generic/packages/packages/

package list: lighttpd lighttpd-mod-access lighttpd-mod-alias lighttpd-mod-cgi lighttpd-mod-fastcgi lighttpd-mod-rewrite

2.3 MySQL

source: http://downloads.openwrt.org/barrier_breaker/14.07/x86/generic/packages/oldpackages/

package list: mysql-server libmysqlclient

2.4 PHP

source: http://downloads.openwrt.org/barrier_breaker/14.07/x86/generic/packages/oldpackages/

package list: php5 php5-cgi php5-fastcgi php5-mod-apc php5-mod-gd php5-mod-mysql php5-mod-pdo php5-mod-pdo-mysql php5-mod-xml

  1. Setup PHP
    Modify /etc/php.ini. First make the doc_root empty, and then modify the max-memory size from 8MB to a much larger one.

  2. Setup Lighttpd
    4.1 Enable some plugins in Lighttpd following this page (http://wiki.openwrt.org/doc/howto/lamp)
    4.2 Enbale mod_rewrite which is used in AuthPuppy
    4.3 !IMPORTANT Migrate the rewrite rules in AuthPuppy’s .htaccess to url.rewrite part, like below:

    url.rewrite-once = (".php$" => "$0", ".html$" => "$0", "^$" => "index.html", "^([^.]+)($|\?.*$)" => "index.php/$1$2")

  3. Now you can install authpuppy and wifidog as usual.

It is much easier to record than try to make it.

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

wifidog认证服务器authpuppy 安装检测环境失败

安装authpuppy ,做环境检测时报错如下:

[root@authppy src]# php check_configuration.php 
********************************
*                              *
*  symfony requirements check  *
*                              *
********************************

php.ini used by PHP: /usr/local/Zend/etc/php.ini

** WARNING **
*  The PHP CLI can use a different php.ini file
*  than the one used with your web server.
*  If this is the case, please launch this
*  utility from your web server.
** WARNING **

** Mandatory requirements **

  OK        PHP version is at least 5.2.4 (5.2.17)

** Optional checks **

[[WARNING]] PDO is installed: FAILED
            *** Install PDO (mandatory for Propel and Doctrine) ***
[[WARNING]] PHP-XML module is installed: FAILED
            *** Install and enable the php-xml module (required by Propel) ***
[[WARNING]] XSL module is installed: FAILED
            *** Install and enable the XSL module (recommended for Propel) ***
  OK        The token_get_all() function is available
[[WARNING]] The mb_strlen() function is available: FAILED
            *** Install and enable the mbstring extension ***
  OK        The iconv() function is available
  OK        The utf8_decode() is available
[[WARNING]] The posix_isatty() is available: FAILED
            *** Install and enable the php_posix extension (used to colorized the CLI output) ***
[[WARNING]] A PHP accelerator is installed: FAILED
            *** Install a PHP accelerator like APC (highly recommended) ***
[[WARNING]] php.ini has short_open_tag set to off: FAILED
            *** Set it to off in php.ini ***
[[WARNING]] php.ini has magic_quotes_gpc set to off: FAILED
            *** Set it to off in php.ini ***
  OK        php.ini has register_globals set to off
  OK        php.ini has session.auto_start set to off
  OK        PHP version is not 5.2.9

解决方法:
安装php 模块及一些软件包:

[root@authppy src]# yum install -y libxslt libxslt-devel  php-pdo php-xml php-mbstring php-process

关闭php 相应参数:

[root@authppy src]# vi /usr/local/php/etc/php.ini
short_open_tag = Off
magic_quotes_gpc = Off

错误ARC 的解决方法:

[root@authppy src]# wget http://pecl.php.net/get/APC-3.1.13.tgz
[root@authppy src]# tar zxf APC-3.1.13.tgz 
[root@authppy src]# cd APC-3.1.13
[root@authppy APC-3.1.13]# phpize
Configuring for:
PHP Api Version:         20090626
Zend Module Api No:      20090626
Zend Extension Api No:   220090626
[root@authppy APC-3.1.13]# ./configure --enable-apc
[root@authppy APC-3.1.13]# make
[root@authppy APC-3.1.13]# make install
[root@authppy APC-3.1.13]# ls /usr/lib64/php/modules/
apc.so  curl.so  fileinfo.so  json.so  phar.so  zip.so
[root@authppy src]# echo "apc__extension=/usr/lib64/php/modules/apc.so" >> /usr/local/php/etc/php.ini
[root@authppy src]#ln -s /usr/lib64/php/modules/apc.so /usr/lib/

本文章由 http://www.wifidog.pro/2015/02/26/wifidog%E8%AE%A4%E8%AF%81%E6%9C%8D%E5%8A%A1%E5%99%A8authpuppy%E5%AE%89%E8%A3%85%E5%A4%B1%E8%B4%A5.html 整理编辑,转载请注明出处