le sexy time

This commit is contained in:
Kloadut 2012-10-28 15:24:10 +01:00
parent e87ae0640e
commit 4e2b648e72
3 changed files with 25 additions and 20 deletions

View file

@ -123,6 +123,8 @@ def main():
display_error(error) display_error(error)
return error.code return error.code
else: else:
if result is None:
result = { 'Notice' : 'No result returned' }
if os.isatty(1): if os.isatty(1):
pretty_print_dict(result) pretty_print_dict(result)
else: else:

View file

@ -130,25 +130,28 @@ def tools_maindomain(args):
# Regenerate certificate # Regenerate certificate
tmp = '/usr/share/yunohost/yunohost-config' tmp = '/usr/share/yunohost/yunohost-config'
os.system('echo "01" > '+ tmp +'/ssl/yunoCA/serial') a = os.system('echo "01" > '+ tmp +'/ssl/yunoCA/serial')
os.system('rm '+ tmp +'/ssl/yunoCA/index.txt') b = os.system('rm '+ tmp +'/ssl/yunoCA/index.txt')
os.system('touch '+ tmp +'/ssl/yunoCA/index.txt') c = os.system('touch '+ tmp +'/ssl/yunoCA/index.txt')
os.system('sed -i "s/' + args['old_domain'] + '/' + args['new_domain'] + '/g" '+ tmp +'/ssl/yunoCA/openssl.cnf') d = os.system('sed -i "s/' + args['old_domain'] + '/' + args['new_domain'] + '/g" '+ tmp +'/ssl/yunoCA/openssl.cnf')
os.system('openssl req -x509 -new -config '+ tmp +'/ssl/yunoCA/openssl.cnf -days 3650 -out '+ tmp +'/ssl/yunoCA/ca/cacert.pem -keyout '+ tmp +'/ssl/yunoCA/ca/cakey.pem -nodes -batch') e = os.system('openssl req -x509 -new -config '+ tmp +'/ssl/yunoCA/openssl.cnf -days 3650 -out '+ tmp +'/ssl/yunoCA/ca/cacert.pem -keyout '+ tmp +'/ssl/yunoCA/ca/cakey.pem -nodes -batch')
os.system('openssl req -new -config '+ tmp +'/ssl/yunoCA/openssl.cnf -days 730 -out '+ tmp +'/ssl/yunoCA/certs/yunohost_csr.pem -keyout '+ tmp +'/ssl/yunoCA/certs/yunohost_key.pem -nodes -batch') f = os.system('openssl req -new -config '+ tmp +'/ssl/yunoCA/openssl.cnf -days 730 -out '+ tmp +'/ssl/yunoCA/certs/yunohost_csr.pem -keyout '+ tmp +'/ssl/yunoCA/certs/yunohost_key.pem -nodes -batch')
os.system('openssl ca -config '+ tmp +'/ssl/yunoCA/openssl.cnf -days 730 -in '+ tmp +'/ssl/yunoCA/certs/yunohost_csr.pem -out '+ tmp +'/ssl/yunoCA/certs/yunohost_crt.pem -batch') g = os.system('openssl ca -config '+ tmp +'/ssl/yunoCA/openssl.cnf -days 730 -in '+ tmp +'/ssl/yunoCA/certs/yunohost_csr.pem -out '+ tmp +'/ssl/yunoCA/certs/yunohost_crt.pem -batch')
os.system('cp '+ tmp +'/ssl/yunoCA/ca/cacert.pem /etc/ssl/certs/ca-yunohost_crt.pem') h = os.system('cp '+ tmp +'/ssl/yunoCA/ca/cacert.pem /etc/ssl/certs/ca-yunohost_crt.pem')
os.system('cp '+ tmp +'/ssl/yunoCA/certs/yunohost_key.pem /etc/ssl/private/') i = os.system('cp '+ tmp +'/ssl/yunoCA/certs/yunohost_key.pem /etc/ssl/private/')
os.system('cp '+ tmp +'/ssl/yunoCA/newcerts/01.pem /etc/ssl/certs/yunohost_crt.pem') j = os.system('cp '+ tmp +'/ssl/yunoCA/newcerts/01.pem /etc/ssl/certs/yunohost_crt.pem')
os.system('cp '+ tmp +'/ssl/yunoCA/newcerts/01.pem /etc/ejabberd/ejabberd.pem') k = os.system('cp '+ tmp +'/ssl/yunoCA/newcerts/01.pem /etc/ejabberd/ejabberd.pem')
os.system('echo '+ args['new_domain'] +' > /usr/share/yunohost/yunohost-config/others/current_host') l = os.system('echo '+ args['new_domain'] +' > /usr/share/yunohost/yunohost-config/others/current_host')
# Restart services # Restart services
os.system('/etc/init.d/apache2 restart') m = os.system('/etc/init.d/apache2 restart')
os.system('/etc/init.d/postfix restart') n = os.system('/etc/init.d/postfix restart')
os.system('/etc/init.d/ejabberd restart') o = os.system('/etc/init.d/ejabberd restart')
return { 'Success' : _("YunoHost main domain has been successfully changed") } if a == b == c == d == e == f == g == h == i == j == k == l == m == n == o:
return { 'Success' : _("YunoHost main domain has been successfully changed") }
else:
return { 'Error' : _("There were a problem during domain changing") }
def tools_postinstall(args, connections): def tools_postinstall(args, connections):
@ -172,15 +175,15 @@ def tools_postinstall(args, connections):
args = get_required_args(args, {'domain' : _('Main domain name'), 'password' : _('New admin password') }, True) args = get_required_args(args, {'domain' : _('Main domain name'), 'password' : _('New admin password') }, True)
# New domain config
tools_maindomain({ 'old_domain' : 'yunohost.org', 'new_domain' : args['domain']})
# Initialize YunoHost LDAP base # Initialize YunoHost LDAP base
tools_ldapinit(args, connections) tools_ldapinit(args, connections)
# Change LDAP admin password # Change LDAP admin password
tools_adminpw({ 'old' : 'yunohost', 'new' : args['password']}) tools_adminpw({ 'old' : 'yunohost', 'new' : args['password']})
# New domain config
tools_maindomain({ 'old_domain' : 'yunohost.org', 'new_domain' : args['domain']})
os.system('touch /usr/share/yunohost/yunohost-config/others/installed') os.system('touch /usr/share/yunohost/yunohost-config/others/installed')
return { 'Success' : _("YunoHost has been successfully configured") } return { 'Success' : _("YunoHost has been successfully configured") }

View file

@ -80,7 +80,7 @@ def user_create(args, connections):
'gidNumber' : uid, 'gidNumber' : uid,
'uidNumber' : uid, 'uidNumber' : uid,
'homeDirectory' : '/home/' + args['username'], 'homeDirectory' : '/home/' + args['username'],
'loginShell' : '/bin/bash' 'loginShell' : '/bin/false'
} }
if yldap.add(rdn, attr_dict): if yldap.add(rdn, attr_dict):