mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
Bugfix samba + test
This commit is contained in:
parent
4a5077b9bc
commit
88475daa83
2 changed files with 25 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
||||||
UPNP: false
|
UPNP: false
|
||||||
ipv4:
|
ipv4:
|
||||||
TCP: [22, 25, 53, 80, 443, 5222, 5269, 5280, 6767, 8888]
|
TCP: [22, 25, 53, 80, 137, 138, 139, 443, 445, 5222, 5269, 5280, 6767, 8888]
|
||||||
UDP: [53]
|
UDP: [53, 137, 138]
|
||||||
ipv6:
|
ipv6:
|
||||||
TCP: [22]
|
TCP: [22]
|
||||||
UDP: [53]
|
UDP: [53]
|
||||||
|
|
|
@ -39,8 +39,24 @@ def tools_ldapinit():
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
os.system('rm /etc/smbldap-tools/smbldap_bind.conf')
|
||||||
|
with open('/etc/smbldap-tools/smbldap_bind.conf', 'w') as f:
|
||||||
|
lines = [
|
||||||
|
'masterDN="cn=admin,dc=yunohost,dc=org"',
|
||||||
|
'slaveDN="cn=admin,dc=yunohost,dc=org"',
|
||||||
|
'masterPw="yunohost"',
|
||||||
|
'slavePw="yunohost"'
|
||||||
|
]
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
f.write(line +'\n')
|
||||||
|
|
||||||
|
os.system('chmod 600 /etc/smbldap-tools/smbldap_bind.conf')
|
||||||
os.system('smbpasswd -w yunohost')
|
os.system('smbpasswd -w yunohost')
|
||||||
os.system('smbldap-populate -e /tmp/samba-ldap.ldif')
|
sid = subprocess.check_output(['net', 'getlocalsid']).strip().split(':')[1][1:]
|
||||||
|
os.system('echo \'SID="'+ sid +'"\' >> /etc/smbldap-tools/smbldap.conf')
|
||||||
|
#os.system('smbldap-populate -e /tmp/samba-ldap.ldif')
|
||||||
|
os.system('smbldap-populate')
|
||||||
# TODO: change root domain password
|
# TODO: change root domain password
|
||||||
|
|
||||||
with YunoHostLDAP() as yldap:
|
with YunoHostLDAP() as yldap:
|
||||||
|
@ -49,10 +65,12 @@ def tools_ldapinit():
|
||||||
ldap_map = yaml.load(f)
|
ldap_map = yaml.load(f)
|
||||||
|
|
||||||
for rdn, attr_dict in ldap_map['parents'].items():
|
for rdn, attr_dict in ldap_map['parents'].items():
|
||||||
yldap.add(rdn, attr_dict)
|
pass
|
||||||
|
#yldap.add(rdn, attr_dict)
|
||||||
|
|
||||||
for rdn, attr_dict in ldap_map['children'].items():
|
for rdn, attr_dict in ldap_map['children'].items():
|
||||||
yldap.add(rdn, attr_dict)
|
pass
|
||||||
|
#yldap.add(rdn, attr_dict)
|
||||||
|
|
||||||
admin_dict = {
|
admin_dict = {
|
||||||
'cn': 'admin',
|
'cn': 'admin',
|
||||||
|
@ -65,7 +83,7 @@ def tools_ldapinit():
|
||||||
'objectClass': ['organizationalRole', 'posixAccount', 'simpleSecurityObject']
|
'objectClass': ['organizationalRole', 'posixAccount', 'simpleSecurityObject']
|
||||||
}
|
}
|
||||||
|
|
||||||
yldap.update('cn=admin', admin_dict)
|
#yldap.update('cn=admin', admin_dict)
|
||||||
|
|
||||||
win_msg(_("LDAP has been successfully initialized"))
|
win_msg(_("LDAP has been successfully initialized"))
|
||||||
|
|
||||||
|
@ -235,9 +253,6 @@ def tools_postinstall(domain, password, dyndns=False):
|
||||||
if os.system(command) != 0:
|
if os.system(command) != 0:
|
||||||
raise YunoHostError(17, _("There were a problem during CA creation"))
|
raise YunoHostError(17, _("There were a problem during CA creation"))
|
||||||
|
|
||||||
sid = subprocess.check_output(['net', 'getlocalsid']).strip().split(':')[1][1:]
|
|
||||||
os.system('echo \'SID="'+ sid +'"'\' >> /etc/smbldap-tools/smbldap.conf')
|
|
||||||
|
|
||||||
# Initialize YunoHost LDAP base
|
# Initialize YunoHost LDAP base
|
||||||
tools_ldapinit()
|
tools_ldapinit()
|
||||||
|
|
||||||
|
@ -250,5 +265,6 @@ def tools_postinstall(domain, password, dyndns=False):
|
||||||
if dyndns: dyndns_subscribe()
|
if dyndns: dyndns_subscribe()
|
||||||
|
|
||||||
os.system('touch /etc/yunohost/installed')
|
os.system('touch /etc/yunohost/installed')
|
||||||
|
os.system('service samba restart')
|
||||||
|
|
||||||
win_msg(_("YunoHost has been successfully configured"))
|
win_msg(_("YunoHost has been successfully configured"))
|
||||||
|
|
Loading…
Reference in a new issue