Page 1 of 2

SSH Key Upload?

Posted: 28 May 2020, 22:38
by Swandog
Hi there! I'm just going through the Studio setup and Hearts tutorial, and I wanted to upload an SSH key to use for authentication through sftp; but I couldn't find a way to do that. Is that not allowed?

Re: SSH Key Upload?

Posted: 29 May 2020, 02:31
by Victoria_La
What specifically does not work? You cannot create .ssh folder or get permission issues when uploading?

Re: SSH Key Upload?

Posted: 29 May 2020, 09:24
by Draasill
That's the first thing I tried, and indeed it's not permitted.

Tried with ssh-copy-id, then manually, IIRC creation of the .ssh directory is forbidden.

Re: SSH Key Upload?

Posted: 29 May 2020, 14:58
by Lymon Flowers
You can still do the following if you are using GNU/Linux :

Code: Select all

lftp -e "cd gamename ; put $files ; mirror -R img ; cd modules ; lcd modules ; mput *php ; quit" sftp://user:passwd.studio.boardgamearena.com 
Of any variation.

Also, you may consider using sshpass instead of lftp.

Re: SSH Key Upload?

Posted: 29 May 2020, 16:03
by Een
I confirm that as most sftp access utils allow to store the password, we haven't had many requests for this (it's only the second request that I remember) and haven't made it a priority to provide a way to upload keys in the studio.

Re: SSH Key Upload?

Posted: 29 May 2020, 16:57
by Draasill
I personnaly use :

Code: Select all

echo [password] | sshfs [user]@1.studio.boardgamearena.com:[gamepath] /home/user/mountpoint -o password_stdin
And to sync :

Code: Select all

rsync -c --delete -rzpP --exclude=.git /home/user/src/ /home/user/mountpoint/
And I even wrap this in a "inotify" loop to auto sync the code :

Code: Select all

while true; do inotifywait --exclude .git -e CLOSE_WRITE -r /home/user/src; sleep 1; rsync -c --delete -rzpP --exclude=.git /home/user/src/ /home/user/mountpoint/; done

Re: SSH Key Upload?

Posted: 20 September 2020, 00:26
by purge
Een wrote: 29 May 2020, 16:03 (it's only the second request that I remember)
I'll be number 3, then. Uploading a key would be the most helpful option for me.

Re: SSH Key Upload?

Posted: 20 September 2020, 18:51
by Matthijs Kooijman
I would also consider this helpful. I often use commandline tools, which often don't save passwords and don't allow specifying them non-interactively. (then again, I'm not an active developer on GBA, at least not yet, so count my request lightly)

Re: SSH Key Upload?

Posted: 05 October 2020, 22:26
by Elliot K
I'd also appreciate this feature.

You're already creating our home directories with some dotfiles that are owned by our user: .bashrc, .profile, .bash_logout. It should be fairly simple to add a .ssh directory to /etc/skel or whatever template you use for home directories. For security, though, you probably want to create .ssh as owned by 0:0 and .ssh/authorized_keys owned by the user. And people can specify extra options in authorized_keys, too, which may have security implications (see http://man.he.net/man5/authorized_keys). Maybe it's not so simple...

Re: SSH Key Upload?

Posted: 09 October 2020, 14:39
by mavit
Elliot K wrote: 05 October 2020, 22:26 And people can specify extra options in authorized_keys, too, which may have security implications (see http://man.he.net/man5/authorized_keys). Maybe it's not so simple...
I think all of these options tighten things that would otherwise be relaxed, but even so, it's probably best not to allow direct access to this file. Better to add a field for this to the Studio control panel which writes the `authorized_keys` file with the `restrict` option.