Make ssh to bmo not use proxy when on eduroam

This commit is contained in:
Torjus Håkestad 2024-09-09 12:43:29 +02:00
parent 85c5aa239a
commit 99d0e6cf50
3 changed files with 36 additions and 17 deletions

35
home/ssh/config.nix Normal file
View File

@ -0,0 +1,35 @@
{ pkgs, lib, ... }:
let
eduroam-active = pkgs.writeShellApplication {
name = "eduroam-active";
runtimeInputs = with pkgs; [
networkmanager
];
text = ''
nmcli -g GENERAL.STATE c s interface|grep -q -E '\bactiv'
'';
};
in
{
programs.ssh = {
enable = true;
controlMaster = "auto";
matchBlocks = {
"bmo.uio.no-on-eduroam" = lib.hm.dag.entryBefore [ "bmo.uio.no" ] {
match = "host bmo.uio.no exec \"nmcli -g GENERAL.STATE c s eduroam|grep -q -E '\\bactiv'\"";
hostname = "bmo.uio.no";
forwardAgent = false;
};
"bmo.uio.no" = {
setEnv = {
# TERM = "xterm-256color";
};
hostname = "bmo.uio.no";
forwardAgent = false;
proxyJump = "torjus@rlogin.uio.no";
};
};
};
}

View File

@ -1 +1 @@
{ imports = [ ./gunter.nix ]; }
{ imports = [ ./config.nix ]; }

View File

@ -1,16 +0,0 @@
{ pkgs, ... }:
{
programs.ssh = {
enable = true;
controlMaster = "auto";
matchBlocks."bmo.uio.no" = {
setEnv = {
# TERM = "xterm-256color";
};
hostname = "bmo.uio.no";
forwardAgent = false;
proxyJump = "torjus@rlogin.uio.no";
};
};
}