diff --git a/Workbench/docker-compose.yml b/Workbench/docker-compose.yml index 2be4fb8..fadd384 100644 --- a/Workbench/docker-compose.yml +++ b/Workbench/docker-compose.yml @@ -275,6 +275,32 @@ services: ports: - 443:443 + wordpress_server: + build: ./wordpress_server/ + container_name: wordpress_server + networks: + - net + depends_on: + - wordpress_data + command: bash -c 'if [ ! -s /var/www/html/wp-config.php ]; then while ! nc -z wordpress_data 3306 ; do echo waiting for mysql on wordpress_data to start; sleep 3; done; /root/wp core download --allow-root && sleep 10 && /root/wp config create --dbname=wordpress --dbuser=wordpress --dbpass=54y6RxN7GfC7aes3 --dbhost=wordpress_data --allow-root; sleep 3 && /root/wp core install --url="http://localhost/" --title="wordpress" --admin_user="admin" --admin_password="54y6RxN7GfC7aes3" --admin_email="sentrifugo.container@gmail.com" --allow-root && /root/wp --allow-root rewrite structure "/%postname%" --hard --debug; /root/wp rewrite flush --hard --debug --allow-root && sed -i "s/<\/IfModule>/RewriteCond \%{HTTP:Authorization} \^\(\.\*\)\nRewriteRule \^\(\.\*\) - [E=HTTP_AUTHORIZATION:\%1]\n<\/IfModule>\nSetEnvIf Authorization "\(\.\*\)" HTTP_AUTHORIZATION=\$$1/" /var/www/html/.htaccess && /root/sed.sh && /root/wp plugin install jwt-authentication-for-wp-rest-api --activate --allow-root && /root/wp plugin install wp-rest-api-log --activate --allow-root && /root/wp plugin install shibboleth --activate --allow-root; fi; /usr/local/bin/startup.sh;' + ports: + - "80:80" + devices: + - "/dev/tty:/dev/tty" + volumes: + - wordpress_server:/var/www/html + + wordpress_data: + build: ./wordpress_data/ + container_name: wordpress_data + networks: + - net + volumes: + - wordpress_data:/var/lib/mysql + ports: + - 3306 + + networks: net: driver: bridge @@ -315,4 +341,7 @@ volumes: midpoint_mysql: midpoint_home: mq: + wordpress_data: + wordpress_server: + diff --git a/Workbench/midpoint_server/container_files/mp-home/icf-connectors/connector-rest-wordpress-.23-SNAPSHOT.jar b/Workbench/midpoint_server/container_files/mp-home/icf-connectors/connector-rest-wordpress-.23-SNAPSHOT.jar new file mode 100644 index 0000000..28901a7 Binary files /dev/null and b/Workbench/midpoint_server/container_files/mp-home/icf-connectors/connector-rest-wordpress-.23-SNAPSHOT.jar differ diff --git a/Workbench/midpoint_server/container_files/mp-home/post-initial-objects/resources/connector-rest-wordpress.xml b/Workbench/midpoint_server/container_files/mp-home/post-initial-objects/resources/connector-rest-wordpress.xml new file mode 100644 index 0000000..d692fbc --- /dev/null +++ b/Workbench/midpoint_server/container_files/mp-home/post-initial-objects/resources/connector-rest-wordpress.xml @@ -0,0 +1,421 @@ + + wordpress + + 2019-03-29T16:22:22.388Z + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + 2019-03-19T13:02:41.338Z + + + modify + c:ResourceType + + + com.evolveum.midpoint.model.impl.lens.ChangeExecutor.executeDelta + success + 1000000000000000273 + + wordpress + + success + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + 2019-03-19T13:02:44.233Z + + + modify + c:ResourceType + + + com.evolveum.midpoint.model.impl.lens.ChangeExecutor.executeDelta + success + 1000000000000000314 + + wordpress + + success + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + 2019-03-28T13:53:37.825Z + + + modify + c:ResourceType + + + com.evolveum.midpoint.model.impl.lens.ChangeExecutor.executeDelta + success + 1000000000000002054 + + wordpress + + success + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + 2019-03-29T14:12:12.351Z + + + modify + c:ResourceType + + + com.evolveum.midpoint.model.impl.lens.ChangeExecutor.executeDelta + success + 1000000000000002055 + + wordpress + + success + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + 2019-03-29T16:22:22.515Z + + + modify + c:ResourceType + + + com.evolveum.midpoint.model.impl.lens.ChangeExecutor.executeDelta + success + 1000000000000002018 + + wordpress + + success + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + up + + + + + c:connectorType + edu.unc.polygon.connector.wordpress.WordpressRestConnector + + + + + + 54y6RxN7GfC7aes3 + true + id + http://wordpress_server/wp-json + password + username + admin + 1 + true + + + + + 2019-03-29T16:22:22.861Z + 318be2268b91039f-c8d8c12096d6f0bf + + + + + + + + + + + icfs:uid + icfs:name + icfs:name + icfs:name + MESSAGE_OBJECT_CLASS___ACCOUNT__ + + + + + + + 120 + password + + + + + + + 130 + roles + + + + + + + 140 + username + + + + + + + ConnId Name + 110 + __NAME__ + + + + + + + 150 + id + + + + + + + 160 + last_name + + + + + + + 170 + email + + + + + + + 180 + first_name + + + + + + + 190 + name + + + + + + + ConnId UID + 100 + read + + + + + + + + + + + account + default + true + MESSAGE_OBJECT_CLASS___ACCOUNT__ + + ri:username + + 0 + + mr:stringIgnoreCase + + strong + + $user/name + + + + + $user/name + + + + + ri:email + + strong + + $user/emailAddress + + + + + ri:name + + + $user/fullName + + + + + $user/fullName + + + + + ri:first_name + + + $user/givenName + + + + + ri:last_name + + + $user/familyName + + + + + icfs:name + + 0 + + mr:stringIgnoreCase + + strong + + $user/name + + + + + $user/name + + + + + + + + + + + + + + + + + + 2019-03-29T16:22:22.854Z + 5b1c4a484a81371-d0dffd979b34680e + + + + + + + + + + connector + + + + + false + + + + + true + + + true + + + true + + + true + + + true + + connector + + + + true + + + true + false + + + + + + + + + Account sync policy + MESSAGE_OBJECT_CLASS___ACCOUNT__ + account + default + c:UserType + true + + + polyStringNorm + c:name + + Matches using Name + declare namespace ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"; $account/attributes/icfs:name + + + + + linked + true + + + deleted + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#deleteFocus + + + + unlinked + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#link + + + + unmatched + true + + http://midpoint.evolveum.com/xml/ns/public/model/action-3#addFocus + + + + + + diff --git a/Workbench/midpoint_server/container_files/mp-home/post-initial-objects/roles/200-role-editor.xml b/Workbench/midpoint_server/container_files/mp-home/post-initial-objects/roles/200-role-editor.xml new file mode 100644 index 0000000..7d6a18c --- /dev/null +++ b/Workbench/midpoint_server/container_files/mp-home/post-initial-objects/roles/200-role-editor.xml @@ -0,0 +1,67 @@ + + + + Editor + + 2020-07-20T14:36:12.953Z + 2020-07-20T14:36:12.972Z + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#init + 2020-07-20T15:14:49.494Z + + + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + 2019-03-29T17:20:56.764Z + + + add + c:RoleType + + + com.evolveum.midpoint.model.impl.lens.ChangeExecutor.executeDelta + success + 1000000000000003970 + + Editor + + success + + + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + 0 + + + enabled + enabled + 2020-07-20T14:36:12.967Z + + Wordpress Editor + + + + + + + ri:roles + + strong + + $containingObject/name + + + editor + + + + + 2 + + + + \ No newline at end of file diff --git a/Workbench/midpoint_server/container_files/mp-home/post-initial-objects/roles/300-direct-wordpress-role-editor.xml b/Workbench/midpoint_server/container_files/mp-home/post-initial-objects/roles/300-direct-wordpress-role-editor.xml new file mode 100644 index 0000000..63a16e8 --- /dev/null +++ b/Workbench/midpoint_server/container_files/mp-home/post-initial-objects/roles/300-direct-wordpress-role-editor.xml @@ -0,0 +1,62 @@ + + Direct Wordpress Editor Role + + 2019-03-29T17:20:56.643Z + + + + 2019-03-29T17:20:56.702Z + + + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + 2019-03-29T17:20:56.764Z + + + add + c:RoleType + + + com.evolveum.midpoint.model.impl.lens.ChangeExecutor.executeDelta + success + 1000000000000003970 + + Editor + + success + + + + http://midpoint.evolveum.com/xml/ns/public/gui/channels-3#user + + + enabled + enabled + 2019-03-29T17:20:56.652Z + + 0 + + Direct Wordpress Editor + + + + + + + ri:roles + + strong + + $containingObject/name + + + editor + + + + + + + diff --git a/Workbench/wordpress_data/Dockerfile b/Workbench/wordpress_data/Dockerfile new file mode 100644 index 0000000..d8bc288 --- /dev/null +++ b/Workbench/wordpress_data/Dockerfile @@ -0,0 +1,15 @@ +from mariadb:latest +RUN apt-get update +#RUN apt-get install wget gcc libmysql++-dev librabbitmq-dev pkg-config libbsd-dev -y +#ENV MYSQL_RANDOM_ROOT_PASSWORD=true +ENV MYSQL_ROOT_PASSWORD=54y6RxN7GfC7aes3 +ENV MYSQL_DATABASE=wordpress +ENV MYSQL_USER=wordpress +ENV MYSQL_PASSWORD=54y6RxN7GfC7aes3 +#WORKDIR /tmp +#RUN wget https://github.com/ssimicro/lib_mysqludf_amqp/releases/download/v2.0.0/lib_mysqludf_amqp-2.0.0.tar.gz +#RUN tar zxf lib_mysqludf_amqp-2.0.0.tar.gz +#WORKDIR /tmp/lib_mysqludf_amqp-2.0.0 +#RUN ./configure && make && make install #mysql -u root --password=54y6RxN7GfC7aes3 < installdb.sql +RUN cat /etc/resolv.conf +EXPOSE 3306 diff --git a/Workbench/wordpress_server/Dockerfile b/Workbench/wordpress_server/Dockerfile new file mode 100644 index 0000000..87ec5c3 --- /dev/null +++ b/Workbench/wordpress_server/Dockerfile @@ -0,0 +1,45 @@ +FROM tier/shibboleth_sp:3.0.4_03122019 + +VOLUME /var/www/html + +RUN mkdir /opt/tier/.wp-cli +#COPY container_files/wordpress/000-default.conf /etc/apache2/sites-available/ +COPY container_files/wordpress/sed.sh /root +COPY container_files/wordpress/wp /root +COPY container_files/wordpress/config.yml /root/.wp-cli +COPY container_files/wordpress/wp-cli.yml /var/www/html + +RUN chmod +x /root/wp +RUN yum update -y +RUN yum install -y http://rpms.remirepo.net/enterprise/remi-release-7.rpm \ + && yum install yum-utils \ + && yum-config-manager --enable remi-php72 \ + && yum install -y php php-gd mariadb wget php-mysql postfix nc +RUN echo 'date.timezone="UTC"' >> /etc/php.ini +#RUN echo 'nameserver 127.0.0.11' > /etc/resolv.conf +RUN /etc/shibboleth/keygen.sh -o /etc/shibboleth/ -y 10 -n sp-encrypt -f \ + && /etc/shibboleth/keygen.sh -o /etc/shibboleth/ -y 10 -n sp-signing -f + +#RUN cd /root \ +# && wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar \ +# && chmod +x wp-cli.phar + +RUN cat /etc/resolv.conf +WORKDIR /var/www/html +#RUN /root/wp-cli.phar core download +# && sleep 3 \ +# && cat /etc/resolv.conf \ +# && cat /etc/hosts \ +# && /root/wp-cli.phar config create --dbname=wordpress --dbuser=wordpress --dbpass=54y6RxN7GfC7aes3 --dbhost=wordpress_data2 \ +# && sleep 15 \ +# && /root/wp-cli.phar core install --url="http://localhost/" --title="wordpress" --admin_user="admin" --admin_password="54y6RxN7GfC7aes3" --admin_email="sentrifugo.container@gmail.com" --allow-root \ +# && /root/wp-cli.phar plugin install jwt-authentication-for-wp-rest-api --activate --allow-root \ +# && /root/wp-cli.phar plugin install shibboleth --activate --allow-root \ +# && /root/wp-cli.phar plugin install wp-rest-api-log --activate --allow-root + +#RUN sed -i "s/<\/IfModule>/RewriteCond \%{HTTP:Authorization} \^\(\.\*\)\nRewriteRule \^\(\.\*\) - [E=HTTP_AUTHORIZATION:\%1]\n<\/IfModule>\nSetEnvIf Authorization "\(\.\*\)" HTTP_AUTHORIZATION=\$$1/" /var/www/html/.htaccess \ +# && sed -i "s/define( 'DB_COLLATE', '' );/define( 'DB_COLLATE', '' );\ndefine('JWT_AUTH_SECRET_KEY', 'your-top-secret-key');\ndefine('JWT_AUTH_CORS_ENABLE', true);\n/" /var/www/html/wp-config.php \ +# && sed -i "s/RewriteBase \//RewriteBase \/\nRewriteRule \^wp-json\/\(\.\*\) \/?rest_route=\/\$1 \[L\]\n/" /var/www/html/.htaccess + + +RUN chown -R apache:apache /var/www/html diff --git a/Workbench/wordpress_server/container_files/wordpress/000-default.conf b/Workbench/wordpress_server/container_files/wordpress/000-default.conf new file mode 100644 index 0000000..6d110b9 --- /dev/null +++ b/Workbench/wordpress_server/container_files/wordpress/000-default.conf @@ -0,0 +1,32 @@ + + # The ServerName directive sets the request scheme, hostname and port that + # the server uses to identify itself. This is used when creating + # redirection URLs. In the context of virtual hosts, the ServerName + # specifies what hostname must appear in the request's Host: header to + # match this virtual host. For the default virtual host (this file) this + # value is not decisive as it is used as a last resort host regardless. + # However, you must set it for any further virtual host explicitly. + #ServerName www.example.com + + ServerAdmin webmaster@localhost + DocumentRoot /var/www/html + + # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, + # error, crit, alert, emerg. + # It is also possible to configure the loglevel for particular + # modules, e.g. + #LogLevel info ssl:warn + + ErrorLog ${APACHE_LOG_DIR}/error.log + CustomLog ${APACHE_LOG_DIR}/access.log combined + + # For most configuration files from conf-available/, which are + # enabled or disabled at a global level, it is possible to + # include a line for only one particular virtual host. For example the + # following line enables the CGI configuration for this host only + # after it has been globally disabled with "a2disconf". + #Include conf-available/serve-cgi-bin.conf + HttpProtocolOptions Unsafe + + +# vim: syntax=apache ts=4 sw=4 sts=4 sr noet diff --git a/Workbench/wordpress_server/container_files/wordpress/config.yml b/Workbench/wordpress_server/container_files/wordpress/config.yml new file mode 100644 index 0000000..0e12e1c --- /dev/null +++ b/Workbench/wordpress_server/container_files/wordpress/config.yml @@ -0,0 +1,3 @@ +apache_modules: + - mod_rewrite + diff --git a/Workbench/wordpress_server/container_files/wordpress/sed.sh b/Workbench/wordpress_server/container_files/wordpress/sed.sh new file mode 100755 index 0000000..6026c17 --- /dev/null +++ b/Workbench/wordpress_server/container_files/wordpress/sed.sh @@ -0,0 +1,9 @@ +#!/bin/bash +#echo "define('JWT_AUTH_SECRET_KEY', 'your-top-secret-key');" >> /var/www/html/wp-config.php; +#echo "define('JWT_AUTH_CORS_ENABLE', true);" >> /var/www/html/wp-config.php +sed -i "s/define( 'DB_COLLATE', '' );/define( 'DB_COLLATE', '' );\ndefine('JWT_AUTH_SECRET_KEY', 'your-top-secret-key');\ndefine('JWT_AUTH_CORS_ENABLE', true);\n/" /var/www/html/wp-config.php +sed -i "s/RewriteBase \//RewriteBase \/\nRewriteRule \^wp-json\/\(\.\*\) \/?rest_route=\/\$1 \[L\]\n/" /var/www/html/.htaccess +sed -i 's/RewriteRule \. \/index\.php \[L\]/RewriteCond %{REQUEST_URI} !\\\.sso\/\nRewriteRule \. \/index\.php \[L\]/' /var/www/html/.htaccess +sed -i 's/AllowOverride None/AllowOverride All/' /etc/httpd/conf/httpd.conf +sed -i 's/IncludeOptional conf.d\/\*.conf/IncludeOptional conf.d\/\*.conf\nHttpProtocolOptions Unsafe/' /etc/httpd/conf/httpd.conf + diff --git a/Workbench/wordpress_server/container_files/wordpress/wp b/Workbench/wordpress_server/container_files/wordpress/wp new file mode 100755 index 0000000..2884cb6 Binary files /dev/null and b/Workbench/wordpress_server/container_files/wordpress/wp differ diff --git a/Workbench/wordpress_server/container_files/wordpress/wp-cli.yml b/Workbench/wordpress_server/container_files/wordpress/wp-cli.yml new file mode 100644 index 0000000..0e12e1c --- /dev/null +++ b/Workbench/wordpress_server/container_files/wordpress/wp-cli.yml @@ -0,0 +1,3 @@ +apache_modules: + - mod_rewrite + diff --git a/Workbench/wordpress_server/wordpress_data/Dockerfile b/Workbench/wordpress_server/wordpress_data/Dockerfile new file mode 100644 index 0000000..d8bc288 --- /dev/null +++ b/Workbench/wordpress_server/wordpress_data/Dockerfile @@ -0,0 +1,15 @@ +from mariadb:latest +RUN apt-get update +#RUN apt-get install wget gcc libmysql++-dev librabbitmq-dev pkg-config libbsd-dev -y +#ENV MYSQL_RANDOM_ROOT_PASSWORD=true +ENV MYSQL_ROOT_PASSWORD=54y6RxN7GfC7aes3 +ENV MYSQL_DATABASE=wordpress +ENV MYSQL_USER=wordpress +ENV MYSQL_PASSWORD=54y6RxN7GfC7aes3 +#WORKDIR /tmp +#RUN wget https://github.com/ssimicro/lib_mysqludf_amqp/releases/download/v2.0.0/lib_mysqludf_amqp-2.0.0.tar.gz +#RUN tar zxf lib_mysqludf_amqp-2.0.0.tar.gz +#WORKDIR /tmp/lib_mysqludf_amqp-2.0.0 +#RUN ./configure && make && make install #mysql -u root --password=54y6RxN7GfC7aes3 < installdb.sql +RUN cat /etc/resolv.conf +EXPOSE 3306