aboutsummaryrefslogtreecommitdiff

SSH Auth to Gogs or Github

Small program to call out to a (patched) Gogs server and pull SSH keys from the API.

This should work for Github as well with the endpoint adjusted.

The main utility of this program is to be used to provide SSH keys to a Unix server without the need to manually place them on it.

Installing

go get git.stridet.com/Stridet/sshauth
sudo install -m 555 -o root -g bin $GOPATH/bin/sshauth /usr/local/bin/

And then in /etc/ssh/sshd_config

AuthorizedKeysCommand sshauth -e https://git.stridet.com/api/v1 -u %u

See: http://man.openbsd.org/sshd_config#AuthorizedKeysCommand for more information.

Gogs Patch

Used on commit 2c3e2b701e012294d457937e6bfbffd63dd8ae4f it should work as expected with git apply and go build

Notes

This obviously requires that your server have a working internet connection. Without it it'll just time out and you'll be locked out. This usually isn't a problem if you're using SSH though.

If you have a highly restrictive firewall you're going to want to be sure to set up a special user and allow outbound network access.