How to enable pasting in of pem files

I am building a mechanism to add pki certificates to a confd CLI application. The problem is that standard openssl PEM files have carriage returns in them. Each line has a set number of characters, then a and then goes to the end it is bracketed by —Begin Certificate— — End Certificate — I can’t find a way to implement this on the CLI as it cannot handle the carriage returns and that ends the command. While I could externally strip the carriage returns, this is not a good solution as it involves modifying standard CA and cert file contents. Is there a way to accept multi-line input at the confd CLI? If so, can you point me to an example as to how to accomplish this.

Hi Les,

The basic capability for allowing such things as new lines in a CLI configuration is the

  leaf multi {
    tailf:cli-preformatted;
    type string;
  }

e.g.

multi "first line\nsecond line"

then

# show configuration multi 
multi first line
      second line

That is intended for banners and motd configuration. However, I’m not sure if it will do what you want for pem files by just pasting in.

So this doesn’t really address the problem and I believe from our testing, it is doing as the name suggests, i.e. just supporting escaped strings that use the text based conventions. The standard cert files actually have binary carriage returns and linefeeds in them. The implications is that I would have to modify the certificate and trust anchor files externally. As you might imagine people get twitchy when you modify cert files. So I just want to confirm that there is no way to take multi-line input on the CLI. The example you gave above is really single line input with text based escapes for linefeeds. I just want to confirm this prior to changing my design as I have to go a different route to get the files in. On my existing system, I have specific attribute types that effectively collect input until the user hits CTRL-D and then puts all the input into a single string attribute. I just paste the files in natively just as I get them from the CA.

Perhaps another solution is to use an action to get the file a put in the correct place? Is ConfD actually doing much in this process other than providing a common user command line for this operation and others?