Commit Graph

12625 Commits

Author SHA1 Message Date
djm@openbsd.org 4de80ff4e6
upstream: split PerSourcePenalties address tracking. Previously it
used one shared table and overflow policy for IPv4 and IPv6 addresses, now it
will use separate tables and optionally different overflow policies.

This prevents misbehaviour from IPv6 addresses (which are vastly easier
to obtain many of) from affecting IPv4 connections and may allow for
stricter overflow policies.

ok deraadt@

OpenBSD-Commit-ID: 12637ed0aa4d5f1f3e702da42ea967cbd8bfdfd9
2024-06-13 08:36:41 +10:00
jmc@openbsd.org 06ab4c6931
upstream: do not mark up "(default: 20ms)";
OpenBSD-Commit-ID: 54151ecdecfa1b67dcdda4fd24826ef6e2148ad4
2024-06-13 08:36:40 +10:00
djm@openbsd.org cfe243cd9f
upstream: reap preauth net child if it hangs up during privsep message
send, not just message receive

OpenBSD-Commit-ID: 02a093f4ab4f8f83f0cd1ea2bb35b9ca420448f0
2024-06-11 12:55:20 +10:00
djm@openbsd.org b0a711c00b
upstream: fix PIDFILE handling, broken for SUDO=doas in last commit
here

OpenBSD-Regress-ID: 96fec579af228f87a036e94801eb294af9074625
2024-06-11 12:02:37 +10:00
djm@openbsd.org 90fb801e2d
upstream: reap the pre-auth [net] child if it hangs up during privsep
message sending, not just receiving

OpenBSD-Commit-ID: f7341605bf08c4c15830910446e6775323f2f8cb
2024-06-11 12:01:43 +10:00
djm@openbsd.org ef878d5879
upstream: a little more RB_TREE paranoia
OpenBSD-Commit-ID: 8dc2fd21eebd8830c4a4d25461ac4fe228e11156
2024-06-11 11:26:53 +10:00
djm@openbsd.org fc4e96b217
upstream: fix off-by-one comparison for PerSourcePenalty
OpenBSD-Commit-ID: af4f5d01c41ef870b23e55655bfbf73474a6c02b
2024-06-11 11:26:52 +10:00
djm@openbsd.org 82c836df4f
upstream: move tree init before possible early return
OpenBSD-Commit-ID: 72e2c5b69f151c08a7c5bf5ad929b97a92c273df
2024-06-11 11:26:52 +10:00
djm@openbsd.org a2300f015c
upstream: update to mention that PerSourcePenalties default to
being enabled and document the default values for each parameter.

OpenBSD-Commit-ID: b981288bddfb097aad269f62df4081c688ce0034
2024-06-11 11:26:51 +10:00
djm@openbsd.org 41987efd35
upstream: reap the [net] child if it hangs up while writing privsep
message payloads, not just the message header

OpenBSD-Commit-ID: 24dbd400aa381ac96be7ed2dd49018487dfef6ce
2024-06-11 11:26:51 +10:00
djm@openbsd.org 6211aa085f
upstream: log waitpid() status for abnormal exits
OpenBSD-Commit-ID: b317930e06b51819c1a2bc6a4359764fecfb1c2d
2024-06-11 11:26:50 +10:00
djm@openbsd.org a59634c7ad
upstream: correct error message
OpenBSD-Commit-ID: 581f60f73099083392887206860229ab104620ed
2024-06-11 11:26:50 +10:00
deraadt@openbsd.org fa7d7a667f
upstream: avoid shadowing issues which some compilers won't accept
ok djm

OpenBSD-Commit-ID: 1e89572397dda83433d58c4fa6333a08f51170d4
2024-06-11 11:26:49 +10:00
jmc@openbsd.org 3ad4cd9eec
upstream: escape the final dot at eol in "e.g." to avoid double
spacing;

OpenBSD-Commit-ID: 0a9fb10bc9f7d577afe2da3f498a08bc431115b9
2024-06-11 11:26:49 +10:00
djm@openbsd.org 0e0c69761a
upstream: enable PerSourcePenalties by default.
ok markus

NB. if you run a sshd that accepts connections from behind large NAT
blocks, proxies or anything else that aggregates many possible users
behind few IP addresses, then this change may cause legitimate traffic
to be denied.

Please read the PerSourcePenalties, PerSourcePenaltyExemptList and
PerSourceNetBlockSize options in sshd_config(5) for how to tune your
sshd(8) for your specific circumstances.

OpenBSD-Commit-ID: 24a0e5c23d37e5a63e16d2c6da3920a51078f6ce
2024-06-07 06:26:15 +10:00
djm@openbsd.org bd1f74741d
upstream: mention that PerSourcePenalties don't affect concurrent
in-progress connections.

OpenBSD-Commit-ID: 20389da6264f2c97ac3463edfaa1182c212d420c
2024-06-07 06:26:15 +10:00
djm@openbsd.org 9774b93857
upstream: regress test for PerSourcePenalties
OpenBSD-Regress-ID: a1af13d411b25a727742644459d26480b9a1b0f1
2024-06-07 05:54:32 +10:00
djm@openbsd.org b8ebd86cef
upstream: make sure logs are saved from sshd run via start_sshd
OpenBSD-Regress-ID: de4ef0e32e3ab85ff3a6c36eb08d1909c0dd1b4a
2024-06-07 05:54:15 +10:00
djm@openbsd.org d7b2070bda
upstream: simplify
OpenBSD-Regress-ID: 50316e0d1ae0c0a057a45af042253e54ce23d11c
2024-06-07 05:54:14 +10:00
djm@openbsd.org e6ea3d2245
upstream: prepare for PerSourcePenalties being enabled by default
in future

OpenBSD-Regress-ID: 5236c6d1c823997aac5a35e2915da30f1903bec7
2024-06-07 05:52:59 +10:00
djm@openbsd.org c0cb3b8c83
upstream: disable stderr redirection before closing fds
OpenBSD-Commit-ID: d42cb895ee4542098050367fc35321c9303f003a
2024-06-07 05:52:50 +10:00
djm@openbsd.org 81c1099d22
upstream: Add a facility to sshd(8) to penalise particular
problematic client behaviours, controlled by two new sshd_config(5) options:
PerSourcePenalties and PerSourcePenaltyExemptList.

When PerSourcePenalties are enabled, sshd(8) will monitor the exit
status of its child pre-auth session processes. Through the exit
status, it can observe situations where the session did not
authenticate as expected. These conditions include when the client
repeatedly attempted authentication unsucessfully (possibly indicating
an attack against one or more accounts, e.g. password guessing), or
when client behaviour caused sshd to crash (possibly indicating
attempts to exploit sshd).

When such a condition is observed, sshd will record a penalty of some
duration (e.g. 30 seconds) against the client's address. If this time
is above a minimum threshold specified by the PerSourcePenalties, then
connections from the client address will be refused (along with any
others in the same PerSourceNetBlockSize CIDR range).

Repeated offenses by the same client address will accrue greater
penalties, up to a configurable maximum. A PerSourcePenaltyExemptList
option allows certain address ranges to be exempt from all penalties.

We hope these options will make it significantly more difficult for
attackers to find accounts with weak/guessable passwords or exploit
bugs in sshd(8) itself.

PerSourcePenalties is off by default, but we expect to enable it
automatically in the near future.

much feedback markus@ and others, ok markus@

OpenBSD-Commit-ID: 89ded70eccb2b4926ef0366a4d58a693de366cca
2024-06-07 03:35:40 +10:00
Damien Miller 916b0b6174
whitespace 2024-06-07 03:31:02 +10:00
deraadt@openbsd.org 49b55e4418
upstream: enable -fret-clean on amd64, for libc libcrypto ld.so
kernel, and all the ssh tools.  The dynamic objects are entirely ret-clean,
static binaries will contain a blend of cleaning and non-cleaning callers.

OpenBSD-Commit-ID: 112aacedd3b61cc5c34b1fa6d9fb759214179172
2024-06-07 03:18:44 +10:00
Damien Miller cc80d51d03
remove PRIVSEP macros for osx 2024-06-05 02:21:52 +10:00
djm@openbsd.org 8785491123
upstream: be really strict with fds reserved for communication with the
separate sshd-session process - reserve them early and fatal if we can't
dup2(2) them later. The pre-split fallback to re-reading the configuration
files is not possible, so sshd-session absolutely requires the fd the
configuration is passed over to be in order.

ok deraadt@

OpenBSD-Commit-ID: 308a98ef3c8a6665ebf92c7c9a0fc9600ccd7065
2024-06-01 17:05:09 +10:00
Damien Miller f1c8918cb9
depend 2024-05-31 19:12:26 +10:00
Damien Miller 94b4866cb1
rename need_privsep to need_chroot
privsep is mandatory, chroot is optional (disabled when running
sshd as non-root)
2024-05-31 19:11:14 +10:00
Damien Miller e68a95142e
remove remaining use_privsep mention 2024-05-31 19:05:34 +10:00
djm@openbsd.org b21d271f65
upstream: warn when -r (deprecated option to disable re-exec) is
passed

