File tree Expand file tree Collapse file tree 7 files changed +150
-0
lines changed
Expand file tree Collapse file tree 7 files changed +150
-0
lines changed Original file line number Diff line number Diff line change 1+ FROM python:3.11-slim
2+ LABEL maintainer="github/alfonsrv <alfonsrv@protonmail.com>"
3+
4+ ENV APACHE_CONFDIR=/etc/apache2
5+
6+ RUN apt-get update \
7+ && apt-get install -y --no-install-recommends git \
8+ apache2 libapache2-mod-wsgi-py3 \
9+ krb5-k5tls \
10+ && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
11+
12+ RUN a2enmod wsgi \
13+ && a2enmod ssl \
14+ && a2enmod headers \
15+ && a2enmod setenvif
16+
17+ RUN ln -sf /proc/self/fd/1 /var/log/apache2/access.log && \
18+ ln -sf /proc/self/fd/1 /var/log/apache2/error.log
19+
20+ COPY config/kdc-wsgi.conf ${APACHE_CONFDIR}/sites-available/
21+
22+ # Download + install kdcproxy and get install path to replace in apache config
23+ RUN git clone https://github.com/latchset/kdcproxy.git /tmp/kdcproxy \
24+ && pip install /tmp/kdcproxy \
25+ && KDC_PROXY_PATH=$(python -c "import site; print(site.getsitepackages()[0])" )/kdcproxy \
26+ && sed -ri -e "s!KDC_PROXY_PATH!${KDC_PROXY_PATH}!g" /etc/apache2/sites-available/*.conf \
27+ && sed -ri -e "s!SERVER_NAME!${SERVER_NAME}!g" /etc/apache2/sites-available/*.conf
28+
29+ RUN a2dissite 000-default.conf \
30+ && a2ensite kdc-wsgi.conf
31+
32+ CMD ["apachectl" , "-D" , "FOREGROUND" ]
Original file line number Diff line number Diff line change 1+ # KDC Proxy Docker Container 🐋
2+
3+ * Rename ` config/sample-kdcproxy.conf ` to ` config/kdcproxy.conf `
4+ * Configure Domain Controller IP addresses via ` extra_hosts ` in ` docker-compose.yml `
5+ * Configure Realm and Domain Controller DNS Names in ` config/kdcproxy.conf `
6+ * Run ` docker-compose up ` and configure to run as service
7+ * Run either behind reverse proxy or as a directly exposed server (bring your own certificates)
Original file line number Diff line number Diff line change 1+ <VirtualHost *:443>
2+ ServerName SERVER_NAME
3+ ErrorLog ${APACHE_LOG_DIR}/error.log
4+ CustomLog ${APACHE_LOG_DIR}/access.log combined
5+
6+ SSLEngine on
7+ SSLCertificateFile /certs/cert.crt
8+ SSLCertificateKeyFile /certs/cert.key
9+
10+ # Prevent showing the default Apache2 website
11+ RedirectMatch ^/(?!(?i:KdcProxy))(.*)$ https://opensource.org/
12+
13+ # Python WSGI KDC Proxy setup
14+ WSGIDaemonProcess kdcproxy \
15+ processes=2 \
16+ threads=15 \
17+ maximum-requests=1000 \
18+ display-name=%{GROUP}
19+ WSGIImportScript KDC_PROXY_PATH/__init__.py \
20+ process-group=kdcproxy \
21+ application-group=kdcproxy
22+ WSGIScriptAliasMatch "(?i)^/KdcProxy" \
23+ KDC_PROXY_PATH/__init__.py
24+ WSGIScriptReloading Off
25+
26+ # Set headers if available
27+ <IfModule mod_setenvif.c>
28+ SetEnvIf X-Forwarded-Host (.*) REAL_HOST_HEADER=$1
29+ <IfModule mod_headers.c>
30+ RequestHeader set Host "%{REAL_HOST_HEADER}e"
31+ </IfModule>
32+ </IfModule>
33+
34+ <LocationMatch "(?i)^/KdcProxy">
35+ Satisfy Any
36+ Order Deny,Allow
37+ Allow from all
38+ WSGIProcessGroup kdcproxy
39+ WSGIApplicationGroup kdcproxy
40+ </LocationMatch>
41+ </VirtualHost>
Original file line number Diff line number Diff line change 1+ [global]
2+ # Use default libkrb5 configuration; if you load the mit config module in the master configuration file,
3+ # kdcproxy will also read the config using libkrb5 (usually /etc/krb5.conf). If this module is used, kdcproxy
4+ # will respect the DNS settings from the [libdefaults] section and the realm configuration from the [realms] section.
5+ # For more information, see the documentation for MIT's krb5.conf.
6+ configs = mit
7+
8+ # Use DNS SRV lookup to automatically resolve domain
9+ use_dns = False
10+
11+ [CONTOSO.LOC]
12+ # The realm configuration parameters may list multiple servers separated by a space.
13+ # The order the realms are specified in will be respected by kdcproxy when forwarding requests. The port number is optional.
14+ #
15+ # Possible schemes are:
16+ # * kerberos://
17+ # * kerberos+tcp://
18+ # * kerberos+udp://
19+ # * kpasswd://
20+ # * kpasswd+tcp://
21+ # * kpasswd+udp://
22+
23+ kerberos = kerberos+tcp://test-dc1.contoso.loc:88
24+ kpasswd = kpasswd+tcp://test-dc1.contoso.loc:464
Original file line number Diff line number Diff line change 1+ ---
2+ version : ' 3'
3+ services :
4+ kdcproxy :
5+ build :
6+ context : .
7+ dockerfile : ./Dockerfile
8+ container_name : kdcproxy-apache
9+ restart : unless-stopped
10+ ports :
11+ - " 443:443"
12+ environment :
13+ - KDCPROXY_CONFIG=/config/kdcproxy.conf
14+ - SERVER_NAME=${SERVER_NAME:-selfsign.rausys.de}
15+ volumes :
16+ - config:/config:ro
17+ - certs:/certs:ro
18+ extra_hosts :
19+ - " test-dc1.contoso.loc:10.10.10.10"
20+
21+ omgwtfssl :
22+ image : paulczar/omgwtfssl
23+ container_name : kdcproxy-ssl
24+ restart : " no"
25+ volumes :
26+ - certs:/certs
27+ environment :
28+ - SSL_SUBJECT=${SERVER_NAME:-selfsign.rausys.de}
29+ - SSL_KEY=/certs/cert.key
30+ - SSL_CSR=/certs/cert.csr
31+ - SSL_CERT=/certs/cert.crt
32+
33+ volumes :
34+ config :
35+ driver : local
36+ driver_opts :
37+ type : none
38+ o : bind
39+ device : ./config
40+ certs :
41+ driver : local
42+ driver_opts :
43+ type : none
44+ o : bind
45+ device : ./certs
Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ def decode_proxymessage(data):
100100 realm = str (realm , "utf-8" )
101101 except TypeError : # Python 2.x
102102 realm = str (realm )
103+ realm = realm .upper ()
103104 else :
104105 realm = None
105106 flags = req .getComponentByName ('flags' )
You can’t perform that action at this time.
0 commit comments