From c3f9daf4ec56276e040bc33e29c7eeaf1b99d91c Mon Sep 17 00:00:00 2001 From: pacien Date: Tue, 15 Nov 2022 01:40:05 +0100 Subject: lib/mkSandboxSystem: print network restriction status --- lib/mk-sandbox-system.nix | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/mk-sandbox-system.nix b/lib/mk-sandbox-system.nix index e9866cf..3bbc488 100644 --- a/lib/mk-sandbox-system.nix +++ b/lib/mk-sandbox-system.nix @@ -39,6 +39,17 @@ let ${shellLib.fmt.printSectionTitle "FORWARDED PORTS (host <-> guest)"} ${pkgs.lib.concatMapStringsSep "\n" printForwardedPort portForwards} ''; + + printNetworkRestricted = isRestricted: + if isRestricted then "Restricted" else "Unrestricted"; + printNetworkAllowed = isRestricted: + if isRestricted then "disallowed" else "allowed"; + printRestrictedNetwork = isRestricted: '' + ${shellLib.fmt.printSectionTitle "NETWORK ACCESS"} + echo -en ${shellLib.fmt.keyword (printNetworkRestricted isRestricted)} + echo -n ': local network and internet access ' + echo ${printNetworkAllowed isRestricted}. + ''; }; in rec { @@ -84,11 +95,11 @@ in rec { interactiveShellInit = lib.mkBefore '' ${shellLib.ifSomeAttrs envVars shellLib.printEnvVars} ${shellLib.ifSomeList tools shellLib.printBins} - ${shellLib.ifSomeAttrs config.virtualisation.sharedDirectories print.printSharedDirs} ${shellLib.ifSomeList config.virtualisation.forwardPorts print.printForwardedPorts} + ${print.printRestrictedNetwork restrictNetwork} ''; }; -- cgit v1.2.3