This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
setting_up_a_captive_portal_from_scratch_using_debian [2018/12/06 20:12] abeverley |
setting_up_a_captive_portal_from_scratch_using_debian [2018/12/06 20:12] abeverley |
||
---|---|---|---|
Line 1: | Line 1: | ||
=====Setting up a captive portal from scratch using Debian===== | =====Setting up a captive portal from scratch using Debian===== | ||
- | |||
===== Introduction ===== | ===== Introduction ===== | ||
Line 63: | Line 62: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
apt-get install ppp | apt-get install ppp | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 77: | Line 77: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
noipdefault | noipdefault | ||
defaultroute | defaultroute | ||
Line 85: | Line 86: | ||
plugin pppoatm.so | plugin pppoatm.so | ||
0.0.38 | 0.0.38 | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 103: | Line 105: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
apt-get install ppp | apt-get install ppp | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 116: | Line 120: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
noipdefault | noipdefault | ||
defaultroute | defaultroute | ||
Line 124: | Line 129: | ||
plugin pppoatm.so | plugin pppoatm.so | ||
0.38 | 0.38 | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 142: | Line 148: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
echo deb http://ftp.debian.org/debian squeeze main > /etc/apt/sources.list | echo deb http://ftp.debian.org/debian squeeze main > /etc/apt/sources.list | ||
apt-get update | apt-get update | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 150: | Line 158: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
apt-get install netselect-apt | apt-get install netselect-apt | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 157: | Line 167: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
cd /etc/apt | cd /etc/apt | ||
netselect-apt squeeze | netselect-apt squeeze | ||
apt-get update | apt-get update | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 181: | Line 193: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
auto eth0 | auto eth0 | ||
iface eth0 inet static | iface eth0 inet static | ||
address 10.0.0.1 | address 10.0.0.1 | ||
netmask 255.255.0.0 | netmask 255.255.0.0 | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 191: | Line 205: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
auto eth1 | auto eth1 | ||
iface eth1 inet static | iface eth1 inet static | ||
address 192.168.0.1 | address 192.168.0.1 | ||
netmask 255.255.255.0 | netmask 255.255.255.0 | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 201: | Line 217: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
/etc/init.d/networking restart | /etc/init.d/networking restart | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 212: | Line 230: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
cd /var/ | cd /var/ | ||
wget files.andybev.com/web-portal/portalshaper-www.tar.gz | wget files.andybev.com/web-portal/portalshaper-www.tar.gz | ||
tar -zxvf portalshaper-www.tar.gz | tar -zxvf portalshaper-www.tar.gz | ||
rm portalshaper-www.tar.gz | rm portalshaper-www.tar.gz | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 231: | Line 251: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
cd /etc/apache2/mods-enabled | cd /etc/apache2/mods-enabled | ||
ln -s ../mods-available/rewrite.load | ln -s ../mods-available/rewrite.load | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 239: | Line 261: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
Options +FollowSymlinks | Options +FollowSymlinks | ||
RewriteEngine On | RewriteEngine On | ||
Line 244: | Line 267: | ||
RewriteCond %{HTTP_HOST} !^earth [NC] | RewriteCond %{HTTP_HOST} !^earth [NC] | ||
RewriteRule . http://qualso.wardroom/index.php/%{HTTP_HOST}%{REQUEST_URI}?%{QUERY_STRING} [L,R] | RewriteRule . http://qualso.wardroom/index.php/%{HTTP_HOST}%{REQUEST_URI}?%{QUERY_STRING} [L,R] | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 257: | Line 281: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
zone "wardroom" { | zone "wardroom" { | ||
type master; | type master; | ||
file "/etc/bind/db.wardroom"; | file "/etc/bind/db.wardroom"; | ||
}; | }; | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 270: | Line 296: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
qualso A 10.0.0.1 | qualso A 10.0.0.1 | ||
earth A 10.0.0.1 | earth A 10.0.0.1 | ||
mail A 10.0.0.1 | mail A 10.0.0.1 | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 288: | Line 316: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
subnet 10.0.0.0 netmask 255.255.0.0 { | subnet 10.0.0.0 netmask 255.255.0.0 { | ||
option subnet-mask 255.255.0.0; | option subnet-mask 255.255.0.0; | ||
Line 297: | Line 326: | ||
next-server 10.0.0.1; | next-server 10.0.0.1; | ||
} | } | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 303: | Line 333: | ||
Restart the DHCP server: <html><code></html> | Restart the DHCP server: <html><code></html> | ||
+ | <code> | ||
/etc/init.d/isc-dhcp-server restart | /etc/init.d/isc-dhcp-server restart | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 312: | Line 344: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
aptitude install ipset ipset-source module-assistant | aptitude install ipset ipset-source module-assistant | ||
module-assistant auto-install ipset-source | module-assistant auto-install ipset-source | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 324: | Line 358: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
cd /usr/local/bin | cd /usr/local/bin | ||
wget http://files.andybev.com/web-portal/rmtrack | wget http://files.andybev.com/web-portal/rmtrack | ||
chmod +x rmtrack | chmod +x rmtrack | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 333: | Line 369: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
cd /usr/local/bin | cd /usr/local/bin | ||
wget http://files.andybev.com/web-portal/test-ppp | wget http://files.andybev.com/web-portal/test-ppp | ||
Line 340: | Line 377: | ||
chmod +x test-ppp.init | chmod +x test-ppp.init | ||
insserv test-ppp.init | insserv test-ppp.init | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 346: | Line 384: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
cd /usr/local/bin | cd /usr/local/bin | ||
wget http://files.andybev.com/web-portal/linkstats-ppp0 | wget http://files.andybev.com/web-portal/linkstats-ppp0 | ||
Line 353: | Line 392: | ||
wget http://files.andybev.com/web-portal/tc-viewer | wget http://files.andybev.com/web-portal/tc-viewer | ||
chmod +x tc-viewer | chmod +x tc-viewer | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 359: | Line 399: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
cd /usr/local/ | cd /usr/local/ | ||
wget http://files.andybev.com/web-portal/portalshaper-sh.tar.gz | wget http://files.andybev.com/web-portal/portalshaper-sh.tar.gz | ||
tar -zxvf portalshaper-sh.tar.gz | tar -zxvf portalshaper-sh.tar.gz | ||
rm portalshaper-sh.tar.gz | rm portalshaper-sh.tar.gz | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 400: | Line 442: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
auto ppp0 | auto ppp0 | ||
iface ppp0 inet ppp | iface ppp0 inet ppp | ||
Line 405: | Line 448: | ||
provider isp0 | provider isp0 | ||
post-up /usr/local/portalshaper/master | post-up /usr/local/portalshaper/master | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 411: | Line 455: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
auto ppp1 | auto ppp1 | ||
iface ppp1 inet ppp | iface ppp1 inet ppp | ||
Line 416: | Line 461: | ||
provider isp1 | provider isp1 | ||
post-up /usr/local/portalshaper/master | post-up /usr/local/portalshaper/master | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 422: | Line 468: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
cd /etc/network/ | cd /etc/network/ | ||
wget http://files.andybev.com/web-portal/solos-preload | wget http://files.andybev.com/web-portal/solos-preload | ||
chmod +x solos-preload | chmod +x solos-preload | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 441: | Line 489: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
www-data ALL = NOPASSWD: /sbin/iptables -I internet 1 -t nat -m time --datestop ??????????????????? -m mac --mac-source ??\:??\:??\:??\:??\:?? -j RETURN | www-data ALL = NOPASSWD: /sbin/iptables -I internet 1 -t nat -m time --datestop ??????????????????? -m mac --mac-source ??\:??\:??\:??\:??\:?? -j RETURN | ||
www-data ALL = NOPASSWD: /sbin/iptables -D internet -t nat -m time --datestop ??????????????????? -m mac --mac-source ??\:??\:??\:??\:??\:?? -j RETURN | www-data ALL = NOPASSWD: /sbin/iptables -D internet -t nat -m time --datestop ??????????????????? -m mac --mac-source ??\:??\:??\:??\:??\:?? -j RETURN | ||
www-data ALL = NOPASSWD: /usr/local/bin/rmtrack [0-9]*.[0-9]*.[0-9]*.[0-9]* | www-data ALL = NOPASSWD: /usr/local/bin/rmtrack [0-9]*.[0-9]*.[0-9]*.[0-9]* | ||
www-data ALL = (proxy) NOPASSWD: /usr/lib/squid3/ext_session_acl | www-data ALL = (proxy) NOPASSWD: /usr/lib/squid3/ext_session_acl | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 460: | Line 510: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
# We don't want persistent connections, otherwise lots | # We don't want persistent connections, otherwise lots | ||
# of requests to the same server will look like a bulk download | # of requests to the same server will look like a bulk download | ||
Line 468: | Line 519: | ||
# properly routed at the re-route stage. | # properly routed at the re-route stage. | ||
qos_flows mark miss=0x1000000/0xF000000 | qos_flows mark miss=0x1000000/0xF000000 | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 481: | Line 533: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
acl our_networks src 10.0.0.0/16 | acl our_networks src 10.0.0.0/16 | ||
Line 497: | Line 550: | ||
http_access allow our_networks | http_access allow our_networks | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 503: | Line 557: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
mkdir -p /var/lib/squid/session | mkdir -p /var/lib/squid/session | ||
chown proxy:proxy /var/lib/squid/session/ | chown proxy:proxy /var/lib/squid/session/ | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 575: | Line 631: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
isp.server.name USERNAME:PASSWORD | isp.server.name USERNAME:PASSWORD | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 582: | Line 640: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
chown root:root /etc/postfix/relay_passwd | chown root:root /etc/postfix/relay_passwd | ||
chmod 600 /etc/postfix/relay_passwd | chmod 600 /etc/postfix/relay_passwd | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 590: | Line 650: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
postmap /etc/postfix/relay_passwd | postmap /etc/postfix/relay_passwd | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 597: | Line 659: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
smtp_sasl_auth_enable = yes | smtp_sasl_auth_enable = yes | ||
smtp_sasl_password_maps = hash:/etc/postfix/relay_passwd | smtp_sasl_password_maps = hash:/etc/postfix/relay_passwd | ||
smtp_sasl_security_options = | smtp_sasl_security_options = | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||
Line 612: | Line 676: | ||
<html><code></html> | <html><code></html> | ||
+ | <code> | ||
useradd -g users mailuser | useradd -g users mailuser | ||
passwd mailuser | passwd mailuser | ||
+ | </code> | ||
<html></code></html> | <html></code></html> | ||