On 10/15/2014 11:01 PM,
assaf...@gmail.com wrote:
> Hello,
>
> I've seen that 'gitolite' has been successfully deployed on setups
> with large number of projects/repositories.
>
> I'd like to ask if there's any practical limit (or known problems)
> with large number of keys, managed through gitolite +
> 'authorized_keys'.
Once you cross about 5000 keys the people whose keys are at the end of
the authkeys file will see some slowdown, like a second or so.
I usually call this the "ssh linear scan bottleneck" or some such
phrase.
> I know that technically this is an SSH server issue, but I'm hoping
> people in this forum has real-world experience with such setups.
So far, no one has complained :)
> I'm looking at ~4K repositories, and ~10K keys (that is: ~10K 'pub'
> files in "keydir").
Benchmark it with 10k keys on your kit. You don't need to do this on a
gitolite account, and you don't have to create 10k keys. Create 5 keys,
replicate key 1 10000 times, then insert key 2 at line 2500, key 3 at
5000, key 4 at 7500, and key 5 at 10000.
Then run "ssh ... pwd" and time it for each key. For best results, time
it on the server also. I suspect on a busy server where it's already in
cache this won't matter so much
> Would such a setup work? (and work efficiently?)
> The number of keys is expected to grow, perhaps even to 20K - would
> that present a practical problem?
You'd need to benchmark it as I indicated above but as things stand
right now it will be an issue.
There are two possible mitigations to this, both referenced in [1]
below, and both require openssh 6.2 at least.
This version of ssh has a feature whereby ssh will run a command in
order to get the list of authorized keys, falling back to
~/.ssh/authorized_keys if the list does not contain the user's offered
key.
1. We use that feature to create a "mru" list of users so that only
about a few thousand who are active will be in it.
2. The second solution is to patch ssh -- patch is in that email.
Jason Donenfeld sent that patch to the ssh folks but I suppose they
didn't take it. Once this patch was applied, your
"AuthorizedKeysCommand" program would simply look up the right
pubkey based on the reveived fingerprint (trivial to maintain a
database of such) and offer only that key.
That makes it constant time access for all the users, all the time.
For the moment I'd go with solution 1. If you need help with that I'd
be happy to write the code, or if you write it please send it in and
we'll put it in contrib.
> I'm asking about both the gitolite administration POV,
> and from the user POV when running 'git clone' or 'git push'.
I've only been speaking from the "user" pov above.
For the admin, well since gitolite allows you to put keys in
subdirectories, I suppose that helps, not having 20k keys in one
directory.
Every gitolite-admin push will result in all the keys being
re-processed. If your admins make far more frequent changes to access
rights than key changes, that's a lot of waste. I'd be happy to look at
optimising that, so gitolite does not do that needlessly (i.e., not
recreate the authkeys file when the push did not touch "keydir").
Actually I might do that anyway; it looks like it can't be more than a
couple lines of code...
regards
sitaram
[1]:
https://groups.google.com/forum/#!searchin/gitolite/jason$20donenfeld/gitolite/ya-YVHi_YYg/wQwKO1izBZwJ