@@ -41,6 +41,25 @@ in
4141 default = "INFO";
4242 };
4343
44+ useRpcbind = mkOption {
45+ type = types.bool;
46+ description = ''
47+ Enable use of rpcbind. This is required for Gluster's NFS functionality.
48+
49+ You may want to turn it off to reduce the attack surface for DDoS reflection attacks.
50+
51+ See https://davelozier.com/glusterfs-and-rpcbind-portmap-ddos-reflection-attacks/
52+ and https://bugzilla.redhat.com/show_bug.cgi?id=1426842 for details.
53+ '';
54+ default = true;
55+ };
56+
57+ enableGlustereventsd = mkOption {
58+ type = types.bool;
59+ description = "Whether to enable the GlusterFS Events Daemon";
60+ default = true;
61+ };
62+
4463 extraFlags = mkOption {
4564 type = types.listOf types.str;
4665 description = "Extra flags passed to the GlusterFS daemon";
@@ -89,7 +108,7 @@ in
89108 config = mkIf cfg.enable {
90109 environment.systemPackages = [ pkgs.glusterfs ];
91110
92− services.rpcbind.enable = true;
111+ services.rpcbind.enable = cfg.useRpcbind;
93112
94113 environment.etc = mkIf (cfg.tlsSettings != null) {
95114 "ssl/glusterfs.pem".source = cfg.tlsSettings.tlsPem;
@@ -104,8 +123,8 @@ in
104123
105124 wantedBy = [ "multi-user.target" ];
106125
107− requires = [ "rpcbind.service" ];
108− after = [ "rpcbind.service" "network.target" "local-fs.target" ];
126+ requires = lib.optional cfg.useRpcbind "rpcbind.service";
127+ after = [ "network.target" "local-fs.target" ] ++ lib.optional cfg.useRpcbind [ "rpcbind.service" ];
109128
110129 preStart = ''
111130 install -m 0755 -d /var/log/glusterfs
@@ -133,7 +152,7 @@ in
133152 };
134153 };
135154
136− systemd.services.glustereventsd = {
155+ systemd.services.glustereventsd = mkIf cfg.enableGlustereventsd {
137156 inherit restartTriggers;
138157
139158 description = "Gluster Events Notifier";