Skip to content

Commit 408dc0e

Browse files
committed
restrict all nfs shares to nfs group IPs
1 parent 06ae09b commit 408dc0e

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

environments/common/inventory/group_vars/all/nfs.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,24 @@
55

66
nfs_server_default: "{{ groups['control'] | first }}" # avoid using hostvars for compute-init
77

8+
# only allow the nfs group IPs to mount nfs exports:
9+
nfs_export_clients_default: "{{ groups['nfs'] | map('extract', hostvars, 'ansible_host') | join(' ') }}"
10+
nfs_export_clients: "{{ nfs_export_clients_default }}"
11+
812
nfs_configurations:
913
- comment: Export /exports/home from Slurm control node as /home
1014
nfs_enable:
1115
server: "{{ inventory_hostname in groups['control'] }}"
12-
# Don't mount share on server where it is exported from...
13-
# Could do something like `nfs_clients: "{{ 'nfs_servers' not in group_names }}"` instead.
16+
# Don't mount share on control node:
1417
clients: "{{ inventory_hostname in groups['cluster'] and inventory_hostname not in groups['control'] }}"
1518
nfs_server: "{{ nfs_server_default }}"
1619
nfs_export: "/exports/home" # assumes skeleton TF is being used
1720
nfs_client_mnt_point: "/home"
1821
# prevent tunnelling and setuid binaries:
1922
# NB: this is stackhpc.nfs role defaults but are set here to prevent being
2023
# accidently overriden via default options
21-
nfs_export_options: 'rw,secure,root_squash'
24+
nfs_export_options: 'rw,secure,root_squash'
25+
# prevent other IPs mounting the share:
26+
# NB: this is set as default for all shares above but is repeated here
27+
# to prevevent being accidently overriden when adding shares
28+
nfs_export_clients: "{{ nfs_export_clients_default }}"

requirements.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
---
22
roles:
3-
- src: stackhpc.nfs
4-
version: v25.2.1
3+
- src: https://github.com/stackhpc/ansible-role-cluster-nfs.git
4+
version: fix/export-defaults # TODO: bump on release
5+
name: stackhpc.nfs
56
- src: https://github.com/stackhpc/ansible-role-openhpc.git
67
version: v0.27.0
78
name: stackhpc.openhpc

0 commit comments

Comments
 (0)