Test MFA #7
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
--- | |
name: Create Build | |
on: | |
push: | |
branches: | |
- SITE-4468 | |
jobs: | |
deploy: | |
name: Deploy to Dev | |
permissions: | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Enter auth code | |
uses: step-security/wait-for-secrets@v1 | |
id: get-otp | |
with: | |
secrets: | | |
AUTH_CODE: | |
name: 'Auth Code' | |
description: 'Auth code for MFA' | |
- name: Echo OTP | |
run: echo ${{ steps.get-otp.outputs.AUTH_CODE }} | |
- 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 -p "${{ steps.get-otp.outputs.AUTH_CODE }}" ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" -o "PreferredAuthentications=publickey,keyboard-interactive" -i ~/.ssh/development.key $SSH_USERNAME@$SSH_HOST -p $SSH_PORT 'ls -la' | |
env: | |
SSH_HOST: ${{secrets.SSH_HOST}} | |
SSH_USERNAME: ${{secrets.SSH_USERNAME}} | |
SSH_PORT: ${{secrets.SSH_PORT}} | |
SSH_KEY: ${{secrets.SSH_KEY}} |