|
25 | 25 | id: cache-wolfssl |
26 | 26 | with: |
27 | 27 | path: build-dir/ |
28 | | - key: wolfssh-x509-interop-wolfssl-${{ env.WOLFSSL_REF }}-ubuntu-latest |
| 28 | + key: wolfssh-x509-interop-wolfssl-${{ env.WOLFSSL_REF }}-all-ubuntu-latest |
29 | 29 | lookup-only: true |
30 | 30 |
|
31 | 31 | - name: Checkout, build, and install wolfSSL |
|
35 | 35 | repository: wolfssl/wolfssl |
36 | 36 | ref: ${{ env.WOLFSSL_REF }} |
37 | 37 | path: wolfssl |
38 | | - configure: --enable-ssh --enable-keygen --enable-ed25519 --enable-curve25519 |
| 38 | + # --enable-all defines WOLFSSL_FPKI, which compiles the UPN-vs-username |
| 39 | + # binding in wolfSSHd (apps/wolfsshd/auth.c). The client cert carries |
| 40 | + # UPN:fred@example, so user "fred" is bound to the certificate. The |
| 41 | + # wolfSSHd build still passes -DWOLFSSH_NO_FPKI below so the strict |
| 42 | + # FPKI profile (FASCN) is not required of the fred test certificate. |
| 43 | + # |
| 44 | + # Coverage note: this FPKI build exercises only the WOLFSSL_FPKI |
| 45 | + # success/binding path of RequestAuthentication. The non-FPKI |
| 46 | + # fail-closed reject branch (apps/wolfsshd/auth.c) is intentionally |
| 47 | + # not run here; it is verified at compile time and would need a |
| 48 | + # separate non-FPKI build to exercise at runtime. |
| 49 | + configure: --enable-all |
39 | 50 | check: false |
40 | 51 | install: true |
41 | 52 |
|
|
86 | 97 | uses: actions/cache@v5 |
87 | 98 | with: |
88 | 99 | path: build-dir/ |
89 | | - key: wolfssh-x509-interop-wolfssl-${{ env.WOLFSSL_REF }}-ubuntu-latest |
| 100 | + key: wolfssh-x509-interop-wolfssl-${{ env.WOLFSSL_REF }}-all-ubuntu-latest |
90 | 101 | fail-on-cache-miss: true |
91 | 102 |
|
92 | 103 | - name: Restore PKIX-SSH cache |
@@ -199,6 +210,39 @@ jobs: |
199 | 210 | exit |
200 | 211 | EOF |
201 | 212 |
|
| 213 | + - name: Negative test - fred cert must not authenticate as another user |
| 214 | + working-directory: ./wolfssh/ |
| 215 | + run: | |
| 216 | + # Regression guard for the cert principal-binding fix: a certificate |
| 217 | + # issued for "fred" (UPN:fred@example) must not be accepted for a |
| 218 | + # different SSH username. PreferredAuthentications=publickey plus |
| 219 | + # BatchMode keep this to a single publickey attempt with no password |
| 220 | + # fallback. The preceding positive tests already proved connectivity |
| 221 | + # and that fred's cert works; here we additionally require the failure |
| 222 | + # to be an authentication denial, so an unrelated ssh error (transport, |
| 223 | + # host-key, option change) cannot masquerade as a passing negative test. |
| 224 | + sudo useradd -m otheruser |
| 225 | + set +e |
| 226 | + ../build-dir/bin/ssh -o StrictHostKeyChecking=accept-new \ |
| 227 | + -o PreferredAuthentications=publickey \ |
| 228 | + -o BatchMode=yes -o NumberOfPasswordPrompts=0 \ |
| 229 | + -p 22222 -F ssh-pkixssh-config \ |
| 230 | + -i ./keys/fred-key.pem otheruser@127.0.0.1 exit \ |
| 231 | + > ssh-neg.out 2> ssh-neg.err |
| 232 | + rc=$? |
| 233 | + set -e |
| 234 | + cat ssh-neg.err || true |
| 235 | + if [ "$rc" -eq 0 ]; then |
| 236 | + echo "SECURITY FAILURE: fred certificate authenticated as otheruser" |
| 237 | + exit 1 |
| 238 | + fi |
| 239 | + if ! grep -qi "permission denied" ssh-neg.err; then |
| 240 | + echo "Negative test inconclusive: ssh failed but not with an auth" |
| 241 | + echo "denial (possible transport/config error, not a binding reject)" |
| 242 | + exit 1 |
| 243 | + fi |
| 244 | + echo "OK: fred certificate correctly rejected for otheruser (auth denied)" |
| 245 | +
|
202 | 246 | - name: Show wolfSSHd log on failure |
203 | 247 | if: failure() |
204 | 248 | working-directory: ./wolfssh/ |
|
0 commit comments