![]() | ![]() |
|
Authentication Gateway HOWTONathan Zorn
There are many concerns with the security of wireless networks and public access areas such as libraries or dormitories. These concerns are not met with current security implementations. A work around has been proposed by using an authentication gateway. This gateway addresses the security concerns by forcing the user to authenticate in order to use the network.
1. IntroductionWith wireless networks and public acces areas it is very easy for an unauthorized user to gain access. Unauthorized users can look for a signal and grab connection information from the signal. Unauthorized users can plug their machine into a public terminal and gain access to the network. Security has been put in place such as WEP, but this security can be subverted with tools like AirSnort. One approach to solving these problems is to not rely on the wireless security features , and instead to place an authentication gateway in front of the wireless network or public access area and force users to authenticate against it before using the network. This HOWTO describes how to set up this gateway with Linux. 1.1. Copyright InformationThis document is copyrighted (c) 2001 Nathan Zorn. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is available at http://www.gnu.org/copyleft/fdl.html If you have any questions, please contact <zornnh@musc.edu> 1.2. DisclaimerNo liability for the contents of this documents can be accepted. Use the concepts, examples and other content at your own risk. As this is a new edition of this document, there may be errors and inaccuracies, that may of course be damaging to your system. Proceed with caution, and although this is highly unlikely, the author(s) do not take any responsibility for that. All copyrights are held by their by their respective owners, unless specifically noted otherwise. Use of a term in this document should not be regarded as affecting the validity of any trademark or service mark. Naming of particular products or brands should not be seen as endorsements. You are strongly recommended to take a backup of your system before major installation and backups at regular intervals. 1.3. New VersionsThe newest release of this document can be found at http://www.itlab.musc.edu/~nathan/authentication_gateway/ . Related HOWTOs can be found at the Linux Documentation Project homepage. 1.5. FeedbackFeedback is most certainly welcome for this document. Without your submissions and input, this document wouldn't exist. Please send your additions, comments and criticisms to the following email address : <zornnh@musc.edu>. 2. What is neededThis section describes what is needed for the authentication gateway. 2.1. NetfilterThe authentication gateway uses Netfilter and iptables to manage the firewall. Please see the Netfilter HOWTO . 2.2. Software for dynamic Netfilter rules.One means to insert and remove Netfilter rules is to use pam_iptables. This is a pluggable authentication module (PAM) written by Nathan Zorn that can be found at http://www.itlab.musc.edu/~nathan/pam_iptables . This PAM module allows users to use ssh and telnet to authenticate to the gateway. Another means to dynamically remove and create Netfilter rules is to use NocatAuth. NocatAuth can be found at http://nocat.net . NocatAuth provides a web client for authenticating to the gateway. 2.3. DHCP ServerThe authentication gateway will act as the dynamic host configuration protocol (DHCP) server for the public network. It only serves those requesting DHCP services on the public network. I used the ISC DHCP Server . 2.4. Authentication mechanismThe gateway can use any means of PAM authentication. The authentication mechanism the Medical University of South Carolina uses is LDAP. Since LDAP was used for authentication, the pam modules on the gateway box were set up to use LDAP. More information can be found at http://www.padl.com/pam_ldap.html . PAM allows you to use many means of authentication. Please see the documentation for the PAM module you would like to use. For more information on other methods, see pam modules . If NocatAuth is used, an authentication service needs to be setup. The NocatAuth authentication service supports authentication with LDAP,RADIUS,MySQL,and a password file. More information can be found at http://nocat.net/download/NoCatAuth/ . 2.5. DNS ServerThe gateway box also serves as a DNS server for the public network. I installed Bind, and set it up as a caching nameserver. The rpm package caching-namserver was also used. This package came with Red Hat. 3. Setting up the Gateway ServicesThis section describes how to setup each piece of the authentication gateway. The examples used are for a public network in the 10.0.1.0 subnet. eth0 is the interface on the box that is connected to the internal network. eth1 is the interface connected to the public network. The IP address used for this interface is 10.0.1.1. These settings can be changed to fit the network you are using. Red Hat 7.1 was used for the gateway box, so a lot of the examples are specific to Red Hat. 3.1. Netfilter SetupTo setup netfilter the kernel must be recompiled to include netfilter support. Please see the Kernel-HOWTO for more information on configuring and compiling your kernel. This is what my kernel configuration looked like.
Once netfilter has been configured, turn on IP forwarding by executing this command.
To make sure ip forwarding is enabled when the machine restarts add the following line to /etc/sysctl.conf.
If NocatAuth is being used, you can skip to the NoCatAuth gateway setup section. iptables needs to be installed. To install iptables either use a package from your distribution or install from source. Once the above options were compiled in the new kernel and iptables was installed, I set the following default firewall rules.
The above commands can also be put in an initscript to start up when the server restarts. To make sure the rules have been added issue the following commands:
To save these rules I used Red Hat's init scripts.
Now the gateway box will be able to do network address translation (NAT), but it will drop all forwarding packets except those coming from within the public network and bound for the gateway. 3.2. Dynamic Netfilter rules.This section describes how to setup the software needed to dynamically insert and remove Netfilter rules on the gateway. 3.2.1. PAM iptables ModuleThe PAM session module that inserts the firewall rules is needed to allow forwarding for the authenticated client. To set it up simply get the source and compile it by running the following commands.
You should now have two binaries called pam_iptables.so and pam_iptables.o. Copy pam_iptables.so to /lib/security/pam_iptables.so.
Now install the firewall script to /usr/local/auth-gw.
The chosen authentication client for the gateway was ssh so we added the following line to /etc/pam.d/sshd.
Now, when a user logs in with ssh, the firewall rule will be added. To test if the pam_iptables module is working perform the following steps:
3.2.2. NoCatAuth gatewayThis section describes the process of setting up the NocatAuth gateway. To setup NocatAuth get the source and install with the following steps. Make sure gpgv is installed. gpgv is a PGP signature verifier. It is part of gnupg and can be found at http://www.gnupg.org/download.html. Unpack the NocatAuth tar file.
If you do not want NoCatAuth to be in the directory /usr/local/nocat, edit the Makefile and change INST_PATH to the directory you would like NoCatAuth to reside. Next build the gateway.
Edit the /usr/local/nocat.conf file. Please see the INSTALL documentation for details on what is required in the conf file. An example conf file looks like the following:
Now you should be able to start the gateway. If any problems occur, please see the INSTALL documentation in the unpacked NoCatAuth directory. The following command will start the gateway:
3.3. DHCP Server SetupI installed DHCP using the following dhcpd.conf file.
The server was then run using eth1 , the interface to the public net.
3.4. Authentication Method SetupAuthentication with PAM and a NoCatAuth authentication service is described. Both examples are done with LDAP. Other means of authentication besides LDAP can be used. Please read the documentation for PAM and NoCatAuth to find the steps to use another authentication source. 3.4.1. PAM LDAPAs indicated in previous sections, I've set this gateway up to use LDAP for authenticating. However, you can use any means that PAM allows for authentication. See Section 2.4 for more information. In order to get PAM LDAP to authenticate, I installed OpenLDAP and configured it with the following in /etc/ldap.conf.
The following files were used to configure PAM to do the LDAP authentication. These files were generated by Red Hat's configuration utility.
3.4.2. NoCatAuth ServiceIt is recommended to install the NoCatAuth Service on another server besides the gateway. A seperate server was used in my examples. In order to setup a NoCatAuth Service, you will need the following software:
To install unpack the tar file.
If you would like to change the path that NoCatAuth resides , edit the Makefile and change INST_PATH to the desired directory. Next run the command: make authserv This installs everything in /usr/local/nocat or what you changed INST_PATH to. Then run make pgpkey The defaults should be fine for most purposes. IMPORTANT: do NOT enter a passphrase! Otherwise, you will get strange messages when the auth service attempts to encrypt messages, and tries to read your passphrase from a non-existent tty Edit /usr/local/nocat/nocat.conf to fit your situation. Here is an example:
Make sure /usr/local/nocat/pgp is owned by the web server user. (ie..nobody or www-data) Add etc/authserv.conf to your apache httpd.conf file.
Copy your /usr/local/nocat/trustedkeys.pgp to the gateway. Restart apache and try it out. Please see the NoCatAuth documentation for more information. It can be found in docs/ in the unpacked NoCatAuth directory. 4. Using the authentication gatewayTo use the authentication gateway, configure your client machine to use DHCP. Install a ssh client on the box and ssh into the gateway. Once you are logged in, you will have access to the internal network. The following is an example session from a unix based client:
As long as you stayed logged in, you will have access. Once you log out, access will be taken away. To use the authentication gateway with NoCatAuth installed, configure your client machine to use DHCP. Install a web browser such as Mozilla. Start up the web browser. The browser should be redirected to the authentication screen. Submit your username and password and a screen will pop up explaining that you are authenticated to the network and to keep the window open to remain authenticated. Click logout or close the window to end the session.5. Concluding Remarks
6. Additional Resources
7. Questions and AnswersThis is just a collection of what I believe are the most common questions people might have. Give me more feedback and I will turn this section into a proper FAQ.
|