mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 23:03:40 +01:00
nat: add extraCommands and extraStopCommands options
This commit is contained in:
parent
7fcdd34d17
commit
ab2b3a5d0a
1 changed files with 26 additions and 0 deletions
|
@ -19,6 +19,8 @@ let
|
|||
iptables -w -t nat -D POSTROUTING -j nixos-nat-post 2>/dev/null || true
|
||||
iptables -w -t nat -F nixos-nat-post 2>/dev/null || true
|
||||
iptables -w -t nat -X nixos-nat-post 2>/dev/null || true
|
||||
|
||||
${cfg.extraStopCommands}
|
||||
'';
|
||||
|
||||
setupNat = ''
|
||||
|
@ -59,6 +61,8 @@ let
|
|||
--to-destination ${cfg.dmzHost}
|
||||
''}
|
||||
|
||||
${cfg.extraCommands}
|
||||
|
||||
# Append our chains to the nat tables
|
||||
iptables -w -t nat -A PREROUTING -j nixos-nat-pre
|
||||
iptables -w -t nat -A POSTROUTING -j nixos-nat-post
|
||||
|
@ -170,6 +174,28 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
networking.nat.extraCommands = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = "iptables -A INPUT -p icmp -j ACCEPT";
|
||||
description =
|
||||
''
|
||||
Additional shell commands executed as part of the nat
|
||||
initialisation script.
|
||||
'';
|
||||
};
|
||||
|
||||
networking.nat.extraStopCommands = mkOption {
|
||||
type = types.lines;
|
||||
default = "";
|
||||
example = "iptables -D INPUT -p icmp -j ACCEPT || true";
|
||||
description =
|
||||
''
|
||||
Additional shell commands executed as part of the nat
|
||||
teardown script.
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue