sudo_ldap_scheme.yml

This commit is contained in:
Yunohost 2013-06-25 13:25:18 +02:00
parent 79a0f93144
commit 19e730f5e3
3 changed files with 40 additions and 2 deletions

View file

@ -23,7 +23,7 @@ parents:
- organizationalUnit
- top
childs:
children:
cn=admins,ou=groups:
cn: admins
gidNumber: "4001"

26
sudo_ldap_scheme.yml Normal file
View file

@ -0,0 +1,26 @@
parents:
ou=sudo:
ou: sudo
objectClass:
- organizationalUnit
- top
children:
cn=admin,ou=sudo:
cn: admin
sudoUser: admin
sudoHost: ALL
sudoCommand: ALL
sudoOption: "!authenticate"
objectClass:
- sudoRole
- top
cn=yunohost-admin,ou=sudo:
cn: yunohost-admin
sudoUser: yunohost-admin
sudoHost: ALL
sudoCommand: /usr/bin/yunohost
sudoOption: "!authenticate"
objectClass:
- sudoRole
- top

View file

@ -25,9 +25,21 @@ def tools_ldapinit():
for rdn, attr_dict in ldap_map['parents'].items():
yldap.add(rdn, attr_dict)
for rdn, attr_dict in ldap_map['childs'].items():
for rdn, attr_dict in ldap_map['children'].items():
yldap.add(rdn, attr_dict)
try:
with open('/etc/yunohost/from_script') as f: pass
except IOError:
with open('sudo_ldap_scheme.yml') as f:
ldap_map = yaml.load(f)
for rdn, attr_dict in ldap_map['parents'].items():
yldap.add(rdn, attr_dict)
for rdn, attr_dict in ldap_map['children'].items():
yldap.add(rdn, attr_dict)
admin_dict = {
'cn': 'admin',