summaryrefslogtreecommitdiffstats
path: root/tv/3modules
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2019-12-02 01:27:22 +0100
committertv <tv@krebsco.de>2019-12-02 01:32:43 +0100
commit95ec795edaefb5e1ba6b491554de5969b48ccf73 (patch)
tree3e53c45c1e9ff02ba3b29e92910e1cb34630a16d /tv/3modules
parent19af2530aaa0997c2c4cff68333b68df840ba8e7 (diff)
tv im: add mosh support
Diffstat (limited to 'tv/3modules')
-rw-r--r--tv/3modules/im.nix35
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"
+ ];
+ })
];
}