Skip to content

Commit

Permalink
made shibboleth file also work off domain envvar
Browse files Browse the repository at this point in the history
  • Loading branch information
dlareau committed Feb 29, 2020
1 parent 9c5036c commit b5ae14a
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 38 deletions.
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ services:
- static:/static
- media:/media
environment:
- DOMAIN
- DJANGO_SECRET_KEY
- DJANGO_ENABLE_DEBUG
- DJANGO_EMAIL_USER
Expand Down
1 change: 1 addition & 0 deletions docker/apacheShibDockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ COPY configs/shibboleth2.xml /etc/shibboleth/shibboleth2.xml
COPY configs/puzzlehunt_apache_shib.conf /etc/apache2/sites-available/puzzlehunt.conf
RUN rm /etc/apache2/sites-enabled/* && \
sed -i -e "s/REPLACE_DOMAIN_STR/$DOMAIN/g" /etc/apache2/sites-available/puzzlehunt.conf && \
sed -i -e "s/REPLACE_DOMAIN_STR/$DOMAIN/g" /etc/shibboleth/shibboleth2.xml && \
apt-get install -y libapache2-mod-xsendfile libapache2-mod-shib && \
a2enmod proxy proxy_http proxy_html xsendfile shib && \
a2ensite puzzlehunt && \
Expand Down
6 changes: 3 additions & 3 deletions docker/configs/shibboleth2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
-->

<!-- The ApplicationDefaults element is where most of Shibboleth's SAML bits are defined. -->
<ApplicationDefaults entityID="https://puzzlehunt.club.cc.cmu.edu/shibboleth"
<ApplicationDefaults entityID="https://REPLACE_DOMAIN_STR/shibboleth"
REMOTE_USER="eppn persistent-id targeted-id">

<!--
Expand All @@ -34,8 +34,8 @@
-->
<Sessions lifetime="28800" timeout="3600" relayState="ss:mem"
checkAddress="false" handlerSSL="true"
handlerURL="https://puzzlehunt.club.cc.cmu.edu/Shibboleth.sso"
cookieProps="; domain=puzzlehunt.club.cc.cmu.edu; path=/; secure">
handlerURL="https://REPLACE_DOMAIN_STR/Shibboleth.sso"
cookieProps="; domain=REPLACE_DOMAIN_STR; path=/; secure">

<!--
Configures SSO for a default IdP. To allow for >1 IdP, remove
Expand Down
15 changes: 0 additions & 15 deletions hosts_private.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions hosts_public.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion huntserver/templatetags/hunt_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def shib_login_url(context, entityID, next_path):
protocol = "https://"
else:
protocol = "http://"
shib_str = "https://puzzlehunt.club.cc.cmu.edu/Shibboleth.sso/Login"
shib_str = "https://" + settings.SHIB_DOMAIN + "/Shibboleth.sso/Login"
entity_str = "entityID=" + entityID
target_str = "target=" + protocol + context['request'].get_host() + "/shib/login"
next_str = "next=" + next_path
Expand Down
1 change: 1 addition & 0 deletions puzzlehunt_server/settings/base_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@

# Shibboleth settings
USE_SHIBBOLETH = os.getenv("DJANGO_USE_SHIBBOLETH", default="False").lower() == "true"
SHIB_DOMAIN = os.getenv("DOMAIN", default="")

SHIB_ATTRIBUTE_MAP = {
"Shib-Identity-Provider": (True, "idp"),
Expand Down

0 comments on commit b5ae14a

Please sign in to comment.