-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upstream: split the PerSourcePenalties test in two: one tests penalty
enforcement but not penalty expiry, the other tests penalty expiry. This lets us disable the expiry testing in certain CI test environments. OpenBSD-Regress-ID: f56811064f3e3cb52ee73a206b8c2a06af1c8791
- Loading branch information
Showing
3 changed files
with
40 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# $OpenBSD | ||
# Placed in the Public Domain. | ||
|
||
tid="penalties" | ||
|
||
grep -vi PerSourcePenalties $OBJ/sshd_config > $OBJ/sshd_config.bak | ||
cp $OBJ/authorized_keys_${USER} $OBJ/authorized_keys_${USER}.bak | ||
|
||
conf() { | ||
test -z "$PIDFILE" || stop_sshd | ||
(cat $OBJ/sshd_config.bak ; | ||
echo "PerSourcePenalties $@") > $OBJ/sshd_config | ||
cp $OBJ/authorized_keys_${USER}.bak $OBJ/authorized_keys_${USER} | ||
start_sshd | ||
} | ||
|
||
conf "noauth:10s authfail:10s max:20s min:1s" | ||
|
||
verbose "test connect" | ||
${SSH} -F $OBJ/ssh_config somehost true || fatal "basic connect failed" | ||
|
||
verbose "penalty expiry" | ||
|
||
# Incur a penalty | ||
cat /dev/null > $OBJ/authorized_keys_${USER} | ||
${SSH} -F $OBJ/ssh_config somehost true && fatal "authfail connect succeeded" | ||
|
||
# Check denied | ||
cp $OBJ/authorized_keys_${USER}.bak $OBJ/authorized_keys_${USER} | ||
${SSH} -F $OBJ/ssh_config somehost true && fatal "authfail not rejected" | ||
|
||
# Let it expire and try again. | ||
sleep 11 | ||
${SSH} -F $OBJ/ssh_config somehost true || fail "authfail not expired" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters