Debian Codegraph @

regress/penalty-expire.sh

raw symbols SCIP
1 # $OpenBSD: penalty-expire.sh,v 1.3 2025/05/22 04:34:18 bluhm Exp $
2 # Placed in the Public Domain.
3
4 tid="penalties"
5
6 grepscip-shell system . . grep. -vi PerSourcePenalties $OBJ/sshd_config > $OBJ/sshd_config.bak
7 cpscip-shell system . . cp. $OBJ/authorized_keys_${USER} $OBJ/authorized_keys_${USER}.bak
8
9 confscip-shell shell openssh 1:10.3p1-4 conf().() {
10 testscip-shell system . . test. -z "$PIDFILE" || stop_sshd
11 (catscip-shell system . . cat. $OBJ/sshd_config.bak ;
12 echoscip-shell system . . echo. "PerSourcePenalties $@") > $OBJ/sshd_config
13 cpscip-shell system . . cp. $OBJ/authorized_keys_${USER}.bak $OBJ/authorized_keys_${USER}
14 start_sshd
15 }
16
17 confscip-shell shell openssh 1:10.3p1-4 conf(). "noauth:10s authfail:10s max:20s min:1s"
18
19 verbose "test connect"
20 ${SSH} -F $OBJ/ssh_config somehost true || fatal "basic connect failed"
21
22 verbose "penalty expiry"
23
24 # Incur a penalty
25 catscip-shell system . . cat. /dev/nullscip-shell filesystem . . `/dev/null`. > $OBJ/authorized_keys_${USER}
26 ${SSH} -F $OBJ/ssh_config somehost true && fatal "authfail connect succeeded"
27 sleepscip-shell system . . sleep. 2
28
29 # Check denied
30 cpscip-shell system . . cp. $OBJ/authorized_keys_${USER}.bak $OBJ/authorized_keys_${USER}
31 ${SSH} -F $OBJ/ssh_config somehost true && fatal "authfail not rejected"
32
33 # Let it expire and try again.
34 sleepscip-shell system . . sleep. 11
35 ${SSH} -F $OBJ/ssh_config somehost true || fail "authfail not expired"