mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
link to config that exists, py3 in capture-wsgi.py, get systemd unit file for admin-console in place
This commit is contained in:
parent
e15daa1993
commit
5614241066
3 changed files with 15 additions and 20 deletions
|
@ -43,13 +43,6 @@
|
||||||
state: link
|
state: link
|
||||||
when: captiveportal_enabled | bool
|
when: captiveportal_enabled | bool
|
||||||
|
|
||||||
- name: Enable nginx to service the sites in checkurls list
|
|
||||||
file:
|
|
||||||
src: /etc/nginx/sites-available/capture.conf
|
|
||||||
path: /etc/nginx/sites-enabled/capture.conf
|
|
||||||
state: link
|
|
||||||
when: captiveportal_enabled | bool
|
|
||||||
|
|
||||||
- name: Copy unit file for uWSGI service
|
- name: Copy unit file for uWSGI service
|
||||||
template:
|
template:
|
||||||
src: roles/captiveportal/templates/uwsgi-captiveportal.service
|
src: roles/captiveportal/templates/uwsgi-captiveportal.service
|
||||||
|
@ -71,8 +64,17 @@
|
||||||
shell: /usr/sbin/iiab-divert-to-nginx
|
shell: /usr/sbin/iiab-divert-to-nginx
|
||||||
|
|
||||||
- name: Run script to generate nginx servers from checkurls input list
|
- name: Run script to generate nginx servers from checkurls input list
|
||||||
shell: /usr/sbin/iiab-make-cp-servers.py
|
command: /usr/sbin/iiab-make-cp-servers.py
|
||||||
|
args:
|
||||||
|
creates: /etc/nginx/sites-available/capture.conf
|
||||||
|
|
||||||
|
- name: Enable nginx to service the sites in checkurls list
|
||||||
|
file:
|
||||||
|
src: /etc/nginx/sites-available/capture.conf
|
||||||
|
path: /etc/nginx/sites-enabled/capture.conf
|
||||||
|
state: link
|
||||||
|
when: captiveportal_enabled | bool
|
||||||
|
|
||||||
- name: Install nginx's captiveportal.conf from template if captiveportal_enabled
|
- name: Install nginx's captiveportal.conf from template if captiveportal_enabled
|
||||||
template:
|
template:
|
||||||
src: roles/captiveportal/templates/captiveportal-nginx.conf
|
src: roles/captiveportal/templates/captiveportal-nginx.conf
|
||||||
|
|
|
@ -122,7 +122,7 @@ def is_after204_timeout(ip):
|
||||||
ts=tstamp(datetime.datetime.now(tzutc()))
|
ts=tstamp(datetime.datetime.now(tzutc()))
|
||||||
current_ts, last_ts, send204after = timeout_info(ip)
|
current_ts, last_ts, send204after = timeout_info(ip)
|
||||||
if send204after == 0: return False
|
if send204after == 0: return False
|
||||||
logger.debug("function: is_after204_timeout send204after:{} current: {}".format(send204after,ts,))
|
logger.debug("function: is_after204_timeout send204after:{} current: {}".format((send204after,ts,)))
|
||||||
if not send204after:
|
if not send204after:
|
||||||
return False
|
return False
|
||||||
if ts - int(send204after) > 0:
|
if ts - int(send204after) > 0:
|
||||||
|
@ -392,7 +392,7 @@ def application (environ, start_response):
|
||||||
data = ['{}: {}\n'.format(key, value) for key, value in sorted(environ.items()) ]
|
data = ['{}: {}\n'.format(key, value) for key, value in sorted(environ.items()) ]
|
||||||
#logger.debug("need the correct ip:{}".format(data))
|
#logger.debug("need the correct ip:{}".format(data))
|
||||||
ip = environ['REMOTE_ADDR'].strip()
|
ip = environ['REMOTE_ADDR'].strip()
|
||||||
cmd="arp -an %s|gawk \'{print $4}\'"%(ip)
|
cmd="arp -an {}|gawk \'{print $4}\'".format(ip)
|
||||||
mac = subprocess.check_output(cmd, shell=True)
|
mac = subprocess.check_output(cmd, shell=True)
|
||||||
data = []
|
data = []
|
||||||
data.append("host: {}\n".format(environ['HTTP_HOST']))
|
data.append("host: {}\n".format(environ['HTTP_HOST']))
|
||||||
|
@ -486,7 +486,7 @@ def application (environ, start_response):
|
||||||
environ['PATH_INFO'] == "/gen_204" or\
|
environ['PATH_INFO'] == "/gen_204" or\
|
||||||
environ['HTTP_HOST'] == "connectivitycheck.gstatic.com":
|
environ['HTTP_HOST'] == "connectivitycheck.gstatic.com":
|
||||||
current_ts, last_ts, send204after = timeout_info(ip)
|
current_ts, last_ts, send204after = timeout_info(ip)
|
||||||
logger.debug("current_ts: {} last_ts: {} send204after: {}".format(current_ts, last_ts, send204after,))
|
logger.debug("current_ts: {} last_ts: {} send204after: {}".formmat(current_ts, last_ts, send204after,))
|
||||||
if not last_ts or (ts - int(last_ts) > INACTIVITY_TO):
|
if not last_ts or (ts - int(last_ts) > INACTIVITY_TO):
|
||||||
return android(environ, start_response)
|
return android(environ, start_response)
|
||||||
elif is_after204_timeout(ip):
|
elif is_after204_timeout(ip):
|
||||||
|
|
|
@ -25,11 +25,4 @@
|
||||||
- { src: "roles/nginx/templates/server.conf", dest: "/etc/nginx/" }
|
- { src: "roles/nginx/templates/server.conf", dest: "/etc/nginx/" }
|
||||||
- { src: "roles/nginx/templates/nginx.conf", dest: "/etc/nginx/" }
|
- { src: "roles/nginx/templates/nginx.conf", dest: "/etc/nginx/" }
|
||||||
- { src: 'roles/nginx/templates/ports.conf', dest: '/etc/{{ apache_service }}/' , mode: '0644' }
|
- { src: 'roles/nginx/templates/ports.conf', dest: '/etc/{{ apache_service }}/' , mode: '0644' }
|
||||||
- { src: 'roles/nginx/templates/uwsgi.service', dest: '/etc/systemd/system/' , mode: '0644' }
|
- { src: 'roles/nginx/templates/uwsgi.unit', dest: '/etc/systemd/system/' , mode: '0644' }
|
||||||
|
|
||||||
- name: Let uwsgi running as {{ apache_user }} write log files
|
|
||||||
file:
|
|
||||||
path: /var/log/uwsgi/app
|
|
||||||
state: directory
|
|
||||||
owner: "{{ apache_user }}"
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue