Mailing List Archive

Request: Add XDG Base Directory paths as fallback locations
Hello. I'd like to preface this by saying that while this can be considered a feature request, I am more than happy to contribute a patch myself that would deliver this.

I am aware that in the past there has been some hostility towards the suggestion to adhere to the XDG Base Directory Specification for OpenSSH and its various configuration files. For the record, I am not asking for any of the paths to change, nor for the removal of the traditional ~/.ssh directory; I understand that many people still expect this directory to exist for most conventional (typically non-desktop) setups, and it would not be wise to make breaking changes that forego this expectation.

Instead, I ask that the spec be considered in order to provide a set of alternative/fallback paths that OpenSSH may search for in the absence of the typical ~/.ssh directory. As a desktop user still making use of OpenSSH, I greatly prefer being able to adhere to the spec and keep the amount of dotfiles and directories in $HOME minimal. Hence, I would like to at least have the option to move files from the ~/.ssh directory into their respective compliant paths, and have OpenSSH search for those by default, without needing either complex aliases or wrapper scripts with extra usage flags or configuration at the root level. OpenSSH itself would not need to create these directories either, as it may simply prioritise and continue to create the existing ~/.ssh directory.

The approach I'm suggesting is one that plenty of long-standing software has taken up in order to provide the opt-in approach of XDGBDS support. Notably, Git provides such a fallback option in $XDG_CONFIG_HOME/git/config in place of the default ~/.gitconfig, as does GNU Emacs among others. More recently, even Bash has warmed up to the idea despite initially being opposed to the suggestion to change the locations of ~/.bash_profile and ~/.bashrc, as can be seen at https://savannah.gnu.org/support/?108134.

As I said, I am more than happy to provide this myself in a patch or pull request if the developers are okay with the approach as I'm suggesting it. At the end of the day, I don't wish to burden the team itself with something that would be rather low-priority either way.

Kind regards,
90
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Adding XDG BDS paths *as fallbacks only*, not replacing ~/.ssh [ In reply to ]
Since I can't help but feel like my previous email is already being flat-out ignored, I would just like to reiterate:

- I am not asking for ~/.ssh to stop being used.
- I am happy to contribute this myself with the blessing of the devs.

All I would like is to be able to move files within ~/.ssh to their appropriate XDG paths and have OpenSSH continue to find these files without me needing to explicitly configure it to do so with either command options or root access for sshd. I would think this is a perfectly reasonable alternative to ask for, especially if the requirement is to prioritise the legacy ~/.ssh path for backwards compatibility.

Would this please at least be taken into consideration? Thank you.

1 February 2024 at 15:27, hi@90.gripe wrote:

>
> Hello. I'd like to preface this by saying that while this can be considered a feature request, I am more than happy to contribute a patch myself that would deliver this.
>
> I am aware that in the past there has been some hostility towards the suggestion to adhere to the XDG Base Directory Specification for OpenSSH and its various configuration files. For the record, I am not asking for any of the paths to change, nor for the removal of the traditional ~/.ssh directory; I understand that many people still expect this directory to exist for most conventional (typically non-desktop) setups, and it would not be wise to make breaking changes that forego this expectation.
>
> Instead, I ask that the spec be considered in order to provide a set of alternative/fallback paths that OpenSSH may search for in the absence of the typical ~/.ssh directory. As a desktop user still making use of OpenSSH, I greatly prefer being able to adhere to the spec and keep the amount of dotfiles and directories in $HOME minimal. Hence, I would like to at least have the option to move files from the ~/.ssh directory into their respective compliant paths, and have OpenSSH search for those by default, without needing either complex aliases or wrapper scripts with extra usage flags or configuration at the root level. OpenSSH itself would not need to create these directories either, as it may simply prioritise and continue to create the existing ~/.ssh directory.
>
> The approach I'm suggesting is one that plenty of long-standing software has taken up in order to provide the opt-in approach of XDGBDS support. Notably, Git provides such a fallback option in $XDG_CONFIG_HOME/git/config in place of the default ~/.gitconfig, as does GNU Emacs among others. More recently, even Bash has warmed up to the idea despite initially being opposed to the suggestion to change the locations of ~/.bash_profile and ~/.bashrc, as can be seen at https://savannah.gnu.org/support/?108134.
>
> As I said, I am more than happy to provide this myself in a patch or pull request if the developers are okay with the approach as I'm suggesting it. At the end of the day, I don't wish to burden the team itself with something that would be rather low-priority either way.
>
> Kind regards,
>
> 90
>
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Adding XDG BDS paths *as fallbacks only*, not replacing ~/.ssh [ In reply to ]
On Fri, 2 Feb 2024, 90 wrote:

> Since I can't help but feel like my previous email is already being flat-out ignored, I would just like to reiterate:
>
> - I am not asking for ~/.ssh to stop being used.
> - I am happy to contribute this myself with the blessing of the devs.
>
> All I would like is to be able to move files within ~/.ssh to their appropriate XDG paths and have OpenSSH continue to find these files without me needing to explicitly configure it to do so with either command options or root access for sshd. I would think this is a perfectly reasonable alternative to ask for, especially if the requirement is to prioritise the legacy ~/.ssh path for backwards compatibility.
>
> Would this please at least be taken into consideration? Thank you.

No, sorry. This has been discussed extensively before, leading to the
most uncivil discussion our bugtracker has ever seen and the only
permanent user bans I've ever had to implement. Myself and the other
developers have zero desire to relitigate this and no intention of
implementing it.

TLDR in case you can't find the past discssion: ssh is not a desktop
program and predates the XDG specifications by two decades. Adding
additional configuration paths is confusing and potentially risky
for .ssh as, quite unlike usual "desktop" apps, it *grants system
access* and having its configuration smeared across several possible
paths makes managing this more confusing and brittle.

-d
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Adding XDG BDS paths *as fallbacks only*, not replacing ~/.ssh [ In reply to ]
2 February 2024 at 12:37, "Damien Miller" <djm@mindrot.org> wrote:

>
> No, sorry. This has been discussed extensively before, leading to the
>
> most uncivil discussion our bugtracker has ever seen and the only
>
> permanent user bans I've ever had to implement. Myself and the other
>
> developers have zero desire to relitigate this and no intention of
>
> implementing it.
>
> TLDR in case you can't find the past discssion: ssh is not a desktop
>
> program and predates the XDG specifications by two decades. Adding
>
> additional configuration paths is confusing and potentially risky
>
> for .ssh as, quite unlike usual "desktop" apps, it *grants system
>
> access* and having its configuration smeared across several possible
>
> paths makes managing this more confusing and brittle.
>
> -d
>

I was afraid of this, but I understand that this is very much a sore point for the dev team and I won't try to press further with proper compliance in that case.

At the very least, I would like to ask for another alternative to be able to at least "emulate" XDG support. Some programs provide an alternative environment variable of their own which may be used to relocate the entire directory in one go to some alternative path. GNU Privacy Guard, for example, provides a $GNUPGHOME variable which may be used to relocate ~/.gnupg to some place like $XDG_DATA_HOME/gnupg. Hence, would it be possible to provide an equivalent $SSH_HOME with which to relocate the entire directory to one XDG-compliant path if the user chooses to do so? At the very least, the files wouldn't then need to be spread out across multiple places.

Kind regards.
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev
Re: Adding XDG BDS paths *as fallbacks only*, not replacing ~/.ssh [ In reply to ]
On 02/02/2024 15:25, 90 wrote:
> to relocate the entire directory to one XDG-compliant path if the
> user chooses to do so?

How about this?

mv ~/.ssh $XDG_DATA_HOME/ssh
ln -s $XDG_DATA_HOME/ssh ~/.ssh

This has the added advantage of not having to remember to set an
environment variable in every shell (and which might be dropped by
utilities like "sudo")
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@mindrot.org
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev