From ed3fd9a36f174d8001b1693fe4d0e2761febeb56 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Sun, 11 Feb 2024 22:06:12 +0530 Subject: hosts/lia/sshfwd/lia.sinanmohd.com: init --- hosts/kay/modules/dns/sinanmohd.com.zone | 4 +++- hosts/lia/modules/sshfwd.nix | 18 ++++++++++++++++-- hosts/lia/secrets.yaml | 5 +++-- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/hosts/kay/modules/dns/sinanmohd.com.zone b/hosts/kay/modules/dns/sinanmohd.com.zone index 05f7cef..5833a2a 100644 --- a/hosts/kay/modules/dns/sinanmohd.com.zone +++ b/hosts/kay/modules/dns/sinanmohd.com.zone @@ -2,7 +2,7 @@ $ORIGIN sinanmohd.com. $TTL 2d @ IN SOA ns1 sinan ( - 2024020840 ; serial + 2024021100 ; serial 2h ; refresh 5m ; retry 1d ; expire @@ -24,4 +24,6 @@ git IN CNAME @ bin IN CNAME @ static IN CNAME @ +lia IN A 65.0.3.127 + _acme-challenge IN NS ns1 diff --git a/hosts/lia/modules/sshfwd.nix b/hosts/lia/modules/sshfwd.nix index dac2d71..f5f7526 100644 --- a/hosts/lia/modules/sshfwd.nix +++ b/hosts/lia/modules/sshfwd.nix @@ -2,7 +2,9 @@ mkFwdSrv = { local_port, remote_port, + remote_user, remote ? "sinanmohd.com", + ssh_port ? 22, key ? config.sops.secrets."sshfwd/${remote}".path, }: { "sshfwd-${toString local_port}-${remote}:${toString remote_port}" = { @@ -18,7 +20,7 @@ path = [ pkgs.openssh ]; script = '' echo -n "Forwarding port ${toString local_port}" - exec ssh -N lia@${remote} \ + exec ssh -N ${remote_user}@${remote} -p ${toString ssh_port} \ -R 0.0.0.0:${toString remote_port}:127.0.0.1:${toString local_port} \ -i ${key} ''; @@ -26,8 +28,20 @@ }; in { sops.secrets."sshfwd/sinanmohd.com" = {}; + sops.secrets."sshfwd/lia.sinanmohd.com" = {}; environment.systemPackages = with pkgs; [ openssh ]; systemd.services - = mkFwdSrv { local_port = 22; remote_port = 2222; }; + = (mkFwdSrv { + local_port = 22; + remote_user = "lia"; + remote_port = 2222; + }) // + (mkFwdSrv { + local_port = 22; + remote_port = 22; + ssh_port = 23; + remote_user = "root"; + remote = "lia.sinanmohd.com"; + }); } diff --git a/hosts/lia/secrets.yaml b/hosts/lia/secrets.yaml index facb577..b2b5218 100644 --- a/hosts/lia/secrets.yaml +++ b/hosts/lia/secrets.yaml @@ -1,5 +1,6 @@ sshfwd: sinanmohd.com: ENC[AES256_GCM,data:ZB2qbUA4+AcYlIY6IaPf9aUdMV0ltdKveqVSNS2Nhq8h6kWheqWiaXgIK6vuN7oDHKomgVXWaVdxTf6OFvFQHCHMMqtm0KfvSJW+cdORpfZkEZuji5Ob/yQiNllyS8oAw9iT5YdyifLi7XkfD+dHbt+XWLQCMFPirJ8Lz6ynTYxV+N7Pu7yOhfCzPDYfqexW7Ymrjk0PI32OVgo+sE0obnASGW645dP4ydKOZM5xx9NGr/Oao2W5C61qdr2gUCoYQKZXkfItGRfCuWuCeh0ZmbxumS6Q1WeWUW09SY5NN24025TBoZgE+UdJIXuczAQy5wzpXYsDWwBXNod4gAhe76YgLydlYBpBHe6xN6OBgCewHkjCGkirHawmbYxkmJ40L6/lMFPjRmMV7yhj94Vsyx7NAW1H8yKVE/9typXUrIyxbxAOGrwy0TjlGYogAcZ7YYZ+ipmkqNlQ1pliA2Kha+2ZzPG0hV8NKhydNr0cz5ylfL4cQaAXxxg6YHOUYL0DGbfMXMpZKTt47TJcY72RWDaUr2RsmhJ+k2vNBDY3I01n9syWnlk80h2bs1ILJ5Ad3PP8Em8yGaXJLM+3,iv:VoDyy+h3UHL0YJPJ7rbgLTZZzIPCJTD8yBPXNxWjHqo=,tag:zGQXrE066SDMCwgZpC9/Pg==,type:str] + lia.sinanmohd.com: ENC[AES256_GCM,data:d2lDCckpWwMtGu8Ra249NnUVt4OtP7JqtVZG8YD9oLtLmAbTi4kLZnYU+0EN7Fs/Z6dxNaSkYLnvJQO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75I8K1cBEjUvrevwXmPeYvG+iWYyZkYENx7gGCNGyHpdSEEYBL4QdsgkbQWJDRQ=,iv:t825d9WWByfMZXwrtKs2JBFVoEAoAXfYOBmlhWN45hU=,tag:ZVPiwtKwhdYzh4IQyzeb9Q==,type:str] sops: kms: [] gcp_kms: [] @@ -24,8 +25,8 @@ sops: RG9hL2hlYjdaYTVJWVFlSE4xN1poUHcKe4BPaVEyc3W1hyu0jOQcEdZ1kl2aQLgZ fHDs4kDeCcfJI/s5Cb/YD3cIp7HB6FBoe7LHiNiJbyJGR0wJecLqxg== -----END AGE ENCRYPTED FILE----- - lastmodified: "2024-02-11T15:56:54Z" - mac: ENC[AES256_GCM,data:H7GBDYCB/T7tM8hGOL0RMbS5NH2eNC4SJvoZUNS9WWx7gu60bn1qIkDda9aInZxZsN1ocNQDefG548pC598EsNTIeoqGWkXVdScFSXx4R+5mSmMHV5KgoPP8z+vUQ81gXsgh51hSCVUfhKshL6TccfFB4/u4kjGp2UcAAVAAEtQ=,iv:MBoCdOapNr36PeNt5GND40tcSHC1aa66JG36dPCDN+A=,tag:GDBXs2wlSAj3Bf+/XkO/2A==,type:str] + lastmodified: "2024-02-11T16:35:02Z" + mac: ENC[AES256_GCM,data:nsLGZ5wvmj25COI4G3BsS8dzwpa59zs85Ztm4eZaXITAdMjEgfmHR8eHItzchSijH+PRaJH+pZZNN3kpkDeujGYTiOzfc1t2dGA3Vx6XACCNaZs35vmvbB45VV07a5mjw/Wy3k0ZDOcRCHXQOQccaPshUMzU7FkXudm7PkvoyTM=,iv:Rgfaab+egy2/AwlM6ZMVA+7E5cqb/r9mI4ptMit/SKo=,tag:LVSYkTzTxBRAIFxDkB1asA==,type:str] pgp: [] unencrypted_suffix: _unencrypted version: 3.8.1 -- cgit v1.2.3