nfs: gen auto des dossiers exportables

This commit is contained in:
Daniel STAN 2014-11-03 22:51:05 +01:00
parent 07f303ad70
commit c8dadcc7c2
3 changed files with 19 additions and 15 deletions

View file

@ -2,7 +2,7 @@
<Group name="crans-nfs"> <Group name="crans-nfs">
<Service name="nfs-kernel-server"/> <Service name="nfs-kernel-server"/>
<Path name="/etc/default/nfs-kernel-server"/> <Path name="/etc/default/nfs-kernel-server"/>
<Path name="/etc/exports"/> <Python name="/etc/exports"/>
<Package name="nfs-kernel-server"/> <Package name="nfs-kernel-server"/>
</Group> </Group>
</Bundle> </Bundle>

View file

@ -1,14 +0,0 @@
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check)
#
/home-adh 10.231.136.0/24(rw,async,no_subtree_check,no_root_squash)
/usr/scripts 10.231.136.0/24(rw,async,no_subtree_check,no_root_squash)
/home-adh 2a01:240:fe3d:c804::/64(rw,async,no_subtree_check,no_root_squash)
/usr/scripts 2a01:240:fe3d:c804::/64(rw,async,no_subtree_check,no_root_squash)

18
Python/etc/exports Normal file
View file

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
header("""Liste des dossiers exportés par le nfs""")
import gestion.config as config
import string
import os
home_adh = list(string.ascii_lowercase) + ['logs', 'mail']
dirs = map(lambda x: os.path.join('/home-adh', x), home_adh)
dirs += ['/usr/scripts', '/home-adh']
allowed = config.NETs['adm'] + config.prefix['adm']
tpl = "%s %s(rw,async,nohide,no_subtree_check,no_root_squash)"
for dir in dirs:
for cidr in allowed:
print tpl % (dir, cidr)