diff docker/base/Dockerfile @ 84:8dc445c967e2

docker (base): create /usr/share/sat/certificates and tls-cert group to handle certificate + moved conf to /home/sat/.config/sat/sat.conf
author Goffi <goffi@goffi.org>
date Thu, 18 Feb 2016 17:23:08 +0100
parents 8dd32aa49614
children eeff161a19e8
line wrap: on
line diff
--- a/docker/base/Dockerfile	Thu Feb 18 17:19:50 2016 +0100
+++ b/docker/base/Dockerfile	Thu Feb 18 17:23:08 2016 +0100
@@ -31,6 +31,9 @@
 
 # will be used to put many SàT specific data
 RUN mkdir -p /usr/share/sat
+RUN mkdir /usr/share/sat/certificates
+RUN addgroup tls-cert --gid 9999 && chown :tls-cert /usr/share/sat/certificates && chmod 2770 /usr/share/sat/certificates
+RUN adduser sat tls-cert
 
 ################
 # URWID SÀTEXT #
@@ -75,17 +78,21 @@
 
 # we auto-create libervia account if it doesn't exists in Libervia container
 # so we remove it from reserved_list in plugin account
-RUN echo '[plugin account]\nreserved_list=' >> /etc/sat.conf
+RUN echo '\n[plugin account]\nreserved_list=' >> /etc/sat.conf
 
 # This script set account domain in sat.conf if not already set
 # if not set, domain is got from prosody container or DOMAIN environment variable
 RUN echo '#!/usr/bin/env python2\n\
-import os, xmlrpclib, ConfigParser, socket, subprocess\n\
+import os, os.path, xmlrpclib, ConfigParser, socket, subprocess\n\
 from sat.core.constants import Const as C\n\
 from sat.tools import config as sat_config\n\
 SECTION = "plugin account"\n\
 OPTION = "new_account_domain"\n\
-CONFIG_PATH = "/home/sat/sat.conf"\n\
+CONFIG_PATH = "/home/sat/.config/sat/sat.conf"\n\
+try:\n\
+    os.makedirs(os.path.dirname(CONFIG_PATH))\n\
+except OSError:\n\
+    pass\n\
 config = ConfigParser.SafeConfigParser()\n\
 config.read(C.CONFIG_FILES)\n\
 domain = sat_config.getConfig(config, SECTION, OPTION)\n\