summary refs log tree commit diff
path: root/nixos/modules/services/network-filesystems
diff options
context:
space:
mode:
authorLluís Batlle i Rossell <viric@viric.name>2014-10-15 10:56:41 +0200
committerLluís Batlle i Rossell <viric@viric.name>2014-10-15 10:59:33 +0200
commitf59403382291c2ad8a7f77d6a6c520700ef74c7d (patch)
treeba4f95656a3b7c18c47002cf4bcd6d599c820d17 /nixos/modules/services/network-filesystems
parente9809e8f9ef396bd01a8f3fde6cd3c6691cb4f25 (diff)
downloadnixlib-f59403382291c2ad8a7f77d6a6c520700ef74c7d.tar
nixlib-f59403382291c2ad8a7f77d6a6c520700ef74c7d.tar.gz
nixlib-f59403382291c2ad8a7f77d6a6c520700ef74c7d.tar.bz2
nixlib-f59403382291c2ad8a7f77d6a6c520700ef74c7d.tar.lz
nixlib-f59403382291c2ad8a7f77d6a6c520700ef74c7d.tar.xz
nixlib-f59403382291c2ad8a7f77d6a6c520700ef74c7d.tar.zst
nixlib-f59403382291c2ad8a7f77d6a6c520700ef74c7d.zip
nixos nfs: allow setting the lockd ports.
This helps in setting a fixed firewall open port for NFS lockd.

Based on:
http://rlworkman.net/howtos/NFS_Firewall_HOWTO

(cherry picked from commit b32ca0616ff70795f71995fa79ea508b82f30b3a)

Conflicts:
	nixos/modules/services/network-filesystems/nfsd.nix
Diffstat (limited to 'nixos/modules/services/network-filesystems')
-rw-r--r--nixos/modules/services/network-filesystems/nfsd.nix9
1 files changed, 9 insertions, 0 deletions
diff --git a/nixos/modules/services/network-filesystems/nfsd.nix b/nixos/modules/services/network-filesystems/nfsd.nix
index 57d56cd72877..cb703977bfc7 100644
--- a/nixos/modules/services/network-filesystems/nfsd.nix
+++ b/nixos/modules/services/network-filesystems/nfsd.nix
@@ -63,6 +63,12 @@ in
           description = ''
             Use fixed port for rpc.mountd, usefull if server is behind firewall.
           '';
+
+        lockdPort = mkOption {
+          default = 0;
+          description = ''
+            Fix the lockd port number. This can help setting firewall rules for NFS.
+          '';
         };
       };
 
@@ -104,6 +110,9 @@ in
             # Create a state directory required by NFSv4.
             mkdir -p /var/lib/nfs/v4recovery
 
+            ${pkgs.procps}/sbin/sysctl -w fs.nfs.nlm_tcpport=${builtins.toString cfg.lockdPort}
+            ${pkgs.procps}/sbin/sysctl -w fs.nfs.nlm_udpport=${builtins.toString cfg.lockdPort}
+
             rpc.nfsd \
               ${if cfg.hostName != null then "-H ${cfg.hostName}" else ""} \
               ${builtins.toString cfg.nproc}