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

Disable SSH password logins by default #96

Merged
merged 1 commit into from
May 21, 2019
Merged

Disable SSH password logins by default #96

merged 1 commit into from
May 21, 2019

Conversation

bgilbert
Copy link
Contributor

For coreos/fedora-coreos-tracker#138. We don't support sshd_config fragments yet, so the only way to override this with Ignition is by writing a ConditionFirstBoot=true unit Before=sshd.service that runs sed over sshd_config. But it is possible to override it, so let's start testing with this configuration.

@@ -78,6 +78,14 @@ postprocess:
set -xeuo pipefail
sed -i 's/^AuthorizedKeysFile[[:blank:]]/#&/' /etc/ssh/sshd_config
echo -e '\n# Read authorized_keys fragments written by Ignition and Afterburn\nAuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys.d/ignition .ssh/authorized_keys.d/afterburn' >> /etc/ssh/sshd_config
# Disable SSH password logins by default
# Move to overlay once sshd_config fragments are supported
Copy link
Contributor

@ajeddeloh ajeddeloh May 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something that is coming to sshd?

Edit: I can't read backlog. https://bugzilla.mindrot.org/show_bug.cgi?id=2468#c8

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@ajeddeloh ajeddeloh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dustymabe
Copy link
Member

LGTM.. but this does make my head hurt when thinking about upgrading to f31 where the default config will change and also updating to sshd_config fragments when that is available. i.e. are our existing systems going to get the changes or are they going to keep this config as shipped?

@jlebon
Copy link
Member

jlebon commented May 21, 2019

i.e. are our existing systems going to get the changes or are they going to keep this config as shipped?

Hmm not sure I follow. It should be just like any other config changes, right? IOW, once fragments are supported, it should be safe to drop this snippet in favour of a fragment drop-in. The drop-in will be added on system updates, and unless users modified their sshd_config locally, the main config itself as well will be updated.

@bgilbert
Copy link
Contributor Author

Considering the cases:

  • If we're still carrying this postprocess fragment by F31 we'll update it for the Fedora changes. The net result should be:
    • no behavior change for users with unmodified configs (who will then get the new one), and
    • no behavior change for users with modified configs (who will keep the modified old one).
  • The key point about config fragments is that the user can use them to override our defaults, so
    • we might choose to continue putting our changes in sshd_config even when fragments become available.
    • If we choose to move our changes to a fragment,
      • we're fine if the user has not customized their sshd_config.
      • If the user removes our changes and we then move them to a fragment, we could end up overriding their customizations, which would be bad.

So if we want to move our changes to a fragment, we should probably do it before the stable release.

@bgilbert bgilbert merged commit 34cf112 into coreos:master May 21, 2019
@bgilbert bgilbert deleted the password branch May 21, 2019 18:16
dustymabe pushed a commit to jbtrystram/fedora-coreos-config that referenced this pull request Apr 19, 2024
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.

4 participants