blob: 2bae6ae4c2b4b67ca1f002a2d4ca11d6c75751e6 [file] [log] [blame]
local mirko = import "../../kube/mirko.libsonnet";
local kube = import "../../kube/kube.libsonnet";
{
cfg:: {
# Manually built from code.hackerspace.pl/q3k/ldap-web-public.
image: "registry.k0.hswaw.net/q3k/ldap-web:1597515993",
webFQDN: error "webFQDN must be set!",
},
component(cfg, env): mirko.Component(env, "ldapweb") {
local ldapweb = self,
cfg+: {
image: cfg.image,
volumes+: {
config: kube.ConfigMapVolume(ldapweb.configmap),
},
container: ldapweb.Container("main") {
# Starts by default on port 8000.
volumeMounts_+: {
config: { mountPath: "/app/webapp/config.py", subPath: "config.py", },
},
},
ports+: {
publicHTTP: {
web: {
port: 8000,
dns: cfg.webFQDN,
},
},
},
},
configmap: kube.ConfigMap(ldapweb.makeName("config")) {
metadata+: ldapweb.metadata,
data: {
"config.py": |||
# -*- coding: utf-8 -*-
import flask_wtf
import wtforms
ldap_url = 'ldap://ldap.hackerspace.pl'
dn_format = "uid=%s,ou=people,dc=hackerspace,dc=pl"
admin_dn = 'cn=ldapweb,ou=Services,dc=hackerspace,dc=pl'
admin_pw = 'unused'
hackerspace_name = 'Warsaw Hackerspace'
readable_names = {
'commonname': u'Common Name',
'givenname': u'Given Name',
'gecos': u'GECOS (public name)',
'surname': u'Surname',
'loginshell': u'Shell',
'telephonenumber': 'Phone Number',
'mobiletelephonenumber': 'Mobile Number',
'sshpublickey': 'SSH Public Key',
}
full_name = {
'cn': 'commonname',
'gecos': 'gecos',
'sn': 'surname',
'mobile': 'mobiletelephonenumber',
'l': 'locality',
}
can_add = set([
'telephonenumber',
'mobiletelephonenumber',
'sshpublickey',
])
can_delete = can_add
can_modify = can_add | set([
'givenname', 'surname', 'commonname', 'gecos',
])
can = { 'add':can_add, 'mod':can_modify, 'del':can_delete }
admin_required = set()
perm_errors = {
'add': 'You cannot add this attribute!',
'mod': 'You cannot change this attribute!',
'del': 'You cannot delete this attribute!',
}
std_templates = {
'add': 'ops/add.html',
'mod': 'ops/mod.html',
'del': 'ops/del.html',
}
default_field = (wtforms.fields.StringField, {})
fields = { 'telephonenumber': (wtforms.fields.StringField, {'validators': [wtforms.validators.Regexp(r'[+0-9 ]+')]})}
kadmin_passwd = True
kadmin_principal_map = "{}@HACKERSPACE.PL"
TOKEN_LENGTH = 32
|||,
},
},
},
}