Skip to content

Commit

Permalink
removing of errors with library.sh and initial setup tier beacon
Browse files Browse the repository at this point in the history
  • Loading branch information
skublik committed Sep 20, 2018
1 parent f26713b commit 22a97b1
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 200 deletions.
136 changes: 0 additions & 136 deletions grouper-midpoint/mp-gr/configs-and-secrets/shibboleth/shibboleth2.xml

This file was deleted.

20 changes: 0 additions & 20 deletions grouper-midpoint/mp-gr/configs-and-secrets/shibboleth/sp-cert.pem

This file was deleted.

28 changes: 0 additions & 28 deletions grouper-midpoint/mp-gr/configs-and-secrets/shibboleth/sp-key.pem

This file was deleted.

24 changes: 19 additions & 5 deletions grouper-midpoint/mp-gr/midpoint-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,29 @@ MAINTAINER info@evolveum.com
RUN rpm --import http://repos.azulsystems.com/RPM-GPG-KEY-azulsystems
RUN curl -o /etc/yum.repos.d/zulu.repo http://repos.azulsystems.com/rhel/zulu.repo
RUN yum -y update
RUN yum -y install zulu-8
RUN yum -y install \
zulu-8 \
cronie \
supervisor \
libcurl \
&& yum clean -y all

RUN yum -y install supervisor
COPY container_files/supervisor/supervisord.conf /etc/supervisord.conf

RUN rm /etc/shibboleth/sp-key.pem /etc/shibboleth/sp-cert.pem /etc/httpd/conf.d/ssl.conf
RUN rm /etc/shibboleth/sp-key.pem /etc/shibboleth/sp-cert.pem \
&& cd /etc/httpd/conf.d/ \
&& rm -f autoindex.conf ssl.conf userdir.conf welcome.conf

COPY container_files/supervisor/supervisord.conf /etc/supervisord.conf
COPY container_files/httpd/conf/* /etc/httpd/conf.d/
COPY container_files/httpd/possible-conf/* /etc/httpd/possible-conf/
COPY container_files/shibboleth/* /etc/shibboleth/
COPY container_files/usr-local-bin/ /usr/local/bin/

RUN chmod 755 /usr/local/bin/sendtierbeacon.sh \
&& chmod 755 /usr/local/bin/setupcron.sh \
&& chmod 755 /usr/local/bin/init.sh \
&& chmod 755 /usr/local/bin/library.sh \
&& /usr/local/bin/setupcron.sh

RUN cp /dev/null /etc/httpd/conf.d/ssl.conf \
&& sed -i 's/LogFormat "/LogFormat "httpd;access_log;%{ENV}e;%{USERTOKEN}e;/g' /etc/httpd/conf/httpd.conf \
&& echo -e "\nErrorLogFormat \"httpd;error_log;%{ENV}e;%{USERTOKEN}e;[%{u}t] [%-m:%l] [pid %P:tid %T] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i\"" >> /etc/httpd/conf/httpd.conf \
Expand Down Expand Up @@ -65,4 +76,7 @@ ENV AJP_ENABLED true
ENV AJP_PORT 9090
ENV LOGOUT_URL https://localhost:4438/Shibboleth.sso/Logout

ENV TIER_RELEASE=test-non-release
ENV TIER_MAINTAINER=tier

CMD ["/usr/bin/supervisord"]
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
[supervisord]
nodaemon=true

[program:init]
command=/usr/local/bin/init.sh
autostart=true

[program:httpd-shib]
command=httpd-shib-foreground
[program:init-httpd-shib]
command=/bin/bash -c "/usr/local/bin/init.sh && httpd-shib-foreground"
stdout_logfile=/dev/fd/1
stdout_logfile_maxbytes=0
redirect_stderr=true
autostart=true

[program:midpoint]
command=/bin/bash -c "java -Xmx2048M -Xms2048M -Dfile.encoding=UTF8 \
Expand All @@ -32,4 +27,10 @@ command=/bin/bash -c "java -Xmx2048M -Xms2048M -Dfile.encoding=UTF8 \
stdout_logfile=/dev/fd/2
stdout_logfile_maxbytes=0
redirect_stderr=true
autostart=true

[program:tier-beacon]
command=/usr/sbin/crond -i -m off
stdout_logfile=/dev/fd/10
stdout_logfile_maxbytes=0
redirect_stderr=true
autorestart=false
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ linkSecrets(){
local label_file=`basename $filepath`
local file=$(echo $label_file| cut -d'_' -f 2)

if [ $label_file = shib_* ]; then
if [[ $label_file == shib_* ]]; then
ln -sf /run/secrets/$label_file /etc/shibboleth/$file
elif [ "$label_file" = "host-key.pem" ]; then
elif [ "$label_file" == "host-key.pem" ]; then
ln -sf /run/secrets/host-key.pem /etc/pki/tls/private/host-key.pem
fi
done
}


checkMidpointSecurityProfile(){
if [ $ACTIVE_PROFILE = *'sso'* ]; then
if [[ $ACTIVE_PROFILE = *'sso'* ]]; then
cp /etc/httpd/possible-conf/midpoint-www-with-shibboleth-sso.conf /etc/httpd/conf.d/midpoint-www.conf
else
cp /etc/httpd/possible-conf/midpoint-www-without-shibboleth-sso.conf /etc/httpd/conf.d/midpoint-www.conf
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

LOGHOST="localhost"
LOGPORT="80"

messagefile="/tmp/beaconmsg"

if [ -z "$TIER_BEACON_OPT_OUT" ]; then
cat > $messagefile <<EOF
{
"msgType" : "TIERBEACON",
"msgName" : "TIER",
"msgVersion" : "1.0",
"tbProduct" : "MIDPOINT",
"tbProductVersion" : "$MP_VERSION",
"tbTIERRelease" : "$TIER_RELEASE",
"tbMaintainer" : "$TIER_MAINTAINER"
}
EOF

curl -s -XPOST "${LOGHOST}:${LOGPORT}/" -H 'Content-Type: application/json' -T $messagefile 1>/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "tier_beacon;none;$ENV;$USERTOKEN;"`date`"; TIER beacon sent"
else
echo "tier_beacon;none;$ENV;$USERTOKEN;"`date`"; Failed to send TIER beacon"
fi

rm -f $messagefile 1>/dev/null 2>&1

fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

CRONTMPFILE=/tmp/cronfile

echo "#send daily \"beacon\" to central" > ${CRONTMPFILE}
#echo $(expr $RANDOM % 59) $(expr $RANDOM % 3) "* * * /usr/local/bin/sendtierbeacon.sh >> /tmp/logcrond 2>&1" >> ${CRONTMPFILE}
echo 47 "* * * * /usr/local/bin/sendtierbeacon.sh >> /dev/fd/8 2>&1" >> ${CRONTMPFILE}
chmod 644 ${CRONTMPFILE}
crontab ${CRONTMPFILE}

0 comments on commit 22a97b1

Please sign in to comment.