From 174472bb45e683c5274e0928ae6422d84a5f5acc Mon Sep 17 00:00:00 2001 From: "Langhammer, Jens" Date: Mon, 22 Jul 2019 15:20:17 +0200 Subject: [PATCH] all: get rid of individual requirements file, remove version from every module --- passbook/admin/__init__.py | 2 - passbook/admin/requirements.txt | 2 - passbook/api/__init__.py | 2 - passbook/api/requirements.txt | 3 - passbook/app_gw/__init__.py | 2 - passbook/app_gw/requirements.txt | 7 -- passbook/audit/__init__.py | 2 - passbook/captcha_factor/__init__.py | 2 - passbook/captcha_factor/requirements.txt | 1 - passbook/core/nginx.conf | 66 +++++++++++++++++++ passbook/hibp_policy/__init__.py | 2 - passbook/ldap/__init__.py | 2 - passbook/ldap/requirements.txt | 1 - passbook/lib/__init__.py | 2 - passbook/oauth_client/__init__.py | 2 - passbook/oauth_client/requirements.txt | 2 - passbook/oauth_provider/__init__.py | 2 - passbook/oauth_provider/requirements.txt | 2 - .../migrations/0002_auto_20190709_1416.py | 17 +++++ passbook/oidc_provider/requirements.txt | 1 - passbook/otp/__init__.py | 2 - passbook/otp/requirements.txt | 2 - passbook/password_expiry_policy/__init__.py | 2 - passbook/root/requirements.txt | 15 ----- passbook/saml_idp/__init__.py | 2 - passbook/saml_idp/requirements.txt | 5 -- passbook/suspicious_policy/__init__.py | 2 - passbook/suspicious_policy/signals.py | 8 ++- 28 files changed, 88 insertions(+), 72 deletions(-) delete mode 100644 passbook/admin/requirements.txt delete mode 100644 passbook/api/requirements.txt delete mode 100644 passbook/app_gw/requirements.txt delete mode 100644 passbook/captcha_factor/requirements.txt create mode 100644 passbook/core/nginx.conf delete mode 100644 passbook/ldap/requirements.txt delete mode 100644 passbook/oauth_client/requirements.txt delete mode 100644 passbook/oauth_provider/requirements.txt create mode 100644 passbook/oidc_provider/migrations/0002_auto_20190709_1416.py delete mode 100644 passbook/oidc_provider/requirements.txt delete mode 100644 passbook/otp/requirements.txt delete mode 100644 passbook/root/requirements.txt delete mode 100644 passbook/saml_idp/requirements.txt diff --git a/passbook/admin/__init__.py b/passbook/admin/__init__.py index dbdd17cd5..e69de29bb 100644 --- a/passbook/admin/__init__.py +++ b/passbook/admin/__init__.py @@ -1,2 +0,0 @@ -"""passbook admin""" -__version__ = '0.2.6-beta' diff --git a/passbook/admin/requirements.txt b/passbook/admin/requirements.txt deleted file mode 100644 index b2cf9c43d..000000000 --- a/passbook/admin/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -django-rest-framework -drf_yasg diff --git a/passbook/api/__init__.py b/passbook/api/__init__.py index d6d68f0fc..e69de29bb 100644 --- a/passbook/api/__init__.py +++ b/passbook/api/__init__.py @@ -1,2 +0,0 @@ -"""passbook api""" -__version__ = '0.2.6-beta' diff --git a/passbook/api/requirements.txt b/passbook/api/requirements.txt deleted file mode 100644 index b71855af2..000000000 --- a/passbook/api/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -djangorestframework==3.9.4 -drf_yasg -django-filters diff --git a/passbook/app_gw/__init__.py b/passbook/app_gw/__init__.py index 309cc158c..e69de29bb 100644 --- a/passbook/app_gw/__init__.py +++ b/passbook/app_gw/__init__.py @@ -1,2 +0,0 @@ -"""passbook Application Security Gateway Header""" -__version__ = '0.2.6-beta' diff --git a/passbook/app_gw/requirements.txt b/passbook/app_gw/requirements.txt deleted file mode 100644 index 19b5cf2d4..000000000 --- a/passbook/app_gw/requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -django-revproxy -urllib3[secure] -channels -service_identity -websocket-client -daphne<2.3.0 -asgiref~=2.3 diff --git a/passbook/audit/__init__.py b/passbook/audit/__init__.py index efc79c6ee..e69de29bb 100644 --- a/passbook/audit/__init__.py +++ b/passbook/audit/__init__.py @@ -1,2 +0,0 @@ -"""passbook audit Header""" -__version__ = '0.2.6-beta' diff --git a/passbook/captcha_factor/__init__.py b/passbook/captcha_factor/__init__.py index 13c8460fc..e69de29bb 100644 --- a/passbook/captcha_factor/__init__.py +++ b/passbook/captcha_factor/__init__.py @@ -1,2 +0,0 @@ -"""passbook captcha_factor Header""" -__version__ = '0.2.6-beta' diff --git a/passbook/captcha_factor/requirements.txt b/passbook/captcha_factor/requirements.txt deleted file mode 100644 index ec8b7d8e2..000000000 --- a/passbook/captcha_factor/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -django-recaptcha diff --git a/passbook/core/nginx.conf b/passbook/core/nginx.conf new file mode 100644 index 000000000..c3500b5de --- /dev/null +++ b/passbook/core/nginx.conf @@ -0,0 +1,66 @@ +user nginx; +worker_processes 1; + +error_log stderr warn; +pid /var/run/nginx.pid; + +events { + worker_connections 1024; +} + +http { + include /etc/nginx/mime.types; + default_type application/octet-stream; + + log_format json_combined escape=json + '{' + '"time_local":"$time_local",' + '"remote_addr":"$remote_addr",' + '"remote_user":"$remote_user",' + '"request":"$request",' + '"status": "$status",' + '"body_bytes_sent":"$body_bytes_sent",' + '"request_time":"$request_time",' + '"http_referrer":"$http_referer",' + '"http_user_agent":"$http_user_agent"' + '}'; + + access_log /dev/stdout json_combined; + + sendfile on; + tcp_nopush on; + + keepalive_timeout 65; + + server { + + server_name _; + + gzip on; + gzip_types application/javascript image/* text/css; + gunzip on; + add_header X-passbook-Version 0.2.6-beta; + add_header Vary X-passbook-Version; + root /static/; + + location /_/healthz { + return 204; + } + location ~* \.(jpg|jpeg|png|gif|ico)$ { + expires 30d; + } + location ~* \.(css|js)$ { + expires 7d; + } + + } + + server { + + listen 8080; + + location = /stub_status { + stub_status; + } + } +} diff --git a/passbook/hibp_policy/__init__.py b/passbook/hibp_policy/__init__.py index 3fb350c17..e69de29bb 100644 --- a/passbook/hibp_policy/__init__.py +++ b/passbook/hibp_policy/__init__.py @@ -1,2 +0,0 @@ -"""passbook hibp_policy""" -__version__ = '0.2.6-beta' diff --git a/passbook/ldap/__init__.py b/passbook/ldap/__init__.py index 1e9cdc0f0..e69de29bb 100644 --- a/passbook/ldap/__init__.py +++ b/passbook/ldap/__init__.py @@ -1,2 +0,0 @@ -"""Passbook ldap app Header""" -__version__ = '0.2.6-beta' diff --git a/passbook/ldap/requirements.txt b/passbook/ldap/requirements.txt deleted file mode 100644 index a84364752..000000000 --- a/passbook/ldap/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -ldap3 diff --git a/passbook/lib/__init__.py b/passbook/lib/__init__.py index a4cc8556b..e69de29bb 100644 --- a/passbook/lib/__init__.py +++ b/passbook/lib/__init__.py @@ -1,2 +0,0 @@ -"""passbook lib""" -__version__ = '0.2.6-beta' diff --git a/passbook/oauth_client/__init__.py b/passbook/oauth_client/__init__.py index c085ec55a..e69de29bb 100644 --- a/passbook/oauth_client/__init__.py +++ b/passbook/oauth_client/__init__.py @@ -1,2 +0,0 @@ -"""passbook oauth_client Header""" -__version__ = '0.2.6-beta' diff --git a/passbook/oauth_client/requirements.txt b/passbook/oauth_client/requirements.txt deleted file mode 100644 index 1bc05dd67..000000000 --- a/passbook/oauth_client/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -requests_oauthlib>=0.4.2 -oauthlib>=2.0.6 diff --git a/passbook/oauth_provider/__init__.py b/passbook/oauth_provider/__init__.py index 60619600e..e69de29bb 100644 --- a/passbook/oauth_provider/__init__.py +++ b/passbook/oauth_provider/__init__.py @@ -1,2 +0,0 @@ -"""passbook oauth_provider Header""" -__version__ = '0.2.6-beta' diff --git a/passbook/oauth_provider/requirements.txt b/passbook/oauth_provider/requirements.txt deleted file mode 100644 index 5b2c3c67b..000000000 --- a/passbook/oauth_provider/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -django-oauth-toolkit -django-cors-middleware diff --git a/passbook/oidc_provider/migrations/0002_auto_20190709_1416.py b/passbook/oidc_provider/migrations/0002_auto_20190709_1416.py new file mode 100644 index 000000000..6bc8bc225 --- /dev/null +++ b/passbook/oidc_provider/migrations/0002_auto_20190709_1416.py @@ -0,0 +1,17 @@ +# Generated by Django 2.2.3 on 2019-07-09 14:16 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('passbook_oidc_provider', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + name='openidprovider', + options={'verbose_name': 'OpenID Provider', 'verbose_name_plural': 'OpenID Providers'}, + ), + ] diff --git a/passbook/oidc_provider/requirements.txt b/passbook/oidc_provider/requirements.txt deleted file mode 100644 index 615ae1804..000000000 --- a/passbook/oidc_provider/requirements.txt +++ /dev/null @@ -1 +0,0 @@ -django-oidc-provider diff --git a/passbook/otp/__init__.py b/passbook/otp/__init__.py index a95ccf91f..e69de29bb 100644 --- a/passbook/otp/__init__.py +++ b/passbook/otp/__init__.py @@ -1,2 +0,0 @@ -"""passbook otp Header""" -__version__ = '0.2.6-beta' diff --git a/passbook/otp/requirements.txt b/passbook/otp/requirements.txt deleted file mode 100644 index 5a3913776..000000000 --- a/passbook/otp/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -django_otp -qrcode diff --git a/passbook/password_expiry_policy/__init__.py b/passbook/password_expiry_policy/__init__.py index e2ea4e8d6..e69de29bb 100644 --- a/passbook/password_expiry_policy/__init__.py +++ b/passbook/password_expiry_policy/__init__.py @@ -1,2 +0,0 @@ -"""passbook password_expiry""" -__version__ = '0.2.6-beta' diff --git a/passbook/root/requirements.txt b/passbook/root/requirements.txt deleted file mode 100644 index 32f120342..000000000 --- a/passbook/root/requirements.txt +++ /dev/null @@ -1,15 +0,0 @@ -celery -colorlog -cherrypy -django-ipware -django-model-utils -django-redis -django>=2.0 -djangorestframework -idna<2.8,>=2.5 -markdown -psycopg2 -PyYAML -sentry-sdk -pip -urllib3<1.25,>=1.21.1 diff --git a/passbook/saml_idp/__init__.py b/passbook/saml_idp/__init__.py index 32c0b3398..e69de29bb 100644 --- a/passbook/saml_idp/__init__.py +++ b/passbook/saml_idp/__init__.py @@ -1,2 +0,0 @@ -"""passbook saml_idp Header""" -__version__ = '0.2.6-beta' diff --git a/passbook/saml_idp/requirements.txt b/passbook/saml_idp/requirements.txt deleted file mode 100644 index ca554518a..000000000 --- a/passbook/saml_idp/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -beautifulsoup4>=4.6.0 -lxml>=3.8.0 -signxml -defusedxml -PyCryptodome diff --git a/passbook/suspicious_policy/__init__.py b/passbook/suspicious_policy/__init__.py index ee0e279c4..e69de29bb 100644 --- a/passbook/suspicious_policy/__init__.py +++ b/passbook/suspicious_policy/__init__.py @@ -1,2 +0,0 @@ -"""passbook suspicious_policy""" -__version__ = '0.2.6-beta' diff --git a/passbook/suspicious_policy/signals.py b/passbook/suspicious_policy/signals.py index df3ae095d..f18f986e1 100644 --- a/passbook/suspicious_policy/signals.py +++ b/passbook/suspicious_policy/signals.py @@ -13,9 +13,11 @@ LOGGER = getLogger(__name__) def update_score(request, username, amount): """Update score for IP and User""" - remote_ip, _ = get_client_ip(request) - if not remote_ip: - remote_ip = '255.255.255.255' + remote_ip = '255.255.255.255' + if 'ip' in request: + remote_ip = request['ip'] + elif request: + remote_ip, _ = get_client_ip(request) ip_score, _ = IPScore.objects.update_or_create(ip=remote_ip) ip_score.score += amount ip_score.save()