mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-14 06:00:33 +03:00
nixos/samba: Add openFirewall
option
This commit is contained in:
parent
c033ff53bb
commit
43d2eefea6
2 changed files with 14 additions and 5 deletions
|
@ -87,13 +87,20 @@ in
|
||||||
<note>
|
<note>
|
||||||
<para>If you use the firewall consider adding the following:</para>
|
<para>If you use the firewall consider adding the following:</para>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
networking.firewall.allowedTCPPorts = [ 139 445 ];
|
services.samba.openFirewall = true;
|
||||||
networking.firewall.allowedUDPPorts = [ 137 138 ];
|
|
||||||
</programlisting>
|
</programlisting>
|
||||||
</note>
|
</note>
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
openFirewall = mkOption {
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
description = ''
|
||||||
|
Whether to automatically open the necessary ports in the firewall.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
enableNmbd = mkOption {
|
enableNmbd = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
default = true;
|
default = true;
|
||||||
|
@ -235,7 +242,10 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
security.pam.services.samba = {};
|
security.pam.services.samba = {};
|
||||||
environment.systemPackages = [ config.services.samba.package ];
|
environment.systemPackages = [ cfg.package ];
|
||||||
|
|
||||||
|
networking.firewall.allowedTCPPorts = mkIf cfg.openFirewall [ 139 445 ];
|
||||||
|
networking.firewall.allowedUDPPorts = mkIf cfg.openFirewall [ 137 138 ];
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import ./make-test-python.nix ({ pkgs, ... }:
|
||||||
server =
|
server =
|
||||||
{ ... }:
|
{ ... }:
|
||||||
{ services.samba.enable = true;
|
{ services.samba.enable = true;
|
||||||
|
services.samba.openFirewall = true;
|
||||||
services.samba.shares.public =
|
services.samba.shares.public =
|
||||||
{ path = "/public";
|
{ path = "/public";
|
||||||
"read only" = true;
|
"read only" = true;
|
||||||
|
@ -27,8 +28,6 @@ import ./make-test-python.nix ({ pkgs, ... }:
|
||||||
"guest ok" = "yes";
|
"guest ok" = "yes";
|
||||||
comment = "Public samba share.";
|
comment = "Public samba share.";
|
||||||
};
|
};
|
||||||
networking.firewall.allowedTCPPorts = [ 139 445 ];
|
|
||||||
networking.firewall.allowedUDPPorts = [ 137 138 ];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue