2015年3月

wifidog auth server is not set

安装了wifidog 的linux系统,在启动wifidog之后,可能会爆错误:"wifidog auth server is not set", 在wifidog的源码conf.c中找到:

static void
config_notnull(const void *parm, const char *parmname)
{
        if (parm == NULL) {
                debug(LOG_ERR, "%s is not set", parmname);
                missing_parms = 1;
        }
}

这个函数在调用:

void
config_validate(void)
{
        config_notnull(config.gw_interface, "GatewayInterface");
        config_notnull(config.auth_servers, "AuthServer");

        if (missing_parms) {
                debug(LOG_ERR, "Configuration is not complete, exiting...");
                exit(-1);
        }
}

而config_validate是在gataway.c的main里被调用:

config_init();

parse_commandline(argc, argv);

/* Initialize the config */
config_read(config->configfile);
config_validate();

整个config 设置的流程就是,先把默认值设置给全局变量config,然后将wifidog 的命令行参数传给config,然后是读wifidog的配置文件设置config,最后检查config参数是否有效,只要检查gateway interface和AuthServer。

在config_init中gw_interface和auth_servers初始化为NULL,也就是没有值;在命令行里也没有支持gw_interface和auth_servers的命令参数,所以我们可以通过修改wifidog.conf 的配置来最简单的解决上述问题。

GatewayInterface eth0

AuthServer {
    Hostname 192.168.33.131
    SSLAvailable no
    Path /
}

另外我们也可以通过给wifidog 添加命令行参数来实现,这里就不详述了。

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

Debian Linux install wifidog auth server

Install prerequisites

Before we install anything lets be sure we have access to internet and that our apt database is updated

apt-get update

The authentification server require apache and php (we install the latest version)

apt-get install apache2 php5

Database server install

It also require a database server. PostgreSQL 8.1 is available. 8.1 is harder to configure but faster on current computer.

apt-get install postgresql-8.1

Configure PostgreSQL 8.1

If you selected postgresql-8.1, it will crash at install. You must configure postgresql.conf before being able to launch the services.

nano /etc/postgresql/8.1/main/postgresql.conf

This isn't a good security setting, you should make sure to configure the whole thing later on! Right now, you need, at least to change:

#listen_addresses='localhost'
SSL = true

for:

listen_addresse='*'
SSL = false

Install prerequisites - step2
We also need some specifics librairies

apt-get install xml-core gettext mcrypt libapache2-mod-php5 php5-cgi
apt-get install php5-mcrypt php5-mhash php5-pgsql php-pear php5-xmlrpc php5-curl

if you are using a current/2011 debian/ubuntu, you have to enable long variable names in suhosin - otherwise php will not work as expected:

vi /etc/php5/apache2/conf.d/suhosin.ini
-> add:  suhosin.post.max_name_length = 100
-> add:  suhosin.request.max_varname_length = 100

To get the latest version of wifidog-auth we will need subversion:

apt-get install subversion

If you want multi-locales support, you will have to install that packages (or configure every one of them).

apt-get install locales-all

Some more libs

pear install XML_RPC
cd /tmp
wget http://ovh.dl.sourceforge.net/sourceforge/phlickr/Phlickr-0.2.5.tgz
pear install Phlickr-0.2.5.tgz 
rm Phlickr-0.2.5.tgz

Some stuff that isn't needed for the install, but still nice to have on a server (and which won't be install by default). If you don't what these are, you might not need them ;-) Openssh-server will allow you to launch command remotly, very useful for the third screen of install.php

apt-get install openssh-server less

Install the auth server

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

Apache 2 configuration file
We need to change the document root. We take for granted that this server will be of no other "web" use... if it is, guess you'll have to learn how to configure apache2.

nano /etc/apache2/sites-available/default

and change (at the fifth line):

DocumentRoot /var/www/

to:

DocumentRoot /var/www/wifidog-auth/wifidog

remove the rewrite rule around line 17

restart apache2:

cd /etc/init.d/
./apache2 restart

Configure locale in wifidog.conf

If you have installed locales-all and you want to keep the "French" default portal page, this step isn't needed. In other cases: you will have to change the file config.php

nano /var/www/wifidog-auth/wifidog/config.php

on line 208 (ctrl+w+enter, ctrl+t+enter, 208) remplace

define('DEFAULT_LANG', 'fr_CA');

by:

define('DEFAULT_LANG', 'en_US');

Configure mail server

You need to have a valid mailer in order to mail account confirmation!

Installing postfix

apt-get install postfix

Select the "internet site with smart host" configuration option and answer the next series of questions.

Configure the auth server

Go to http://your-domaine.com/install.php and follow the instructions. You can follow the following walk-though, under the install step: auth-server. It isn't updated though. Or you can follow the onscreen introduction ;-)

They will ask to :

1) First screen

create a wifidog user in postgres

su - postgres
createuser wifidog --pwprompt 

IF you have PostgreSQL 8.1 : answer no to the three questions

create a database owned by this new user

createdb wifidog --encoding=UTF-8 --owner=wifidog

you must then

cat /tmp/dog_cookie.txt

and click next in your browser (it will ask for the password in dog_cookie.txt)

2) Second screen: Verification of the installed software. If you followed this guide, you have everything install (except Radius support).

3) Third screen:

You will have to copy-paste the big serie of command, click refresh and next. The easiest way of doing that is if you have a ssh connection to your box (this is why I proposed openssh-server package earlier)

4) Fourth screen You may need to install Smarty. Let it do that. NEXT.

Click install for simplepie, (you may need to do this manually in your ssh session by changing /branches/ to /releases/ in the failed command from your web console session as the svn repo has changed structure at simplepie.org), then click NEXT.

Click install for feedpressreview, then next.

Click NEXT when asked to install Phlickr (it is already installed, even if the system doesn't see it).

5) Fill out your db information..

Remove installation files

Of course, the only one that should have access to the install.php file is you. You will need to move the file "install.php" out of public sight.

1) Go to your wifidog directory (/var/www/wifidog-auth/wifidog in our case).

cd /var/www/wifidog-auth/wifidog

2) Move "install.php" file to the parent directory which is not visible to the public:

mv install.php ../install.php

note that you can move it wherever you want, but make sure it's not public.

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

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 整理编辑,转载请注明出处