mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Cleaner postinstall logs during CA creation (#250)
This commit is contained in:
parent
11bcdabbc0
commit
86f0978dfb
2 changed files with 15 additions and 4 deletions
|
@ -242,6 +242,7 @@
|
||||||
"user_updated": "The user has been updated",
|
"user_updated": "The user has been updated",
|
||||||
"yunohost_already_installed": "YunoHost is already installed",
|
"yunohost_already_installed": "YunoHost is already installed",
|
||||||
"yunohost_ca_creation_failed": "Unable to create certificate authority",
|
"yunohost_ca_creation_failed": "Unable to create certificate authority",
|
||||||
|
"yunohost_ca_creation_success": "The local certification authority has been created.",
|
||||||
"yunohost_configured": "YunoHost has been configured",
|
"yunohost_configured": "YunoHost has been configured",
|
||||||
"yunohost_installing": "Installing YunoHost...",
|
"yunohost_installing": "Installing YunoHost...",
|
||||||
"yunohost_not_installed": "YunoHost is not or not correctly installed. Please execute 'yunohost tools postinstall'",
|
"yunohost_not_installed": "YunoHost is not or not correctly installed. Please execute 'yunohost tools postinstall'",
|
||||||
|
|
|
@ -291,21 +291,31 @@ def tools_postinstall(domain, password, ignore_dyndns=False):
|
||||||
# Create SSL CA
|
# Create SSL CA
|
||||||
service_regen_conf(['ssl'], force=True)
|
service_regen_conf(['ssl'], force=True)
|
||||||
ssl_dir = '/usr/share/yunohost/yunohost-config/ssl/yunoCA'
|
ssl_dir = '/usr/share/yunohost/yunohost-config/ssl/yunoCA'
|
||||||
command_list = [
|
commands = [
|
||||||
'echo "01" > %s/serial' % ssl_dir,
|
'echo "01" > %s/serial' % ssl_dir,
|
||||||
'rm %s/index.txt' % ssl_dir,
|
'rm %s/index.txt' % ssl_dir,
|
||||||
'touch %s/index.txt' % ssl_dir,
|
'touch %s/index.txt' % ssl_dir,
|
||||||
'cp %s/openssl.cnf %s/openssl.ca.cnf' % (ssl_dir, ssl_dir),
|
'cp %s/openssl.cnf %s/openssl.ca.cnf' % (ssl_dir, ssl_dir),
|
||||||
'sed -i "s/yunohost.org/%s/g" %s/openssl.ca.cnf ' % (domain, ssl_dir),
|
'sed -i s/yunohost.org/%s/g %s/openssl.ca.cnf ' % (domain, ssl_dir),
|
||||||
'openssl req -x509 -new -config %s/openssl.ca.cnf -days 3650 -out %s/ca/cacert.pem -keyout %s/ca/cakey.pem -nodes -batch' % (ssl_dir, ssl_dir, ssl_dir),
|
'openssl req -x509 -new -config %s/openssl.ca.cnf -days 3650 -out %s/ca/cacert.pem -keyout %s/ca/cakey.pem -nodes -batch' % (ssl_dir, ssl_dir, ssl_dir),
|
||||||
'cp %s/ca/cacert.pem /etc/ssl/certs/ca-yunohost_crt.pem' % ssl_dir,
|
'cp %s/ca/cacert.pem /etc/ssl/certs/ca-yunohost_crt.pem' % ssl_dir,
|
||||||
'update-ca-certificates'
|
'update-ca-certificates'
|
||||||
]
|
]
|
||||||
|
|
||||||
for command in command_list:
|
for command in commands:
|
||||||
if os.system(command) != 0:
|
p = subprocess.Popen(
|
||||||
|
command.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
|
out, _ = p.communicate()
|
||||||
|
|
||||||
|
if p.returncode != 0:
|
||||||
|
logger.warning(out)
|
||||||
raise MoulinetteError(errno.EPERM,
|
raise MoulinetteError(errno.EPERM,
|
||||||
m18n.n('yunohost_ca_creation_failed'))
|
m18n.n('yunohost_ca_creation_failed'))
|
||||||
|
else:
|
||||||
|
logger.debug(out)
|
||||||
|
|
||||||
|
logger.success(m18n.n('yunohost_ca_creation_success'))
|
||||||
|
|
||||||
# New domain config
|
# New domain config
|
||||||
domain_add(auth, domain, dyndns)
|
domain_add(auth, domain, dyndns)
|
||||||
|
|
Loading…
Add table
Reference in a new issue