Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -U flag for customizing authorized keys file path #35

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

salva
Copy link

@salva salva commented Jun 9, 2016

commit 078846b
Author: Salvador Fandino [email protected]
Date: Thu Jun 9 16:00:37 2016 +0200

Allow authorized keys inside dirs with the sticky bit set

This allows one for instance, to run a temporary dropbear servers from
the /tmp directory, which is world writeable but has tipically the
sticky bit set.

commit 0197473
Author: Salvador Fandino [email protected]
Date: Wed Jun 8 18:15:13 2016 +0200

Add option -U for customizing authorized_keys path

This patch adds support for the new command line flag -U which allows
one to customize the location of the file containing the authorized
keys. This is usefull when running several unrelated and isolated SSH
services on one machine, using different sets of authentication keys.

The new -U flag accept both absolute and relative paths. When a
relative path is used it is appended to the user home directory.

Authentication fails when any intermediate directory between the user
home and the location of the file (both inclusive) is group or world
writeable.

When an absolute directory is given all the ancestor directories are
checked until some common parent between the authorized keys path and
the user home (up to the root directory) is reached.

For instance, if home is '/home/bar', and the authorized keys path
given is '/home/root/.ssh/authorized_keys', the objects checked are
'/home/root/.ssh/authorized_keys', '/home/root/.ssh', '/home/root'
and '/home'.

salva added 2 commits June 9, 2016 15:57
This patch adds support for the new command line flag -U which allows
one to customize the location of the file containing the authorized
keys. This is usefull when running several unrelated and isolated SSH
services on one machine, using different sets of authentication keys.

The new -U flag accept both absolute and relative paths. When a
relative path is used it is appended to the user home directory.

Authentication fails when any intermediate directory between the user
home and the location of the file (both inclusive) is group or world
writeable.

When an absolute directory is given all the ancestor directories are
checked until some common parent between the authorized keys path and
the user home (up to the root directory) is reached.

For instance, if home is '/home/bar', and the authorized keys path
given is '/home/root/.ssh/authorized_keys', the objects checked are
'/home/root/.ssh/authorized_keys', '/home/root/.ssh', '/home/root'
and '/home'.
This allows one for instance, to run a temporary dropbear servers from
the /tmp directory, which is world writeable but has tipically the
sticky bit set.
@bbros-dev
Copy link
Contributor

bbros-dev commented Jul 8, 2020

@mkj did you have any thoughts on this?

Interest arises because we'd like to be able to run rootless with the following file locations set at compile time, using the same convention as DROPBEAR_DEFAULT_CLI_AUTHKEY; if not starting with '/', then is relative to $(whoami)'s $HOME) :

  • *_PRIV_FILENAME
  • DROPBEAR_PIDFILE (compiled default)
  • SFTPSERVER_PATH

No reflection we don't need XDG knowledge built in.
Related and more general: It would be useful if the XDG convention shell environment variables were respected:

* ${XDG_CACHE_HOME}
* ${XDG_CONFIG_HOME}
* ${XDG_DATA_HOME}
* ${XDG_RUNTIME_DIR}

Thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants