mirror of
				https://github.com/iiab/iiab.git
				synced 2025-03-09 15:40:17 +00:00 
			
		
		
		
	use py_ for new captive_portal variables
This commit is contained in:
		
							parent
							
								
									2f47e84696
								
							
						
					
					
						commit
						ca7c291ba5
					
				
					 3 changed files with 7 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -75,6 +75,6 @@ captive_portal_enabled: False
 | 
			
		|||
# for simple python captive portal
 | 
			
		||||
py_captive_portal_install: True
 | 
			
		||||
py_captive_portal_enabled: True
 | 
			
		||||
captive_portal_port: "9090"
 | 
			
		||||
captive_portal_username: "Admin"
 | 
			
		||||
captive_portal_password: "g0adm1n"
 | 
			
		||||
py_captive_portal_port: "9090"
 | 
			
		||||
py_captive_portal_username: "Admin"
 | 
			
		||||
py_captive_portal_password: "changeme"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,7 +7,7 @@ import BaseHTTPServer
 | 
			
		|||
import cgi
 | 
			
		||||
 | 
			
		||||
# These variables are used as settings
 | 
			
		||||
PORT       = int("{{ captive_portal_port }}")        # the port in which the captive portal web server listens
 | 
			
		||||
PORT       = int("{{ py_captive_portal_port }}")        # the port in which the captive portal web server listens
 | 
			
		||||
IFACE      = "{{ iiab_lan_iface }}"       # the interface that captive portal protects
 | 
			
		||||
IP_ADDRESS = "{{ lan_ip }}"  # the ip address of the captive portal (it can be the IP of IFACE)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -70,7 +70,7 @@ class CaptivePortal(BaseHTTPServer.BaseHTTPRequestHandler):
 | 
			
		|||
        username = form.getvalue("username")
 | 
			
		||||
        password = form.getvalue("password")
 | 
			
		||||
        #dummy security check
 | 
			
		||||
        if username == '{{ captive_portal_username }}' and password == '{{ captive_portal_password }}':
 | 
			
		||||
        if username == '{{ py_captive_portal_username }}' and password == '{{ py_captive_portal_password }}':
 | 
			
		||||
            #authorized user
 | 
			
		||||
            remote_IP = self.client_address[0]
 | 
			
		||||
            print 'New authorization from '+ remote_IP
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -102,7 +102,7 @@ $IPTABLES -A FORWARD -i $wan -o $lan -m state --state ESTABLISHED,RELATED -j ACC
 | 
			
		|||
 | 
			
		||||
#Block https traffic except if directed at server
 | 
			
		||||
if [  "$gw_block_https" == "True" ]; then
 | 
			
		||||
    $IPTABLES -A FORWARD -p tcp ! -d 172.18.96.1 --dport 443 -j DROP
 | 
			
		||||
    $IPTABLES -A FORWARD -p tcp ! -d {{ lan_ip }} --dport 443 -j DROP
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Allow outgoing connections from the LAN side.
 | 
			
		||||
| 
						 | 
				
			
			@ -125,7 +125,7 @@ if [ "$captive_portal_enabled" == "True" ];then
 | 
			
		|||
   $IPTABLES -t nat -A PREROUTING -i {{ iiab_lan_iface }} -p tcp -m mark --mark 99 -m tcp --dport 80 -j DNAT --to-destination {{ lan_ip }}
 | 
			
		||||
 | 
			
		||||
elif [ "py_$captive_portal_enabled" == "True" ];then
 | 
			
		||||
    $IPTABLES  -t nat  -A PREROUTING -i $lan -p tcp --dport 80 ! -d {{ lan_ip }} -j DNAT --to {{ lan_ip }}:9090
 | 
			
		||||
    $IPTABLES  -t nat  -A PREROUTING -i $lan -p tcp --dport 80 ! -d {{ lan_ip }} -j DNAT --to {{ lan_ip }}:{{ py_captive_portal_port }}
 | 
			
		||||
 | 
			
		||||
elif [ "$HTTPCACHE_ON" == "True" ]; then
 | 
			
		||||
    $IPTABLES  -t nat  -A PREROUTING -i $lan -p tcp --dport 80 ! -d {{ lan_ip }} -j DNAT --to {{ lan_ip }}:3128
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue