From d3988c3c9595e363d394e6800c1240af230c8847 Mon Sep 17 00:00:00 2001 From: Chad Redman Date: Fri, 20 Jan 2023 01:28:06 -0500 Subject: [PATCH] Add MailHog for capturing outgoing emails --- base/Dockerfile | 8 +- base/container_files/httpd/mailHog.conf | 6 + .../tier-support/supervisord-training.conf | 7 + base/container_files/var-www-html/index.html | 203 ++++++++++-------- .../container_files/seed-data/bootstrap.gsh | 15 +- 5 files changed, 144 insertions(+), 95 deletions(-) create mode 100644 base/container_files/httpd/mailHog.conf diff --git a/base/Dockerfile b/base/Dockerfile index 93410db..54fa6c8 100644 --- a/base/Dockerfile +++ b/base/Dockerfile @@ -18,7 +18,7 @@ ENV ENV=training \ # 2021-01-13 the phpldapadmin in epel is 1.2.5 which is incompatible with php 5.4.x RUN yum install -y epel-release \ - && yum install -y mariadb mariadb-server nano openldap openldap-clients openldap-servers phpMyAdmin \ + && yum install -y mariadb mariadb-server nano openldap openldap-clients openldap-servers phpMyAdmin golang \ https://archive.fedoraproject.org/pub/archive/epel/7.2020-10-05/x86_64/Packages/p/phpldapadmin-1.2.3-10.el7.noarch.rpm \ && yum clean all @@ -54,6 +54,8 @@ RUN cp /usr/share/openldap-servers/DB_CONFIG.example /var/lib/ldap/DB_CONFIG \ && pkill -HUP slapd \ && while curl -s ldap://localhost:389 > /dev/null; do echo waiting for ldap to stop; sleep 1; done +RUN go install github.com/mailhog/MailHog@v1.0.1 + COPY container_files/conf/* /opt/grouper/grouperWebapp/WEB-INF/classes/ COPY container_files/conf/grouperText/* /opt/grouper/grouperWebapp/WEB-INF/classes/grouperText/ @@ -97,6 +99,8 @@ ENV GROUPER_START_DELAY_SECONDS=10 \ GROUPER_WS_GROUPER_AUTH=true # note 5005 is for remote Java debugging -EXPOSE 389 3306 8080 5005 +# 1025 is MailHog SMTP server +# 8025 is MailHog HTTP server +EXPOSE 389 3306 8080 5005 1025 8025 CMD ["grouper"] diff --git a/base/container_files/httpd/mailHog.conf b/base/container_files/httpd/mailHog.conf new file mode 100644 index 0000000..7207cd6 --- /dev/null +++ b/base/container_files/httpd/mailHog.conf @@ -0,0 +1,6 @@ +# MailHog +# +# Application UI runs on port 8025. Reverse proxy so it can be accessed on the normal web ports + +ProxyPass /mail http://localhost:8025/mail +ProxyPassReverse /mail http://localhost:8025/mail diff --git a/base/container_files/tier-support/supervisord-training.conf b/base/container_files/tier-support/supervisord-training.conf index 3dcc162..c5c10b2 100644 --- a/base/container_files/tier-support/supervisord-training.conf +++ b/base/container_files/tier-support/supervisord-training.conf @@ -58,3 +58,10 @@ stdout_logfile = /tmp/logpipe stdout_logfile_maxbytes=0 priority=10 +[program:mailhog] +command=/root/go/bin/MailHog -ui-web-path mail +stderr_logfile = /tmp/logpipe +stderr_logfile_maxbytes=0 +stdout_logfile = /tmp/logpipe +stdout_logfile_maxbytes=0 +priority=400 diff --git a/base/container_files/var-www-html/index.html b/base/container_files/var-www-html/index.html index 9648eb0..f430eea 100644 --- a/base/container_files/var-www-html/index.html +++ b/base/container_files/var-www-html/index.html @@ -1,103 +1,122 @@ + -GTE jump page - + #myTable th { + padding-top: 12px; + padding-bottom: 12px; + text-align: left; + background-color: #4CAF50; + color: white; + } + + -

GTE jump page

-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameLinkDescriptionCredentials
Grouperhttps://localhost:8443/grouper/Grouper UI applicationAdmin: banderson / password
- Civilian: jsmith / password
Database managerhttps://localhost:8443/phpmyadmin/Phpmyadmin Mysql database managerroot / <no password>
LDAP managerhttps://localhost:8443/phpldapadmin/Phpldapadmin LDAP administrationusername: cn=root,dc=internet2,dc=edu
password: password
Shibboleth attributes apphttps://localhost:8443/appSimple Shibboleth-protected application to show login state
Grouper training wikiLinks to everything you need for the training. Check Slack "pins" also.
GTE commandsCommands that will start courses, shell into containers, etc
Text to copy/pasteCommands and configuration to copy and paste from slides for exercises
Grouper Deployment GuideGrouper concepts, standards, and best practices
KahootOnline quiz site
Org chart brief | Org chart fullDepartmental org charts used in the example database
+

GTE jump page

+

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameLinkDescriptionCredentials
Grouperhttps://localhost:8443/grouper/Grouper UI applicationAdmin: banderson / password
+ Civilian: jsmith / password
Database managerhttps://localhost:8443/phpmyadmin/Phpmyadmin Mysql database managerroot / <no password>
LDAP managerhttps://localhost:8443/phpldapadmin/Phpldapadmin LDAP administrationusername: cn=root,dc=internet2,dc=edu
password: password
Mail serverhttps://localhost:8443/mail/MailHog email testing tool
Shibboleth attributes apphttps://localhost:8443/appSimple Shibboleth-protected application to show login state
Grouper training + wikiLinks to everything you need for the training. Check Slack "pins" also.
GTE commandsCommands that will start courses, shell into containers, etc
Text + to copy/pasteCommands and configuration to copy and paste from slides for exercises
Grouper Deployment + GuideGrouper concepts, standards, and best practices
KahootOnline quiz site
Org chart brief | Org chart + fullDepartmental org charts used in the example database
+ \ No newline at end of file diff --git a/ex101/ex101.1.1/container_files/seed-data/bootstrap.gsh b/ex101/ex101.1.1/container_files/seed-data/bootstrap.gsh index 04d77e9..88cbf15 100644 --- a/ex101/ex101.1.1/container_files/seed-data/bootstrap.gsh +++ b/ex101/ex101.1.1/container_files/seed-data/bootstrap.gsh @@ -64,12 +64,25 @@ Group globalDeny = new GroupSave(gs).assignName("ref:iam:global_deny").assignCre assignObjectTypeForGroup(globalDeny, "ref", "Identity and Access Management", "Global deny group") -// Set include/exclude properties +// Set grouper.properties GrouperDbConfig config = new GrouperDbConfig().configFileName("grouper.properties") config.propertyName("provisioner.eduPersonAffiliation.canFullSync").value('''true''').store() +// email settings +config.propertyName("grouper.ui.url").value('''https://localhost:8443/grouper/''').store() +config.propertyName("mail.smtp.server").value('''localhost''').store() +config.propertyName("mail.smtp.port").value('''1025''').store() +config.propertyName("mail.smtp.ssl").value('''false''').store() +config.propertyName("mail.smtp.starttls.enable").value('''false''').store() +config.propertyName("mail.smtp.from.address").value('''grouper@internet2.edu.invalid''').store() +config.propertyName("mail.smtp.externalSystemTestToType").value('''emailAddress''').store() +config.propertyName("mail.smtp.externalSystemTestToAddress").value('''grouper@internet2.edu.invalid''').store() +config.propertyName("mail.smtp.externalSystemTestSubject").value('''Test of Grouper mail''').store() +config.propertyName("mail.smtp.externalSystemTestBody").value('''This is a test of grouper mail''').store() + + // Autopopulate policy deny group config.propertyName("grouper.lockoutGroup.name.0").value('''ref:iam:global_deny''').store()