From c8dadcc7c2bf1e88e46578fe7b0abc7a3efb88a8 Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Mon, 3 Nov 2014 22:51:05 +0100 Subject: [PATCH] nfs: gen auto des dossiers exportables --- Bundler/nfs-server.xml | 2 +- Cfg/etc/exports/exports | 14 -------------- Python/etc/exports | 18 ++++++++++++++++++ 3 files changed, 19 insertions(+), 15 deletions(-) delete mode 100644 Cfg/etc/exports/exports create mode 100644 Python/etc/exports diff --git a/Bundler/nfs-server.xml b/Bundler/nfs-server.xml index b67f8d3..43068dc 100644 --- a/Bundler/nfs-server.xml +++ b/Bundler/nfs-server.xml @@ -2,7 +2,7 @@ - + diff --git a/Cfg/etc/exports/exports b/Cfg/etc/exports/exports deleted file mode 100644 index e530ed2..0000000 --- a/Cfg/etc/exports/exports +++ /dev/null @@ -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) diff --git a/Python/etc/exports b/Python/etc/exports new file mode 100644 index 0000000..c6d1b34 --- /dev/null +++ b/Python/etc/exports @@ -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) +