diff options
| author | tv <tv@krebsco.de> | 2019-12-02 01:27:22 +0100 | 
|---|---|---|
| committer | makefu <github@syntax-fehler.de> | 2020-01-05 22:16:09 +0100 | 
| commit | c10f1614327bc5945e9e26eb4e98f6815e871dcc (patch) | |
| tree | 3e53c45c1e9ff02ba3b29e92910e1cb34630a16d /tv | |
| parent | e5cb38fa6acfb51c9742121a63686a78fefb6cd3 (diff) | |
tv im: add mosh support
Diffstat (limited to 'tv')
| -rw-r--r-- | tv/3modules/im.nix | 35 | 
1 files changed, 30 insertions, 5 deletions
diff --git a/tv/3modules/im.nix b/tv/3modules/im.nix index 830c4ba..905b780 100644 --- a/tv/3modules/im.nix +++ b/tv/3modules/im.nix @@ -29,6 +29,9 @@ in {        default = config.krebs.hosts.nomic;        type = lib.types.host;      }; +    tv.im.server.mosh.enable = lib.mkEnableOption "tv.im.server.mosh" // { +      default = true; +    };      tv.im.server.user = lib.mkOption {        default = config.krebs.users.tv;        type = lib.types.user; @@ -38,11 +41,18 @@ in {      (lib.mkIf im.client.enable {        users.users.${im.client.user.name}.packages = [          (pkgs.writeDashBin "im" '' -          exec ${pkgs.openssh}/bin/ssh \ -              ${lib.optionalString im.client.useIPv6 "-6"} \ -              ${im.server.user.name}@${lib.head im.server.host.nets.retiolum.aliases} \ -              -t \ -              im +          ${if im.server.mosh.enable then /* sh */ '' +            exec ${pkgs.mosh}/bin/mosh \ +                ${lib.optionalString im.client.useIPv6 "-6"} \ +                ${im.server.user.name}@${lib.head im.server.host.nets.retiolum.aliases} \ +                env TERM=${im.client.term} im +          '' else /* sh */ '' +            exec ${pkgs.openssh}/bin/ssh \ +                ${lib.optionalString im.client.useIPv6 "-6"} \ +                ${im.server.user.name}@${lib.head im.server.host.nets.retiolum.aliases} \ +                -t \ +                im +          ''}          '')        ];      }) @@ -54,6 +64,7 @@ in {          ];        };        users.users.${im.server.user.name}.packages = [ +        pkgs.mosh          (pkgs.writeDashBin "im" ''            export PATH=${lib.makeSearchPath "bin" [              pkgs.tmux @@ -68,5 +79,19 @@ in {          '')        ];      }) +    (lib.mkIf im.server.mosh.enable { +      krebs.setuid.utempter = { +        filename = "${pkgs.libutempter}/lib/utempter/utempter"; +        owner = "nobody"; +        group = "utmp"; +        mode = "2111"; +      }; +      tv.iptables.extra4.filter.Retiolum = [ +        "-s ${im.client.host.nets.retiolum.ip4.addr} -p udp --dport 60000:61000 -j ACCEPT" +      ]; +      tv.iptables.extra6.filter.Retiolum = [ +        "-s ${im.client.host.nets.retiolum.ip6.addr} -p udp --dport 60000:61000 -j ACCEPT" +      ]; +    })    ];  }  | 
