分类 wifidog认证 下的文章

ubuntu10.04 安装authpuppy

准备工作:ubuntu中安装Apache2,php5,mysql,及 postgres。具体的步骤可以去搜下,一般的多是apt-get install 就OK。postgres 安装名为postgresql

具体还可以参照authpuppy官方doc ,http://www.authpuppy.org/doc/Getting_Started。这个一定要看!写的很详细。
1.首先在authpuppy 官网下载源码http://www.authpuppy.org/。找到download,去下载authpuppy-1.0.0-stable.tgz 该版本。

2.将authpuppy-1.0.0-stable.tgz代码解压到/var/www/目录下后,访问http://localhost/authpuppy/web/ 会访问到preinstall.php,下面开始安装。先按照http://www.authpuppy.org/doc/Getting_Started中,将PostgreSQL数据建立成功。成功后,按照Getting_Started帮助手册,修改/etc/apache2/sites-available/default 这个文件,内容如下:

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

       <span style="color: #ff0000;">#DocumentRoot /var/www/authpuppy/web/</span>  <br>    DocumentRoot /var/www/     <br>    DirectoryIndex index.php
       <Directory /var/www/authpuppy/web/>
               Options Indexes FollowSymLinks MultiViews
               AllowOverride All
               Order allow,deny
               allow from all
       </Directory>

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

       <span style="color: #ff0000;">#ErrorLog /var/log/apache2/authpuppy/error.log
</span>    ErrorLog /var/log/apache2/error.log<br>   
       # Possible values include: debug, info, notice, warn, error, crit,
       # alert, emerg.
       LogLevel warn

       <span style="color: #ff0000;">#CustomLog /var/log/apache2/authpuppy/access.log combined
</span>    CustomLog /var/log/apache2/access.log combined<br>  <br>     
  </VirtualHost>

加红色部分为Getting_Started中给的原样,我针对这个做了部分修改。关于两个log,因为/var/log/apache2/目录下没有authpuppy 这个文件,所以加这个的话Apache重启时会失败,所以将其去掉(或者你自己添加上也可以)。

$ sudo service apache2 restart

重启Apache,访问http://localhost/authpuppy/web/ .会出现第一个页面,点击let's go按钮。然后进到下一个页面上,这里会提示你什么文件没有可写权限或者没有安装某个php的扩展,按照上面提示做就可以了!还有注意一点。有时候点击let's go 就会出错,页面就访问失败了!这里可以将/authpuppy/web/installed.txt 这个删除掉。就可以了!处理好后点击next。进到连接数据库页面。我刚开始这个页面总访问不进来。这时按照http://www.authpuppy.org/doc/Getting_Started,将环境设置了一边后就可以访问了。具体的原因没有查明。然后就是与数据库连接,数据库选择postsql,注意用户名密码是否正确。过了这个页,基本上就是成功了。

用自己的话写的比较粗略,只供自己下次再搭建该环境时有个提醒。(这次就是第二次,又花费了一天多- -),第一次搭建步骤都忘了,所以想记录一下过程。主要是参考这两个链接:

http://www.authpuppy.org/doc/Getting_Started

http://blog.sina.com.cn/s/blog_d2facf270101g7hy.html ;wifidog+authpuppy认证页面的配置

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

CentOS6.6下的authpuppy源码安装与配置完全纯净版

安装与配置authpuppy:

源码包:

#wget https://launchpad.net/authpuppy/trunk/1.0.0-stable/+download/authpuppy-1.0.0-stable.tgz

#cd /home
tar -xvf authpuppy-1.0.0-stable.tgz

#// apache配置一个虚拟域名(比如http://authpuppy.localhost/)指向目录 /home/authpuppy

打开http://authpuppy.localhost/
按提示完成对依赖包的安装(Requirements下的最好都安装), 如下:
依赖库: // 主要是PHP扩展包

APCu:

#wget http://pecl.php.net/get/apcu-4.0.6.tgz
#phpize
#./configure --with-php-config=/usr/local/php/bin/php-config --enable-apcu --enable-apc-bc
#make -s
#make install
#vi /usr/local/php/etc/php.ini
extension=apcu.so

Permissions下出现红色部分,则需要做下面操作:

#chmod a+w authpuppy/ -R
#//自动创建authpuppy.yml

然后:

// 必须需要启用pdo_mysql,因为symfony的用的是PDO, 灵感来自http://bbs.csdn.net/topics/390036982
#cd php-5.6.2/ext/pdo_mysql
#phpize
#./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-mysql=/usr/local/mysql/
#make -s
#make install

#mysqladmin -uroot -p create authpuppy
#mysql -uroot -p

#create user 'authpuppy'@'localhost' identified by 'authpuppydev';
#grant all privileges on authpuppy.* to 'authpuppy'@'localhost' with grant option;

接着按界面来走就好了。

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

AuthPuppy authentication server for Wifidog networks, Installation of authpuppy and prerequisites in Debian

sudo apt-get install apache2
sudo apt-get install php5

These following commands are optionnals but may be help a lot.
sudo apt-get update
sudo apt-get upgrade --show-upgraded
end of optionnal commands

sudo apt-get install postgresql postgresql-contrib (if you plan to use postresql database)
or
sudo apt-get install mysql-server (if you plan to use mysql database)

*** Both of them (mysql or postgres) are on the same level. Using one of them is only a question of choice ***

sudo apt-get install php5-dev
sudo apt-get install php-pear
sudo apt-get install apache2-prefork-dev build-essential
pecl install apc

in the dynamic extensions part of php.ini
add extension=apc.so in /etc/php5/apache2/php.ini
add extension=apc.so in /etc/php5/cli/php.ini

change short_open_tag=on to off in php.ini (apache dir and cli dir)

