add ldap frontend

This commit is contained in:
Franzi 2021-12-21 10:48:22 +01:00
parent 6543d1eba4
commit 121f49a828
Signed by: kunsi
GPG key ID: 12E3D2136B818350
5 changed files with 109 additions and 0 deletions

View file

@ -0,0 +1,4 @@
<%
from bundlewrap.metadata import metadata_to_json
%>\
${metadata_to_json(node.metadata.get('ldap-frontend', {}))}

View file

@ -0,0 +1,14 @@
[Unit]
Description=LDAP fronten
After=network.target
Requires=slapd.service
[Service]
User=www-data
Group=www-data
Environment=APP_CONFIG=/opt/ldap-frontend/config.json
WorkingDirectory=/opt/ldap-frontend/src
ExecStart=/opt/ldap-frontend/venv/bin/gunicorn --threads 4 --bind 127.0.0.1:23000 'ldap_frontend:app'
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,59 @@
directories = {
'/opt/ldap-frontend/src': {},
}
git_deploy = {
'/opt/ldap-frontend/src': {
'repo': 'https://git.franzi.business/qzwi/ldap-frontend.git',
'rev': 'main',
'triggers': {
'action:ldap-frontend_install_deps',
'svc_systemd:ldap-frontend:restart',
},
},
}
actions = {
'ldap-frontend_make_virtualenv': {
'command': 'virtualenv -p python3 /opt/ldap-frontend/venv',
'unless': 'test -d /opt/ldap-frontend/venv',
'needs': {
'directory:/opt/ldap-frontend/src',
},
},
'ldap-frontend_install_deps': {
'triggered': True,
'command': ' && '.join([
'cd /opt/ldap-frontend/src',
'/opt/ldap-frontend/venv/bin/pip install --upgrade -r requirements.txt',
]),
'needs': {
'action:ldap-frontend_make_virtualenv',
},
},
}
files = {
'/etc/systemd/system/ldap-frontend.service': {
'triggers': {
'action:systemd-reload',
'svc_systemd:ldap-frontend:restart',
},
},
'/opt/ldap-frontend/config.json': {
'content_type': 'mako',
'triggers': {
'svc_systemd:ldap-frontend:restart',
},
},
}
svc_systemd = {
'ldap-frontend': {
'needs': {
'action:ldap-frontend_install_deps',
'file:/etc/systemd/system/ldap-frontend.service',
'file:/opt/ldap-frontend/config.json',
},
},
}

View file

@ -0,0 +1,21 @@
defaults = {
'ldap-frontend': {
'ldap': {
'server': 'ldap://localhost:389',
'username': 'uid=ldap-frontend,ou=Applications,dc=qzwi,dc=de',
'password': repo.vault.decrypt('encrypt$gAAAAABhwZ_5KNOCqkSwMm9zmeVksndPXXtrKJUatf7GYhwvVJQJQwM0OX7S-ZKHwBVCxegMqS46LrJX0ZLTH_gouekKEGRSsttARZgs9giAGy9ijXdDirQ='),
'group_base': 'ou=Groups,dc=qzwi,dc=de',
'user_base': 'ou=Users,dc=qzwi,dc=de',
},
'template': {
'group_admin': '(&(objectclass=inetOrgPerson)(uid={})(memberOf=ou=qzwi-admins,ou=Groups,dc=qzwi,dc=de))',
'group_dn': 'ou={},ou=Groups,dc=qzwi,dc=de',
'group_members': '(&(objectclass=inetOrgPerson)(memberOf=ou={},ou=Groups,dc=qzwi,dc=de))',
'group_nonmembers': '(&(objectclass=inetOrgPerson)(!(memberOf=ou={},ou=Groups,dc=qzwi,dc=de)))',
'user_dn': 'uid={},ou=Users,dc=qzwi,dc=de',
'user_search': '(&(objectclass=inetOrgPerson)(uid={}))',
},
'title': 'Usermanagement QZWI',
},
}

View file

@ -1,6 +1,7 @@
#hostname = "2a00:f820:528::4"
hostname = "31.47.232.108"
bundles = [
"ldap-frontend",
"letsencrypt",
"nginx",
"nextcloud",
@ -37,6 +38,8 @@ ssl = "letsencrypt"
[metadata.nginx.vhosts.openldap]
domain = "ldap.qzwi.de"
ssl = "letsencrypt"
[metadata.nginx.vhosts.openldap.locations."/"]
target = "http://127.0.0.1:23000"
[metadata.openldap]
my_hostname = "ldap.qzwi.de"
@ -52,6 +55,14 @@ schemas = [
write = [
"uid=nextcloud,ou=Applications,dc=qzwi,dc=de",
]
manage = [
"uid=ldap-frontend,ou=Applications,dc=qzwi,dc=de",
]
[metadata.openldap.access."ou=Groups,dc=qzwi,dc=de"]
manage = [
"uid=ldap-frontend,ou=Applications,dc=qzwi,dc=de",
]
[metadata.vm]
cpu = 4