feat(webserver/forgejo): set up SSH

This commit is contained in:
steveej 2024-06-12 22:22:46 +02:00
parent cd0835f6dc
commit ef016ac70a
2 changed files with 17 additions and 3 deletions

View file

@ -2,8 +2,9 @@
specialArgs, specialArgs,
hostAddress, hostAddress,
localAddress, localAddress,
httpPort ? 80, httpPort,
httpsPort ? 443, httpsPort,
forgejoSshPort,
autoStart ? false, autoStart ? false,
}: let }: let
domain = "www.stefanjunker.de"; domain = "www.stefanjunker.de";
@ -36,6 +37,7 @@ in {
networking.firewall.allowedTCPPorts = [ networking.firewall.allowedTCPPorts = [
httpPort httpPort
httpsPort httpsPort
forgejoSshPort
]; ];
sops.age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"]; sops.age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];
@ -247,9 +249,13 @@ in {
settings = { settings = {
service.DISABLE_REGISTRATION = true; service.DISABLE_REGISTRATION = true;
server.HTTP_ADDR = "127.0.0.1"; server.HTTP_ADDR = "127.0.0.1";
server.DISABLE_SSH = true; server.START_SSH_SERVER = true;
server.SSH_PORT = forgejoSshPort;
server.ROOT_URL = "https://forgejo.${domain}"; server.ROOT_URL = "https://forgejo.${domain}";
server.HTTP_PORT = 3001; server.HTTP_PORT = 3001;
# TODO: how do i get a 3072 length SSH key with the yubikey?
"ssh.minimum_key_sizes".RSA = 2048;
}; };
secrets = { secrets = {
oauth2.JWT_SECRET = lib.mkForce config.sops.secrets.FORGEJO_JWT_SECRET.path; oauth2.JWT_SECRET = lib.mkForce config.sops.secrets.FORGEJO_JWT_SECRET.path;
@ -318,6 +324,13 @@ in {
hostPort = httpsPort; hostPort = httpsPort;
protocol = "tcp"; protocol = "tcp";
} }
{
# forgejo ssh
containerPort = forgejoSshPort;
hostPort = forgejoSshPort;
protocol = "tcp";
}
]; ];
inherit hostAddress localAddress; inherit hostAddress localAddress;

View file

@ -101,6 +101,7 @@
httpPort = 80; httpPort = 80;
httpsPort = 443; httpsPort = 443;
forgejoSshPort = 2222;
}; };
syncthing = import ../../containers/syncthing.nix { syncthing = import ../../containers/syncthing.nix {