Skip to content

Restrict all nfs shares to nfs group IPs #607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions environments/common/inventory/group_vars/all/nfs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,26 @@

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

# create a space-separated list of nfs group IPs:
_nfs_node_ips: "{{ groups['nfs'] | map('extract', hostvars, 'ansible_host') | join(' ') }}"

# default *all* entries in nfs_configurations to only permitting mounts from above IPs:
nfs_export_clients: "{{ _nfs_node_ips }}"

nfs_configurations:
- comment: Export /exports/home from Slurm control node as /home
nfs_enable:
server: "{{ inventory_hostname in groups['control'] }}"
# Don't mount share on server where it is exported from...
# Could do something like `nfs_clients: "{{ 'nfs_servers' not in group_names }}"` instead.
# Don't mount share on control node:
clients: "{{ inventory_hostname in groups['cluster'] and inventory_hostname not in groups['control'] }}"
nfs_server: "{{ nfs_server_default }}"
nfs_export: "/exports/home" # assumes skeleton TF is being used
nfs_client_mnt_point: "/home"
# prevent tunnelling and setuid binaries:
# NB: this is stackhpc.nfs role defaults but are set here to prevent being
# accidently overriden via default options
nfs_export_options: 'rw,secure,root_squash'
nfs_export_options: 'rw,secure,root_squash'
# prevent non-cluster IPs mounting the share:
# NB: this is set as default for all shares above but is repeated here
# in case nfs_export_clients is overriden
nfs_export_clients: "{{ _nfs_node_ips }}"
5 changes: 3 additions & 2 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
roles:
- src: stackhpc.nfs
version: v25.2.1
- src: https://github.com/stackhpc/ansible-role-cluster-nfs.git
version: fix/export-defaults # TODO: bump on release
name: stackhpc.nfs
- src: https://github.com/stackhpc/ansible-role-openhpc.git
version: v0.27.0
name: stackhpc.openhpc
Expand Down
Loading