OpenBSD-Commit-ID: 73145ef5150edbe3ce7889f0844ed8fa6155f551
2024-05-31 19:04:12 +10:00
djm@openbsd.org a4b5bc246c
upstream: typos
OpenBSD-Commit-ID: edfa72eb06bfa65da30fabf7d2fe76d2d33f77bf
2024-05-31 19:04:11 +10:00
djm@openbsd.org 8054b90698
upstream: don't need sys/queue.h here
OpenBSD-Commit-ID: dd137396828171eb19e4911581812ca58de6c578
2024-05-27 11:55:15 +10:00
naddy@openbsd.org 210d423973
upstream: remove references to SSH1 and DSA server keys
OpenBSD-Commit-ID: 57cc1c98d4f998981473734f144b904af7d178a2
2024-05-27 11:55:03 +10:00
jsg@openbsd.org f0b9261d7f
upstream: remove unused struct fwd_perm_list, no decl with complete
type ok djm@

OpenBSD-Commit-ID: 416fb3970b7e73c76d2963c4f00cf96f2b2ee2fb
2024-05-27 11:55:02 +10:00
naddy@openbsd.org 2477a98c3e
upstream: Do not pass -Werror twice when building with clang.
OpenBSD-Commit-ID: 5f378c38ad8976d507786dc4db9283a879ec8cd0
2024-05-27 11:55:01 +10:00
miod@openbsd.org 435844f567
upstream: Do not pass -Werror if building with gcc 3, for asn1.h
and bio.h cause (admittedly bogus) warnings with gcc 3.

OpenBSD-Commit-ID: fb39324748824cb0387e9d67c41d1bef945c54ea
2024-05-27 11:54:43 +10:00
djm@openbsd.org fc5dc09283
upstream: this test has been broken since 2014, and has been
testing the same key exchange algorithm repeatedly instead of testing all of
them. Spotted by nreilly AT blackberry.com in bz3692

Who broke the test? me.

OpenBSD-Regress-ID: 48f4f5946276f975667141957d25441b3c9a50e2
2024-05-22 14:21:50 +10:00
anton@openbsd.org fd4816791b
upstream: Add missing kex-names.c source file required since the
ssh split.

OpenBSD-Regress-ID: ca666223f828fc4b069cb9016bff1eb50faf9fbb
2024-05-22 14:21:50 +10:00
naddy@openbsd.org beccb7319c
upstream: remove duplicate copy of relink kit for sshd-session
OpenBSD-Commit-ID: 6d2ded4cd91d4d727c2b26e099b91ea935bed504
2024-05-22 14:21:38 +10:00
jsg@openbsd.org dcd79fa141
upstream: remove prototypes with no matching function; ok djm@
OpenBSD-Commit-ID: 6d9065dadea5f14a01bece0dbfe2fba1be31c693
2024-05-22 14:21:13 +10:00
jsg@openbsd.org 6454a05e7c
upstream: remove externs for removed vars; ok djm@
OpenBSD-Commit-ID: f51ea791d45c15d4927eb4ae7d877ccc1e5a2aab
2024-05-22 14:20:46 +10:00
deraadt@openbsd.org f3e4db4601
upstream: -Werror was turned on (probably just for development),
and this is a simple way to satisfy older gcc.

OpenBSD-Commit-ID: 7f698df54384b437ce33ab7405f0b86c87019e86
2024-05-22 14:20:46 +10:00
Damien Miller 24a1f3e5ad
attempt at updating RPM specs for sshd-session 2024-05-17 14:50:43 +10:00
djm@openbsd.org 17b566eeb7
upstream: g/c unused variable
OpenBSD-Commit-ID: aa6ef0778a1f1bde0d73efba72a777c48d2bd010
2024-05-17 14:42:49 +10:00
jsg@openbsd.org 01fb82eb2a
upstream: spelling; ok djm@
OpenBSD-Commit-ID: bdea29bb3ed2a5a7782999c4c663b219d2270483
2024-05-17 14:42:49 +10:00
djm@openbsd.org b88b690e99
upstream: allow overriding the sshd-session binary path
OpenBSD-Regress-ID: 5058cd1c4b6ca1a15474e33546142931d9f964da
2024-05-17 14:41:39 +10:00
anton@openbsd.org a68f80f251
upstream: Since ssh-agent(1) is only readable by root by now, use
ssh(1) while generating data in tests.

OpenBSD-Regress-ID: 24eb40de2e6b0ace185caaba35e2d470331ffe68
2024-05-17 14:41:39 +10:00
djm@openbsd.org 92e5589031
upstream: fix incorrect debug option name introduce in previous
commit

OpenBSD-Commit-ID: 66d69e22b1c072c694a7267c847f212284614ed3
2024-05-17 14:41:38 +10:00
deraadt@openbsd.org 4ad72878af
upstream: construct and install a relink-kit for sshd-session ok
djm

OpenBSD-Commit-ID: 8b3820adb4da4e139c4b3cffbcc0bde9f08bf0c6
2024-05-17 14:41:37 +10:00
Damien Miller 02e679a2cb
Makefile support for sshd-session 2024-05-17 14:41:37 +10:00