Forum Discussion
F5 automated backup with iApp - SCP passwordless authentication not working
Hi,
Looking around, I saw a possible issue when we fill the content in the password field. For example, when you copy the private key RSA/DSA content to the browser, it changes the line breaks to a blank spaces (I have not tested in all browsers). So, there is a command line in the script should revert these spaces into line break again:set cleaned_privatekey [exec echo "$::destination_parameters__scp_sshprivatekey" | sed -e "s/BEGIN RSA PRIVATE KEY/BEGIN;RSA;PRIVATE;KEY/g" -e "s/END RSA PRIVATE KEY/END;RSA;PRIVATE;KEY/g" -e "s/ /\\\n/g" -e "s/;/ /g"]
Before I copying the private key RSA/DSA from Linux, I did the following:
1) I created the key without passphrase:
ssh-keygen -t dsa2) I opened that key in vi editor:
vi /root/.ssh/id_dsa3) I replaced that LF with command:
:%s/\n/\\n/gOriginal DSA:
-----BEGIN DSA PRIVATE KEY-----
MIIBugIBAAKBgQCdRL3IXiezeyf9+Xqf2BqfbYMKgLQRM1vcj+dUsAJDn8CVpHZe
XGuAT6uIU6T2d1AUmmlL6FPesVfsxyBl+OFfXqWMWnHF4DdqI2435tRzqcC0jXDJ
WYOrK233UvMz8Pie1htvHF3CxvTX9K8leuMpNCBznvHfsEjvnN2modZ1lQIVANqT
/y5aBYxwUhU4Kjii6hHwwMlNAoGAIEaD6+aexKoFmxJ6PuUA/UCffn/unAUi4BXV
+WukP5gkHWdDNSKlZkOKFsrAU0PfmBOHe0qE4NDIcH08U4iYkxirkgwsXFRTFcVh
CdXVaULxN0jgFx2yL0SfvhjEL9n4WPy52qKAgM3tsGEURY+4atikqrY07mpyMwGl
5LEYN4ECgYAEZxa4fmCHpGJ033tXNcyHlXhpVVgw7u5+WbN3Wj8UDXN3lonkW+VZ
L4QO90cWg2XmzwQvow6GJzCihRaE3GeXLGxLmEbe07zw+6vkBAtD3Us4vJSJUrRC
6nT4VwW63Cvebvx7y3JMqWsp8zR2ztYCdCbNFNrUU8S8rrSys0hsEgIULzBeRgMr
S5GI7x+bdFXk62TEQ5Q=
-----END DSA PRIVATE KEY-----
Replaced:
-----BEGIN DSA PRIVATE KEY-----\nMIIBugIBAAKBgQCdRL3IXiezeyf9+Xqf2BqfbYMKgLQRM1vcj+dUsAJDn8CVpHZe\nXGuAT6uIU6T2d1AUmmlL6FPesVfsxyBl+OFfXqWMWnHF4DdqI2435tRzqcC0jXDJ\nWYOrK233UvMz8Pie1htvHF3CxvTX9K8leuMpNCBznvHfsEjvnN2modZ1lQIVANqT\n/y5aBYxwUhU4Kjii6hHwwMlNAoGAIEaD6+aexKoFmxJ6PuUA/UCffn/unAUi4BXV\n+WukP5gkHWdDNSKlZkOKFsrAU0PfmBOHe0qE4NDIcH08U4iYkxirkgwsXFRTFcVh\nCdXVaULxN0jgFx2yL0SfvhjEL9n4WPy52qKAgM3tsGEURY+4atikqrY07mpyMwGl\n5LEYN4ECgYAEZxa4fmCHpGJ033tXNcyHlXhpVVgw7u5+WbN3Wj8UDXN3lonkW+VZ\nL4QO90cWg2XmzwQvow6GJzCihRaE3GeXLGxLmEbe07zw+6vkBAtD3Us4vJSJUrRC\n6nT4VwW63Cvebvx7y3JMqWsp8zR2ztYCdCbNFNrUU8S8rrSys0hsEgIULzBeRgMr\nS5GI7x+bdFXk62TEQ5Q=\n-----END DSA PRIVATE KEY-----
After that, I did the copy and paste to the password field and it works.
I can not say if there is already some latest version of this script, therefore, If you prefer to change the templante, I just advise you to make a new copy of this template and change the following in the implementation script:
With the following, you should no longer need perform the steps above:
set cleaned_privatekey [exec echo "$::destination_parameters__scp_sshprivatekey" | sed -e "s/BEGIN RSA PRIVATE KEY/BEGIN;RSA;PRIVATE;KEY/g" -e "s/END RSA PRIVATE KEY/END;RSA;PRIVATE;KEY/g" -e "s/ /\\\n/g" -e "s/;/ /g"]
set cleaned_privatekey [string map {"BEGIN DSA PRIVATE KEY" "BEGIN;DSA;PRIVATE;KEY" "BEGIN RSA PRIVATE KEY" "BEGIN;RSA;PRIVATE;KEY"} $::destination_parameters__scp_sshprivatekey]
set cleaned_privatekey [string map {"END DSA PRIVATE KEY" "END;DSA;PRIVATE;KEY" "END RSA PRIVATE KEY" "END;RSA;PRIVATE;KEY"} $cleaned_privatekey]
set cleaned_privatekey [string map {"\r" "" " " "\n" ";" " "} $cleaned_privatekey]
By changing this, the script will remove the local backup from the BigIP successfully, otherwise, this will not remove the UCS/SCF local files correctly.
exec rm -f BACKUPDIRECTORY/$fnameBACKUPFILESCRIPTEXTENSION
exec rm -f BACKUPDIRECTORY/${fname}BACKUPFILESCRIPTEXTENSION
I hope this helps you in some way.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
