ConfD User Community

Confd_cli interactive mode in script

We have enable mode which asks for password. How can i provide password if doing it via script?
Here is the script referred from user guide:

#!/bin/sh
/usr/local/bin/confd_cli -u admin -U 1000 -g admin -n -v  -C<< EOF
enable
configure
set foo bar 13
set funky stuff 44
commit
#exit no-confirm
exit
EOF

It connects and does not prompt for password. Like:

localhost> enable
Password:
% Bad password
localhost> set foo bar 13
...
...

Thanks.

Is it really necessary that you interact with ConfD using a shell script talking to confd_cli, and in particular using the IOS style? Of all possible options ordered by usability this one would likely rank somewhere near the end. The example in the UG shows how you can, quoting, “test various aspects of the CLI” (emphasis mine); it is not meant as a method for deployment.

If you (your client) are for some reason restricted to bash or sh scripts, consider providing NETCONF/RESTCONF, even that would provide better experience using tools like netconf-console or curl; if you are for some reason restricted to confd_cli, you might want to consider tools like expect or the Python library pexpect or variants - these are specifically designed to interact with CLIs.

As a workaround, you could (depending on your requirements):

  • just disable config password for CLI user

or

  • create new CLI user without config password for scripting, do you don’t affect your current user