Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/scripts/pam-pkcs11-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y \
echo "[*] Cloning pam_pkcs11..."
cd /opt
if [[ ! -d "pam_pkcs11" ]]; then
git clone https://github.com/OpenSC/pam_pkcs11.git
git clone --branch=${PAM_PKCS11_REF} https://github.com/OpenSC/pam_pkcs11.git
fi
cd pam_pkcs11

Expand All @@ -63,6 +63,10 @@ fi

echo "[*] Configuring pam_pkcs11..."

# Temporarily unset WOLFPROV_FORCE_FAIL so we can test the failure case
Comment thread
padelsbach marked this conversation as resolved.
Outdated
ORIG_WOLFPROV_FORCE_FAIL="${WOLFPROV_FORCE_FAIL:-}"
unset WOLFPROV_FORCE_FAIL || true

# Generate dummy CA cert if missing
if [ ! -f /test/certs/test-ca.crt ]; then
echo "[*] Generating dummy test-ca.crt..."
Expand Down Expand Up @@ -99,6 +103,9 @@ cp /etc/pam.d/common-auth /etc/pam.d/common-auth.bak
echo "auth sufficient pam_pkcs11.so debug" | tee /etc/pam.d/common-auth > /dev/null
cat /etc/pam.d/common-auth.bak | tee -a /etc/pam.d/common-auth > /dev/null

# Restore WOLFPROV_FORCE_FAIL
export WOLFPROV_FORCE_FAIL="$ORIG_WOLFPROV_FORCE_FAIL"

echo "[*] Initializing SoftHSM (simulated smartcard)..."
mkdir -p /var/lib/softhsm/tokens
softhsm2-util --init-token --free --label "testtoken" --pin 1234 --so-pin 123456
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pam_pkcs11 Tests
name: pam-pkcs11 Tests

# START OF COMMON SECTION
on:
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
source $GITHUB_WORKSPACE/scripts/env-setup

# Run tests
if timeout 300 ${{ matrix.force_fail }} sudo bash -c $GITHUB_WORKSPACE/.github/scripts/pam-pkcs11-test.sh; then
if timeout 300 sudo bash -c "${{ matrix.force_fail }} PAM_PKCS11_REF=${{ matrix.pam_pkcs11_ref }} $GITHUB_WORKSPACE/.github/scripts/pam-pkcs11-test.sh"; then
TEST_RESULT=0
else
TEST_RESULT=1
Expand Down
Loading