Skip to content

Commit

Permalink
Test MFA
Browse files Browse the repository at this point in the history
  • Loading branch information
akanuri9 committed Dec 20, 2024
1 parent 50cb659 commit 6372f72
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/test-mfa-ssh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@ jobs:
description: 'Auth code for MFA'
- name: Install sshpass
run: sudo apt-get update && sudo apt-get install -y sshpass
- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/development.key
chmod 600 ~/.ssh/development.key
cat >>~/.ssh/config <<END
Host development
HostName $SSH_HOST
User $SSH_USERNAME
Port $SSH_PORT
IdentityFile ~/.ssh/development.key
StrictHostKeyChecking no
PreferredAuthentications publickey,keyboard-interactive
END
env:
SSH_PORT: ${{secrets.SSH_PORT}}
SSH_HOST: ${{secrets.SSH_HOST}}
SSH_USERNAME: ${{secrets.SSH_USERNAME}}
SSH_KEY: ${{secrets.SSH_KEY}}
- name: Connect to SSH and send verification code
run: |
sshpass -v -p "${{ steps.get-otp.outputs.AUTH_CODE }}" ssh -vvv -o "StrictHostKeyChecking=no" -o "PreferredAuthentications=publickey,keyboard-interactive" -i ~/.ssh/development.key $SSH_USERNAME@$SSH_HOST -p $SSH_PORT 'ls -la'
Expand Down

0 comments on commit 6372f72

Please sign in to comment.