Skip to content
Snippets Groups Projects
Commit 70a20679 authored by Christian Dresen's avatar Christian Dresen
Browse files

no message

parent 6f9946be
No related branches found
No related tags found
No related merge requests found
Showing
with 637 additions and 46 deletions
web/media/flaghunter_logo2.png

23.8 KiB

web/media/itsecteam_ms_logo.png

45.4 KiB

web/media/mongodb_logo.png

4.51 KiB

File added
"""
Django settings for warpauth project.
Django settings for FlagHunter project.
Generated by 'django-admin startproject' using Django 1.8.5.
Generated by 'django-admin startproject' using Django 1.8.3.
For more information on this file, see
https://docs.djangoproject.com/en/1.8/topics/settings/
......@@ -12,6 +12,9 @@ https://docs.djangoproject.com/en/1.8/ref/settings/
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
import ldap
from django_auth_ldap.config import LDAPSearch, GroupOfNamesType, PosixGroupType
import logging
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
......@@ -20,33 +23,30 @@ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'x(e-&mxb*99l2d0*oe91b@&4h6rpcx0j4%#@eq!r0(6%3gnq32'
SECRET_KEY = '4m4c(_$ubwued9p-insp!950g&r0yu851bp287$2a3ydj^y=0='
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
MEDIA_ROOT = 'media/'
MEDIA_URL = '/media/'
ALLOWED_HOSTS = []
SITE_ID = 1
# Application definition
INSTALLED_APPS = (
'django_admin_bootstrapped',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'bootstrapform',
'allauth_bootstrap',
'allauth',
'allauth.account',
'warpauthWeb',
)
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
......@@ -56,26 +56,21 @@ MIDDLEWARE_CLASSES = (
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.middleware.locale.LocaleMiddleware',
)
ROOT_URLCONF = 'warpauth.urls'
LOGIN_REDIRECT_URL = '/'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates'),os.path.join(BASE_DIR, 'auth/templates')],
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
# "allauth.account.context_processors.account",
# "allauth.socialaccount.context_processors.socialaccount",
'django.contrib.messages.context_processors.messages',
'auth.context_processors.navbar_processor'
],
},
},
......@@ -90,29 +85,28 @@ WSGI_APPLICATION = 'warpauth.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
'NAME': 'warpauth.db'
},
'ldap': {
'ENGINE': 'ldapdb.backends.ldap',
'NAME': 'ldap://s1.dyhost.de/',
'USER': 'cn=admin,dc=warpzone,dc=ms',
'PASSWORD': '12345',
}
}
AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend',
'django.contrib.auth.backends.ModelBackend',
)
DATABASE_ROUTERS = ['ldapdb.router.Router']
# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
#LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'de'
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
TIME_ZONE = 'Europe/Berlin'
USE_I18N = True
USE_L10N = True
USE_TZ = True
USE_TZ = False
# Static files (CSS, JavaScript, Images)
......@@ -120,17 +114,41 @@ USE_TZ = True
STATIC_URL = '/static/'
AUTHENTICATION_BACKENDS = (
'django_auth_ldap.backend.LDAPBackend',
'django.contrib.auth.backends.ModelBackend',
)
MEDIA_ROOT = 'media/'
MEDIA_URL = '/media/'
AUTH_LDAP_BIND_DN = "cn=admin,dc=warpzone,dc=ms"
AUTH_LDAP_BIND_PASSWORD = "12345"
AUTH_LDAP_SERVER_URI = "ldap://s1.dyhost.de"
AUTH_LDAP_BIND_DN = "admin"
AUTH_LDAP_BIND_PASSWORD = "12345"
AUTH_LDAP_USER_DN_TEMPLATE = "uid=%(user)s,ou=User,dc=warpzone,dc=ms"
AUTH_LDAP_USER_ATTR_MAP = {
"first_name": "givenName",
"last_name": "sn",
"email": "mail"
}
\ No newline at end of file
AUTH_LDAP_USER_SEARCH = LDAPSearch("ou=User,dc=warpzone,dc=ms",
ldap.SCOPE_SUBTREE, "(uid=%(user)s)")
AUTH_LDAP_USER_ATTR_MAP = {"first_name": "givenName", "last_name": "sn","email":"description"}
AUTH_LDAP_PROFILE_ATTR_MAP = {"home_directory": "homeDirectory"}
AUTH_LDAP_GROUP_SEARCH = LDAPSearch("ou=Groups,dc=warpzone,dc=ms",
ldap.SCOPE_SUBTREE, "(objectClass=posixGroup)"
)
AUTH_LDAP_GROUP_TYPE = PosixGroupType()
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
"is_active": "cn=active,ou=Groups,dc=warpzone,dc=ms",
"is_staff": ["cn=superuser,ou=Groups,dc=warpzone,dc=ms",
"cn=superuser,ou=Groups,dc=warpzone,dc=ms"],
"is_superuser": "cn=superuser,ou=Groups,dc=warpzone,dc=ms"
}
AUTH_LDAP_FIND_GROUP_PERMS = True
AUTH_LDAP_CACHE_GROUPS = True
AUTH_LDAP_GROUP_CACHE_TIMEOUT = 300
logger = logging.getLogger('django_auth_ldap')
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.DEBUG)
"""warpauth URL Configuration
"""FlagHunter URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.8/topics/http/urls/
......@@ -15,13 +15,10 @@ Including another URLconf
"""
from django.conf.urls import include, url
from django.contrib import admin
from auth import views
from django.conf import settings
urlpatterns = [
url(r'^admin/', include(admin.site.urls)),
url(r'^$', views.index, name='index'),
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT,}),
url(r'^accounts/', include('allauth.urls')),
url(r'^', include('warpauthWeb.urls')),
]
"""
WSGI config for warpauth project.
WSGI config for FlagHunter project.
It exposes the WSGI callable as a module-level variable named ``application``.
......
File moved
File moved
from django.db import models
from ldapdb.models.fields import CharField, IntegerField, ListField
import ldapdb.models
class PasswordResetToken(models.Model):
user = models.CharField(max_length=100)
email = models.CharField(max_length=100)
hash = models.CharField(max_length=100)
class LdapUser(ldapdb.models.Model):
base_dn = "ou=user,dc=warpzone,dc=ms"
object_classes = ['posixAccount', 'shadowAccount', 'uidObject', 'account']
uid = CharField(db_column='uid', unique=True, primary_key=True)
email = CharField(db_column='description', max_length=200)
password = CharField(db_column='Password')
def __str__(self):
return self.uid
def __unicode__(self):
return self.uid
class LdapGroup(ldapdb.models.Model):
base_dn = "ou=groups,dc=nodomain,dc=org"
object_classes = ['posixGroup']
gid = IntegerField(db_column='gidNumber', unique=True)
name = CharField(db_column='cn', max_length=200, primary_key=True)
members = ListField(db_column='memberUid')
def __str__(self):
return self.name
def __unicode__(self):
return self.name
\ No newline at end of file
{% extends "base.html" %} {% block content %}
{% endblock %}
\ No newline at end of file
This diff is collapsed.
The MIT License (MIT)
Copyright (c) 2011-2015 Twitter, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment