Page MenuHomePhabricator

Ignore local SSH configuration
Needs ReviewPublic

Authored by joshuaspence on Jul 19 2017, 1:15 PM.
Tags
None
Referenced Files
F13091246: D18242.diff
Thu, Apr 25, 2:49 AM
Unknown Object (File)
Thu, Apr 11, 10:09 AM
Unknown Object (File)
Sat, Apr 6, 4:06 AM
Unknown Object (File)
Mar 23 2024, 6:55 AM
Unknown Object (File)
Feb 24 2024, 4:52 PM
Unknown Object (File)
Dec 25 2023, 5:00 AM
Unknown Object (File)
Nov 20 2023, 12:47 PM
Unknown Object (File)
Nov 18 2023, 4:58 PM
Subscribers

Details

Reviewers
epriestley
Group Reviewers
Blessed Reviewers
Summary

I have the home directory for the daemon user set to <phabricator>/support/empty, which is owned by root:root. For some unknown reason, ssh tries to create ~/.ssh, but only if the -F flag wasn't specified. From the source code:

ssh.c
/*
 * Now that we are back to our own permissions, create ~/.ssh
 * directory if it doesn't already exist.
 */
if (config == NULL) {
    r = snprintf(buf, sizeof buf, "%s%s%s", pw->pw_dir,
        strcmp(pw->pw_dir, "/") ? "/" : "", _PATH_SSH_USER_DIR);
    if (r > 0 && (size_t)r < sizeof(buf) && stat(buf, &st) < 0) {
        ssh_selinux_setfscreatecon(buf);
        if (mkdir(buf, 0700) < 0)
            error("Could not create directory '%.200s'.",
                buf);
        ssh_selinux_setfscreatecon(NULL);
    }
}

This diff passes -F /dev/null to ssh to prevent the ~/.ssh directory from being created. I also feel that intentionally ignoring any local SSH configuration makes the behavior of bin/ssh-connect much more predictable.

Test Plan

Ran bin/ssh-connect inside a cluster and saw less warnings.

Diff Detail

Repository
rP Phabricator
Branch
master
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 17737
Build 23817: Run Core Tests
Build 23816: arc lint + arc unit