Yesterday I reinstalled my main server, switching from ubuntu to nixos. The only major issue I have now is accessing my Gitea server, because it runs inside a docker container.
The usual process to allow ssh access to Gitea would be to create a git user, mount its authorized_keys to the container and place a mock Gitea binary in /usr/local/bin that redirects to ssh in the container.
I haven’t found a way to create such a file in /usr/local/bin with my nixos configuration, so I tried a different approach. (SSH Shell with AuthorizedKeysCommand)
services.openssh.extraConfig = ''
Match User git
AuthorizedKeysCommandUser git
AuthorizedKeysCommand /usr/bin/ssh -p 2222 -o StrictHostKeyChecking=no git@127.0.0.1 /usr/local/bin/gitea keys -c /data/gitea/conf/app.ini -e git -u %u -t %t -k %k
''
With that the ssh connection always asks for a password, so it also doesn’t work.
The Gitea configuration and data is completely copied from the old server, I haven’t changed anything for the container.
How could I set up SSH forwarding for my Gitea server?