From 3940777159d4900a67981842b82b5f7f677cb032 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 17 Jul 2015 10:30:14 +0200 Subject: 1 lass: enable identity --- 1systems/lass/mors.nix | 6 ++++++ 1systems/lass/uriel.nix | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/1systems/lass/mors.nix b/1systems/lass/mors.nix index f724dec..940dc4f 100644 --- a/1systems/lass/mors.nix +++ b/1systems/lass/mors.nix @@ -33,6 +33,12 @@ ]; }; } + { + imports = [ ../../3modules/tv/identity.nix ]; + tv.identity = { + enable = true; + }; + } ]; networking.hostName = "mors"; diff --git a/1systems/lass/uriel.nix b/1systems/lass/uriel.nix index b8fa899..25745d0 100644 --- a/1systems/lass/uriel.nix +++ b/1systems/lass/uriel.nix @@ -24,6 +24,12 @@ ]; }; } + { + imports = [ ../../3modules/tv/identity.nix ]; + tv.identity = { + enable = true; + }; + } ]; networking.hostName = "uriel"; -- cgit v1.2.3 From 848debcc37ff429eb97b8ef60389d689dd905fcb Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 17 Jul 2015 10:30:41 +0200 Subject: 2 lass.git-repos: open port 80 on retiolum --- 2configs/lass/git-repos.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/2configs/lass/git-repos.nix b/2configs/lass/git-repos.nix index 94ab631..c0c305b 100644 --- a/2configs/lass/git-repos.nix +++ b/2configs/lass/git-repos.nix @@ -121,10 +121,20 @@ in { imports = [ ../../3modules/tv/git.nix + ../../3modules/lass/iptables.nix ]; tv.git = { enable = true; inherit repos rules users; }; + + lass.iptables = { + tables = { + filter.INPUT.rules = [ + { predicate = "-i retiolum -p tcp --dport 80"; target = "ACCEPT"; } + ]; + }; + }; + } -- cgit v1.2.3 From a2e9186b75b77ac3b7b53331008212040e368373 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 17 Jul 2015 10:32:50 +0200 Subject: 0 lass.mors: bump rev --- 0make/lass/mors.makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/0make/lass/mors.makefile b/0make/lass/mors.makefile index 892bc2e..896466a 100644 --- a/0make/lass/mors.makefile +++ b/0make/lass/mors.makefile @@ -1,4 +1,4 @@ deploy_host := root@mors nixpkgs_url := https://github.com/Lassulus/nixpkgs -nixpkgs_rev := 961fcbabd7643171ea74bd550fee1ce5c13c2e90 +nixpkgs_rev := 1879a011925c561f0a7fd4043da0768bbff41d0b secrets_dir := /home/lass/secrets/mors -- cgit v1.2.3 From d66905589f60c3904b3ed3edd8c770c985feb092 Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 17 Jul 2015 10:33:11 +0200 Subject: 2 lass.steam: enable java --- 2configs/lass/steam.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/2configs/lass/steam.nix b/2configs/lass/steam.nix index d54873b..7d088fc 100644 --- a/2configs/lass/steam.nix +++ b/2configs/lass/steam.nix @@ -12,6 +12,7 @@ ##TODO: make steam module hardware.opengl.driSupport32Bit = true; + nixpkgs.config.steam.java = true; environment.systemPackages = with pkgs; [ steam ]; -- cgit v1.2.3 From 8255816aa51f138cedf8c713f3dfad1ff53747e6 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 18 Jul 2015 13:29:07 +0200 Subject: 3 lass.iptables: refactor imports --- 3modules/lass/iptables.nix | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/3modules/lass/iptables.nix b/3modules/lass/iptables.nix index 6d567ca..1cd6d3f 100644 --- a/3modules/lass/iptables.nix +++ b/3modules/lass/iptables.nix @@ -2,7 +2,28 @@ arg@{ config, lib, pkgs, ... }: let inherit (pkgs) writeScript writeText; - inherit (lib) concatMapStringsSep concatStringsSep attrNames unique fold any attrValues catAttrs filter flatten length hasAttr mkEnableOption mkOption mkIf types; + + inherit (lib) + concatMapStringsSep + concatStringsSep + attrNames + unique + fold + any + attrValues + catAttrs + filter + flatten + length + hasAttr + mkEnableOption + mkOption + mkIf + types + sort; + + elemIsIn = a: as: + any (x: x == a) as; cfg = config.lass.iptables; -- cgit v1.2.3 From 2840f0e74dc51785420239efb90f3ec3ca8a23c6 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 18 Jul 2015 13:55:17 +0200 Subject: 3 lass.iptables: sort rules by precedence --- 3modules/lass/iptables.nix | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/3modules/lass/iptables.nix b/3modules/lass/iptables.nix index 1cd6d3f..ba05abe 100644 --- a/3modules/lass/iptables.nix +++ b/3modules/lass/iptables.nix @@ -95,10 +95,12 @@ let }; }; - #buildTable :: iptablesAttrSet` -> str + #buildTable :: iptablesVersion -> iptablesAttrSet` -> str #todo: differentiate by iptables-version - buildTables = iptv: ts: + buildTables = v: ts: let + sortedTable = sort (a: b: a.precedence < b.precedence) ts; + declareChain = t: cn: #TODO: find out what to do whit these count numbers ":${cn} ${t."${cn}".policy} [0:0]"; @@ -106,7 +108,6 @@ let buildChain = tn: cn: #"${concatStringsSep " " ((attrNames t."${cn}") ++ [cn])}"; - #TODO: sort by precedence #TODO: double check should be unneccessary, refactor! if (hasAttr "rules" ts."${tn}"."${cn}") then if (ts."${tn}"."${cn}".rules == null) then @@ -144,7 +145,7 @@ let "\nCOMMIT"; in concatStringsSep "\n" ([] - ++ map buildTable (attrNames ts) + ++ map buildTable (attrNames sortedTable) ); #===== -- cgit v1.2.3 From 2cafcac340903fa40ae6f455e3f5a72f0ab023dc Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 18 Jul 2015 13:55:56 +0200 Subject: 3 lass.iptables: check if target is valid --- 3modules/lass/iptables.nix | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/3modules/lass/iptables.nix b/3modules/lass/iptables.nix index ba05abe..5205882 100644 --- a/3modules/lass/iptables.nix +++ b/3modules/lass/iptables.nix @@ -114,20 +114,18 @@ let "" else concatMapStringsSep "\n" (rule: "\n-A ${cn} ${rule}") ([] - ++ map buildRule ts."${tn}"."${cn}".rules + ++ map (buildRule tn cn) ts."${tn}"."${cn}".rules ) else "" ; - buildRule = rule: - #TODO implement rule validation-test here - # - #target: - #target needs to be an existing chain (in the same table) or ACCEPT, REJECT, DROP, LOG, QUEUE, RETURN + buildRule = tn: cn: rule: + #target validation test: + assert (elemIsIn rule.target ([ "ACCEPT" "REJECT" "DROP" "QUEUE" "LOG" "RETURN" ] ++ ts."${tn}"."${cn}")); - #predicate: + #predicate validation test: #maybe use iptables-test #TODO: howto exit with evaluation error by shellscript? #apperantly not possible from nix because evalatution wouldn't be deterministic. -- cgit v1.2.3 From c3bc0ca4ec9ad2467653f1ab232b062a8bc7f8e5 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 18 Jul 2015 14:19:41 +0200 Subject: 2 lass.ircd: disable authentification --- 2configs/lass/ircd.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/2configs/lass/ircd.nix b/2configs/lass/ircd.nix index c57f7dd..f71b769 100644 --- a/2configs/lass/ircd.nix +++ b/2configs/lass/ircd.nix @@ -83,6 +83,10 @@ channel_target_change = yes; disable_local_channels = no; }; + general { + #maybe we want ident someday? + disable_auth = yes; + }; ''; }; } -- cgit v1.2.3 From 60b2c8d900d9cd6c85e24c70029f6df971785589 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 18 Jul 2015 14:30:29 +0200 Subject: 3 lass.iptables sort rules instead of tables --- 3modules/lass/iptables.nix | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/3modules/lass/iptables.nix b/3modules/lass/iptables.nix index 5205882..b78879d 100644 --- a/3modules/lass/iptables.nix +++ b/3modules/lass/iptables.nix @@ -99,26 +99,27 @@ let #todo: differentiate by iptables-version buildTables = v: ts: let - sortedTable = sort (a: b: a.precedence < b.precedence) ts; declareChain = t: cn: #TODO: find out what to do whit these count numbers ":${cn} ${t."${cn}".policy} [0:0]"; buildChain = tn: cn: - #"${concatStringsSep " " ((attrNames t."${cn}") ++ [cn])}"; - - #TODO: double check should be unneccessary, refactor! - if (hasAttr "rules" ts."${tn}"."${cn}") then - if (ts."${tn}"."${cn}".rules == null) then - "" + let + sortedRules = sort (a: b: a.precedence < b.precedence) ts."${tn}"."${cn}".rules; + + in + #TODO: double check should be unneccessary, refactor! + if (hasAttr "rules" ts."${tn}"."${cn}") then + if (ts."${tn}"."${cn}".rules == null) then + "" + else + concatMapStringsSep "\n" (rule: "\n-A ${cn} ${rule}") ([] + ++ map (buildRule tn cn) sortedRules + ) else - concatMapStringsSep "\n" (rule: "\n-A ${cn} ${rule}") ([] - ++ map (buildRule tn cn) ts."${tn}"."${cn}".rules - ) - else - "" - ; + "" + ; buildRule = tn: cn: rule: @@ -143,7 +144,7 @@ let "\nCOMMIT"; in concatStringsSep "\n" ([] - ++ map buildTable (attrNames sortedTable) + ++ map buildTable (attrNames ts) ); #===== -- cgit v1.2.3 From 1691f1b780924d1416bc340b1ab268e7efa70e39 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 18 Jul 2015 14:32:02 +0200 Subject: 3 lass.iptables: fix broken predicate check --- 3modules/lass/iptables.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3modules/lass/iptables.nix b/3modules/lass/iptables.nix index b78879d..c97b9f7 100644 --- a/3modules/lass/iptables.nix +++ b/3modules/lass/iptables.nix @@ -124,7 +124,7 @@ let buildRule = tn: cn: rule: #target validation test: - assert (elemIsIn rule.target ([ "ACCEPT" "REJECT" "DROP" "QUEUE" "LOG" "RETURN" ] ++ ts."${tn}"."${cn}")); + assert (elemIsIn rule.target ([ "ACCEPT" "REJECT" "DROP" "QUEUE" "LOG" "RETURN" ] ++ (attrNames ts."${tn}"))); #predicate validation test: #maybe use iptables-test -- cgit v1.2.3