darksimpson / mercurial-server

Dockerized minimal mercurial-server based on Alpine Linux
2 stars 2 forks source link

`hg-ssh` execution as hg user fails #1

Open sschwarzer opened 5 years ago

sschwarzer commented 5 years ago

A friend of mine and I tried your container setup and ran into the problem that we weren't able to "log in" as hg. As it turned out, the file ms/src/mercurialserver/refreshauth.py (in line 56) creates an entry in hg's authorized_keys that has a command "hg-ssh <keyfile>". However, according to the hg-ssh manpage, hg-ssh takes a list of repository paths as arguments (e. g. from the manpage command="hg-ssh path/to/repo1 /path/to/repo2 ~/repo3 ~user/repo4").

After changing refreshauth.py to generate the command hg-ssh ~/repos/* the command execution still didn't work. However, it did after changing the base image of Alpine Linux to the current version 3.10.3 and using the hg-ssh installed with the Mercurial version 4.9.1. Alpine Linux 3.8, as currently listed in the Dockerfile on master, has Mercurial 4.6.1. We weren't able to find hg-ssh in the installed Mercurial 4.6.1.

Caveats:

I'm going to enter a pull request since we already fixed the problem in our clone and everything seems to work fine now on our side.

sschwarzer commented 5 years ago

Regarding the first caveat, I suspect that the hg-ssh contained in mercurial-server isn't compatible with the newer Mercurial version from the Alpine image. (hg-ssh imports modules from the Mercurial package.)