An automated bash script to generate OTP (verification codes) from Google's 2FA secret key and generated OTP (verification codes) should use for transfer data from one Ubuntu server to another 2FA enabled Ubuntu server
rsync command to transfer files from my Jenkins server to production server. Production server is enabled with 2FA. I need to automate this process without using any other resources like AWS S3.
Can anyone help me to solve this?
We can use
oathtool together for copying files to 2FA enabled servers. So we can remove nullok from server and tighten up server against brute force attack.
Source / Jenkins server:
Following is the example of copying files from Jenkins to 2FA enabled server:
sshpass -p `oathtool -b --totp 'xxxxxxxxxxxxx'` rsync -aruvhze 'ssh -i /var/lib/jenkins/ssh_key.txt -o StrictHostKeyChecking=no' --progress /var/lib/jenkins/workspace/build/* [email protected]:/opt/build/