User Tools

Site Tools


setting_up_a_captive_portal_from_scratch_using_debian

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next 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:13]
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 61: Line 60:
   * Install PPP using the command   * Install PPP using the command
  
-<​html>​<​code>​</​html>​ +<​code>​
 apt-get install ppp apt-get install ppp
 +</​code>​
  
-<​html></​code></​html>​ 
  
   * Create file /​etc/​ppp/​chap-secrets with the following contents:   * Create file /​etc/​ppp/​chap-secrets with the following contents:
Line 77: Line 75:
 <​html><​code></​html>​ <​html><​code></​html>​
  
 +<​code>​
 noipdefault noipdefault
 defaultroute defaultroute
Line 85: Line 84:
 plugin pppoatm.so plugin pppoatm.so
 0.0.38 0.0.38
 +</​code>​
 <​html></​code></​html>​ <​html></​code></​html>​
  
Line 103: Line 103:
 <​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 118:
 <​html><​code></​html>​ <​html><​code></​html>​
  
 +<​code>​
 noipdefault noipdefault
 defaultroute defaultroute
Line 124: Line 127:
 plugin pppoatm.so plugin pppoatm.so
 0.38 0.38
 +</​code>​
 <​html></​code></​html>​ <​html></​code></​html>​
  
Line 142: Line 146:
 <​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 156:
 <​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 165:
 <​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 191:
 <​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 203:
 <​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 215:
 <​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 228:
 <​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 249:
 <​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 259:
 <​html><​code></​html>​ <​html><​code></​html>​
  
 +<​code>​
 Options +FollowSymlinks Options +FollowSymlinks
 RewriteEngine On RewriteEngine On
Line 244: Line 265:
 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 279:
 <​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 294:
 <​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 314:
 <​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 324:
   next-server 10.0.0.1;   next-server 10.0.0.1;
 } }
 +</​code>​
 <​html></​code></​html>​ <​html></​code></​html>​
  
Line 303: Line 331:
 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 342:
 <​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 356:
 <​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 367:
 <​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 375:
 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 382:
 <​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 390:
 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 397:
 <​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 440:
 <​html><​code></​html>​ <​html><​code></​html>​
  
 +<​code>​
 auto ppp0 auto ppp0
 iface ppp0 inet ppp iface ppp0 inet ppp
Line 405: Line 446:
         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 453:
 <​html><​code></​html>​ <​html><​code></​html>​
  
 +<​code>​
 auto ppp1 auto ppp1
 iface ppp1 inet ppp iface ppp1 inet ppp
Line 416: Line 459:
         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 466:
 <​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 487:
 <​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 508:
 <​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 517:
 # 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 531:
 <​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 548:
    
 http_access allow our_networks http_access allow our_networks
 +</​code>​
 <​html></​code></​html>​ <​html></​code></​html>​
  
Line 503: Line 555:
 <​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 629:
 <​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 638:
 <​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 648:
 <​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 657:
 <​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 674:
 <​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>​
  
setting_up_a_captive_portal_from_scratch_using_debian.txt · Last modified: 2018/12/06 20:16 by abeverley