mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 11:42:08 +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
de81bba9a4
commit
76e79f5c41
3 changed files with 15 additions and 20 deletions
|
@ -43,13 +43,6 @@
|
|||
state: link
|
||||
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
|
||||
template:
|
||||
src: roles/captiveportal/templates/uwsgi-captiveportal.service
|
||||
|
@ -71,8 +64,17 @@
|
|||
shell: /usr/sbin/iiab-divert-to-nginx
|
||||
|
||||
- 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
|
||||
template:
|
||||
src: roles/captiveportal/templates/captiveportal-nginx.conf
|
||||
|
|
|
@ -123,7 +123,7 @@ def is_after204_timeout(ip):
|
|||
ts=tstamp(datetime.datetime.now(tzutc()))
|
||||
current_ts, last_ts, send204after = timeout_info(ip)
|
||||
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:
|
||||
return False
|
||||
if ts - int(send204after) > 0:
|
||||
|
@ -390,7 +390,7 @@ def application (environ, start_response):
|
|||
data = ['{}: {}\n'.format(key, value) for key, value in sorted(environ.items()) ]
|
||||
#logger.debug("need the correct ip:{}".format(data))
|
||||
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)
|
||||
data = []
|
||||
data.append("host: {}\n".format(environ['HTTP_HOST']))
|
||||
|
@ -484,7 +484,7 @@ def application (environ, start_response):
|
|||
environ['PATH_INFO'] == "/gen_204" or\
|
||||
environ['HTTP_HOST'] == "connectivitycheck.gstatic.com":
|
||||
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):
|
||||
return android(environ, start_response)
|
||||
elif is_after204_timeout(ip):
|
||||
|
|
|
@ -25,11 +25,4 @@
|
|||
- { src: "roles/nginx/templates/server.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/uwsgi.service', 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 }}"
|
||||
|
||||
- { src: 'roles/nginx/templates/uwsgi.unit', dest: '/etc/systemd/system/' , mode: '0644' }
|
||||
|
|
Loading…
Reference in a new issue