Skip to content

Commit c5bcee9

Browse files
authored
Restrict all nfs shares to nfs group IPs (#607)
* restrict all nfs shares to nfs group IPs * try to clarify nfs export intents
1 parent c24717d commit c5bcee9

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

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

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

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

8+
# create a space-separated list of nfs group IPs:
9+
_nfs_node_ips: "{{ groups['nfs'] | map('extract', hostvars, 'ansible_host') | join(' ') }}"
10+
11+
# default *all* entries in nfs_configurations to only permitting mounts from above IPs:
12+
nfs_export_clients: "{{ _nfs_node_ips }}"
13+
814
nfs_configurations:
915
- comment: Export /exports/home from Slurm control node as /home
1016
nfs_enable:
1117
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.
18+
# Don't mount share on control node:
1419
clients: "{{ inventory_hostname in groups['cluster'] and inventory_hostname not in groups['control'] }}"
1520
nfs_server: "{{ nfs_server_default }}"
1621
nfs_export: "/exports/home" # assumes skeleton TF is being used
1722
nfs_client_mnt_point: "/home"
1823
# prevent tunnelling and setuid binaries:
1924
# NB: this is stackhpc.nfs role defaults but are set here to prevent being
2025
# accidently overriden via default options
21-
nfs_export_options: 'rw,secure,root_squash'
26+
nfs_export_options: 'rw,secure,root_squash'
27+
# prevent non-cluster IPs mounting the share:
28+
# NB: this is set as default for all shares above but is repeated here
29+
# in case nfs_export_clients is overriden
30+
nfs_export_clients: "{{ _nfs_node_ips }}"

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)