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

sshd: disable trigger limit for systemd socket #103946

Merged
merged 1 commit into from Jan 9, 2022

Conversation

lopsided98
Copy link
Contributor

Motivation for this change

When startWhenNeeded is enabled, a brute force attack on sshd will cause systemd to shut down the socket, locking out all SSH access to the machine. Setting TriggerLimitIntervalSec to 0 disables this behavior.

This has been observed on other distros as well, for example: https://bugs.archlinux.org/task/62248

cc @edolstra @infinisil @FRidh

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@stale
Copy link

stale bot commented Jun 3, 2021

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 3, 2021
Copy link
Member

@rycee rycee left a comment

Choose a reason for hiding this comment

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

I think this is worth merging. I actually believe I've encountered this in April:

…
Apr 13 00:50:39 natto systemd[1]: sshd.socket: Too many incoming connections (64), dropping connection.
Apr 13 00:50:39 natto systemd[1]: sshd.socket: Too many incoming connections (64), dropping connection.
Apr 13 00:50:39 natto systemd[1]: sshd.socket: Too many incoming connections (64), dropping connection.
Apr 13 00:50:40 natto systemd[1]: sshd.socket: Trigger limit hit, refusing further activation.
Apr 13 00:50:40 natto systemd[1]: sshd.socket: Failed with result 'trigger-limit-hit'.
Apr 13 00:50:40 natto systemd[1]: sshd.socket: Consumed 1min 3.131s CPU time, received 209.8G IP traffic, sent 9.8G IP traffic.
Apr 20 18:54:51 natto systemd[1]: Listening on SSH Socket.

I had physical access to the host on the 20th and could restart sshd.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jun 3, 2021
@SuperSandro2000
Copy link
Member

SuperSandro2000 commented Jun 5, 2021

@ofborg eval

@stale
Copy link

stale bot commented Jan 9, 2022

I marked this as stale due to inactivity. → More info

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 9, 2022
@lopsided98
Copy link
Contributor Author

I still use this patch and would like it to be merged.

@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 9, 2022
@SuperSandro2000
Copy link
Member

@ofborg eval

@SuperSandro2000
Copy link
Member

@lopsided98 can you rebase on master to fix the github actions?

When startWhenNeeded is enabled, a brute force attack on sshd will cause
systemd to shut down the socket, locking out all SSH access to the machine.
Setting TriggerLimitIntervalSec to 0 disables this behavior.
@SuperSandro2000
Copy link
Member

@ofborg test openssh

@SuperSandro2000 SuperSandro2000 merged commit a85f163 into NixOS:master Jan 9, 2022
@lopsided98 lopsided98 deleted the sshd-trigger-limit branch January 9, 2022 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants