Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3769742
D2050.id5212.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D2050.id5212.diff
View Options
diff --git a/_modules/paas_docker.py b/_modules/paas_docker.py
--- a/_modules/paas_docker.py
+++ b/_modules/paas_docker.py
@@ -10,6 +10,9 @@
# -------------------------------------------------------------
+from six import iteritems
+
+
def get_image(default_image, args):
"""
A function to output a pillar key in JSON.
@@ -48,3 +51,18 @@
subnets.append("172.17.0.0/16")
return subnets
+
+
+def _build_container_info_dict(container, key, value):
+ return {'container': container, key: value}
+
+
+def get_containers_info(service, key):
+ containers = __pillar__['docker_containers'][__grains__['id']]
+
+ if service not in containers:
+ return []
+
+ return [{'container': container, key: args[key]}
+ for container, args
+ in iteritems(containers[service])]
diff --git a/roles/paas-docker/wrappers/files/openfire.sh b/roles/paas-docker/wrappers/files/openfire.sh
new file mode 100644
--- /dev/null
+++ b/roles/paas-docker/wrappers/files/openfire.sh
@@ -0,0 +1,87 @@
+#!/bin/sh
+
+# -------------------------------------------------------------
+# PaaS Docker
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+# Project: Nasqueron
+# Created: 2018-03-15
+# License: Trivial work, not eligible to copyright
+# Source file: roles/paas-docker/wrappers/files/openfire.sh
+# -------------------------------------------------------------
+#
+# <auto-generated>
+# This file is managed by our rOPS SaltStack repository.
+#
+# Changes to this file may cause incorrect behavior
+# and will be lost if the state is redeployed.
+# </auto-generated>
+
+# -------------------------------------------------------------
+# Helper methods
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+getcommandname() {
+ basename "$0"
+}
+
+usage() {
+ echo "Usage: $(getcommandname) <command>"
+ exit 1
+}
+
+unknown_command() {
+ echo "$(getcommandname): $COMMAND: unknown command"
+ usage
+}
+
+# -------------------------------------------------------------
+# Commands
+#
+# :: propagate-certificate: copy a certificate into a Java keystore file
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+propagate_certificate() {
+ DOMAIN=$1
+ SOURCE=/srv/letsencrypt/etc/live/$DOMAIN
+ TARGET=/srv/$INSTANCE/conf/security/tmp
+
+ # Per Openfire src/java/org/jivesoftware/multiplexer/net/SSLConfig.java
+ # This is used as a blank password.
+ PASS=changeit
+
+ if [ -z $DOMAIN ]; then
+ echo "Please append the FQDN of the certificate to propagate (CN, not alt name)" >&2
+ exit 2
+ fi
+
+ echo mkdir -p $TARGET
+ echo openssl pkcs12 -export -out $TARGET/cert-to-import.p12 -in $SOURCE/fullchain.pem -inkey $SOURCE/privkey.pem -name $DOMAIN -password pass:$PASS
+ #echo docker exec $INSTANCE keytool -noprompt -import -keystore /var/lib/openfire/conf/security/keystore -alias $DOMAIN -file /var/lib/$INSTANCE/conf/security/tmp/cert-to-import.p12 -storepass $PASS
+ echo docker exec $INSTANCE keytool -importkeystore -deststorepass $PASS -srcstorepass $PASS -destkeystore /var/lib/openfire/conf/security/keystore -srckeystore /var/lib/$INSTANCE/conf/security/tmp/cert-to-import.p12 -srcstoretype PKCS12 -deststoretype pkcs12
+ echo rm -R $TARGET
+}
+
+# -------------------------------------------------------------
+# Check arguments
+#
+# $1: instance name
+# $2: command
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if [ $# -lt 2 ]; then
+ usage
+fi
+
+COMMAND=$1
+INSTANCE=$2
+shift 2
+
+# -------------------------------------------------------------
+# Run command
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+
+if [ "$COMMAND" = "propagate-certificate" ]; then
+ propagate_certificate $1
+else
+ unknown_command
+fi
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 24, 16:45 (21 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2260584
Default Alt Text
D2050.id5212.diff (3 KB)
Attached To
Mode
D2050: WIP: deploy certificate to Openfire
Attached
Detach File
Event Timeline
Log In to Comment