diff --git a/roles/captiveportal/files/capture-wsgi.py b/roles/captiveportal/files/capture-wsgi.py index a1e37b686..44551fea0 100755 --- a/roles/captiveportal/files/capture-wsgi.py +++ b/roles/captiveportal/files/capture-wsgi.py @@ -39,7 +39,11 @@ doc_root = get_iiab_env("WWWROOT") fully_qualified_domain_name = get_iiab_env("FQDN") -loggingLevel = "DEBUG" +loggingLevel = "ERROR" +if len(sys.argv) > 1: + if sys.argv[1] == '-l': + loggingLevel = "DEBUG" + # set up some logging -- selectable for diagnostics logging.basicConfig(filename='/var/log/apache2/portal.log',format='%(asctime)s.%(msecs)03d:%(name)s:%(message)s', datefmt='%M:%S',level=loggingLevel) logger = logging.getLogger('/var/log/apache2/portal.log') @@ -146,7 +150,7 @@ def set_lasttimestamp(ip): # ################### Action routines based on OS ################3 def microsoft(environ,start_response): - print('in microsoft') + logger.debug('in microsoft') # firefox -- seems both mac and Windows use it agent = environ.get('HTTP_USER_AGENT','default_agent') if agent.startswith('Mozilla'): @@ -242,7 +246,7 @@ def android_https(environ, start_response): return [response_body] def mac_splash(environ,start_response): - print('in mac_splash') + logger.debug('in mac_splash') logger.debug("in function mac_splash") en_txt={ 'message': "Click on the button to go to the IIAB home page",\ 'btn1': "GO TO IIAB HOME PAGE",'success_token': 'Success', @@ -266,7 +270,7 @@ def mac_splash(environ,start_response): return [response_body] def macintosh(environ, start_response): - print('in macintosh') + logger.debug('in macintosh') global ip logger.debug("in function mcintosh") #print >> sys.stderr , "Geo Print to stderr" + environ['HTTP_HOST'] diff --git a/roles/captiveportal/templates/iiab-divert-to-nginx b/roles/captiveportal/templates/iiab-divert-to-nginx index 45b1b0f99..cf4986612 100755 --- a/roles/captiveportal/templates/iiab-divert-to-nginx +++ b/roles/captiveportal/templates/iiab-divert-to-nginx @@ -1,4 +1,4 @@ #!/bin/bash -x -awk '{print("address=/" $1 "/ 172.18.96.1")}' /opt/iiab/captiveportal/checkurls > /etc/dnsmasq.d/capture +awk '{print("address=/" $1 "/172.18.96.1")}' /opt/iiab/captiveportal/checkurls > /etc/dnsmasq.d/capture echo "#following tells windows 7 that captive portal is active" >>/etc/dnsmasq.d/capture echo "address=/dns.msftncsi.com/131.107.255.255" >> /etc/dnsmasq.d/capture