by doing
sudo nano /etc/php5/apache2/php.ini
ctrl o ctrl x when everything is written

sudo nano /etc/php5/cli/php.ini
ctrl o ctrl x when everything is written

add subdirectory "authpuppy" in /var/log/apache2
by doing this
cd /var/log/apache2
sudo mkdir authpuppy
cd /

sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart

sudo apt-get install php5-pgsqlp (if you are using postgresql database)
sudo apt-get install php5-mysql (if you are using mysql database)

To make sure that pdo and pdo-mysql or pdo and pdo-pgsql are correctly installed
type this command

sudo php -m

and you should see them among all the php5 modules installed.

sudo apt-get install php5-curl
sudo apt-get install php5-xsl

download last version of authpuppy, copy it in the root tmp dir

cd /tmp
sudo tar xvzf authpuppy--_.tgz
sudo mv authpuppy /var/www/

add these following lines in httpd.conf in the /etc/apache2 directory
by doing
sudo nano /etc/apache2/httpd.conf and copy and paste these following lines

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

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

       Alias /sf /var/www/authpuppy/lib/vendor/symfony/data/web/sf
       <Directory "/var/www/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>

ctrl-o ctrl-x

Note : To make sure that authpuppy will be launched correctly, it can help that the hosts
file in /etc directory have this line

127.0.0.1 authpuppy.localhost

by doing
sudo nano /etc/hosts
ctrl-o ctrl-x
Now, do these commands in terminal :

cd /var/www/authpuppy

sudo chown -R a+w config
sudo chown -R www-data cache
sudo chown -R www-data log
sudo chown -R www-data data
sudo chown -R www-data plugins
sudo chown -R www-data web

cd /

if you are using postgresql :

sudo -s -u postgres
createuser authpuppy --pwprompt
type n for each questions
createdb authpuppy --encoding=UTF-8 --owner=authpuppy

Type exit

if you are using mysql

user@yourserver $> mysqladmin -uroot -p create authpuppy
Enter password: #Enter the root password
user@yourserver $> mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 45
Server version: 5.0.51a-3ubuntu5.5 (Ubuntu)

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create user 'authpuppy'@'localhost' identified by 'authpuppydev';
Query OK, 0 rows affected (0.21 sec)

mysql> grant all privileges on authpuppy.* to 'authpuppy'@'localhost'
with grant option;
Query OK, 0 rows affected (0.02 sec)

Type exit

Everything's may be ok now.

To make sure that you have a proper and clean installation
type :

symfony cc

in the /var/wwww/authpuppy directory.

Use your internet browser and type : http://authpuppy.localhost

Do not use chromium browser, there's a bug in it about opening local web server

本文章由 http://www.wifidog.pro/2015/02/25/Debian-install-authpuppy.html 整理编辑,转载请注明出处

wifidog报错: Auth server did NOT say pong!

在wifidog启动过程中,我们可能会经常看到这种log:
Auth server did NOT say pong!

这个debug信息是再告诉我们,wifidog的ping协议没有收到来自auth server 的pong 回应。
首先解释下什么是ping协议。这种协议是路由器用来告诉auth server 路由器当前的状态,协议格式:
http://auth_server/ping/?gw_id=xxx&sys_uptime=xxx&sys_memfree&sys_load=xxx&wifidog_uptime=xxx
gw_id是路由器的标识符,sys_uptime是路由器启动时间,sys_memfree是路由器的内存剩余,sys_load是系统负载,wifidog_uptime是wifidog启动时间,路由器将这些信息发送给auth server,server 回"Pong" 来表示server知道这台路由器还在工作。

下面是出现上述log的代码:

do {   
        FD_ZERO(&readfds);   
        FD_SET(sockfd, &readfds);   
        timeout.tv_sec = 30; /* XXX magic... 30 second */   
        timeout.tv_usec = 0;   
        nfds = sockfd + 1;   

        nfds = select(nfds, &readfds, NULL, NULL, &timeout);   

        if (nfds > 0) {   
            /** We don't have to use FD_ISSET() because there  
             *  was only one fd. */   
            numbytes = read(sockfd, request + totalbytes, MAX_BUF - (totalbytes + 1));   
            if (numbytes < 0) {   
                debug(LOG_ERR, "An error occurred while reading from auth server: %s", strerror(errno));   
                /* FIXME */   
                close(sockfd);   
                return;   
            }   
            else if (numbytes == 0) {   
                done = 1;   
            }   
            else {   
                totalbytes += numbytes;   
                debug(LOG_DEBUG, "Read %d bytes, total now %d", numbytes, totalbytes);   
            }   
        }
else if (nfds == 0) {   
            debug(LOG_ERR, "Timed out reading data via select() from auth server");   
            /* FIXME */   
            close(sockfd);   
            return;   
        }   
        else if (nfds < 0) {   
            debug(LOG_ERR, "Error reading data via select() from auth server: %s", strerror(errno));   
            /* FIXME */   
            close(sockfd);   
            return;   
        }   
    } while (!done);   
    close(sockfd);   

    debug(LOG_DEBUG, "Done reading reply, total %d bytes", totalbytes);   

    request[totalbytes] = '\0';   

    debug(LOG_DEBUG, "HTTP Response from Server: [%s]", request);   

    if (strstr(request, "Pong") == 0) {   
        debug(LOG_WARNING, "Auth server did NOT say pong!");   
        /* FIXME */   
    }   
    else {   
        debug(LOG_DEBUG, "Auth Server Says: Pong");   
    }

这段log 出现在wifidog 在接收server 的响应包里没有出现Pong字符串。

本文章由 http://www.wifidog.pro/2015/02/25/wifidog%E7%9A%84ping%E5%8D%8F%E8%AE%AE.html 整理编辑,转载请注明出处