KALLITHEA_EXTRAS environment variable missing

Edmund Wong ewong at crazy-cat.org
Wed Dec 25 01:52:33 UTC 2019


Mads Kiilerich wrote:
> On 12/24/19 7:49 AM, Ed Wong wrote:
>> Hi,
>>
>> Just managed to work around the database unicode issue and
>> could both clone and push via the ssh:// url; however,
>> pushing to a git repository gave me the following 'error':
>>
>> Total 3 (delta 1), reused 0 (delta 0)
>> remote: Traceback (most recent call last):
>> remote:   File "hooks/post-receive", line 38, in <module>
>> remote:     main()
>> remote:   File "hooks/post-receive", line 34, in main
>> remote:
>> sys.exit(kallithea.lib.hooks.handle_git_post_receive(repo_path,
>> git_stdin_lines))
>> remote:   File
>> "/var/www/environments/kalivenv/lib/python2.7/site-packages/kallithea/lib/hooks.py",
>>
>> line 343, in handle_git_post_receive
>> remote:     baseui, repo = _hook_environment(repo_path)
>> remote:   File
>> "/var/www/environments/kalivenv/lib/python2.7/site-packages/kallithea/lib/hooks.py",
>>
>> line 310, in _hook_environment
>> remote:     extras = get_hook_environment()
>> remote:   File
>> "/var/www/environments/kalivenv/lib/python2.7/site-packages/kallithea/lib/utils2.py",
>>
>> line 538, in get_hook_environment
>> remote:     raise Exception("Environment variable KALLITHEA_EXTRAS not
>> found")
>> remote: Exception: Environment variable KALLITHEA_EXTRAS not found
>> To seavcs:repos/infrastructure/testgit2
>>     887eb3c..19b77cd  master -> master
>>
>> Apparently, it did save the push.
>>
>> I've looked at the documentation; but haven't yet seen the mention
>> of the KALLITHEA_EXTRAS requirement.  Looking at the code,
>> I'm not exactly sure what fields are required in the json
>> structure.
> 
> KALLITHEA_EXTRAS is used internally. The user invokes "kallithea-cli
> ssh-serve" when connecting through ssh, and that sets this environment
> variable before calling out to the git executable ... and when git
> invoke the hooks and call back into Kallithea code in a grand-child
> process, it can read the environment variable and report correctly who
> is doing what.
> 
> It seems like you somehow end up invoking git directly when you ssh,
> instead of hitting the kallithea-cli that should have been installed in
> your ~/.ssh/authorized_keys ?

I think I know what is wrong.  The problem is I also added the old
ssh-rsa entries to the authorized_keys file in the .ssh so that
I could also ssh into the system as the Kallithea user.  Apparently,
that throws off the system.  My bad.

> 
> I guess we should make the hooks handle a missing KALLITHEA_EXTRAS in a
> more elegant way ...

Would it be more appropriate to scan the actual authorized_keys to
ensure it is in the proper formatting?

i.e.
ssh-rsa <key 1 blah...>
no-pty,no-port-forwarding... ssh-rsa <key 2 blah>

to

no-pty,no-port-forwarding... ssh-rsa <key 1 blah>
no-pty,no-port-forwarding... ssh-rsa <key 2 blah>

or add a flag at the beginning to tell kallithea to ignore the said
line?

Thanks

Edmund



More information about the kallithea-general mailing list