easy-rsa icon indicating copy to clipboard operation
easy-rsa copied to clipboard

Command `write` syntax details

Open TinCanTech opened this issue 1 year ago • 0 comments

Introduction: Command write is essentially used internally to supply the required configuration files, on demand. Command write code is exposed for testing purposes.

Command write syntax:

  • easyrsa write <type> <filename> [overwrite] Does not over write an existing file, unless option overwrite is given.
  • easyrsa write <type> > "$your_file" - Redirect as necessary. Caution! Will over write an existing file.
  • easyrsa write <type> - Write type to stdout. Test this!

Command write does not require a PKI. It can be tested as-is. Please, take care to not over write your current working files.

<type> is required, listed below:

  • ssl-cnf - Print default openssl-easyrsa.cnf.
  • safe-cnf - Print fully expanded safessl-easyrsa.cnf. Requires EASYRSA_TEMP_DIR to be an existing directory.
  • vars - Print default vars.example. pki/vars.example is always created at init-pki.
  • COMMON|ca|server|serverClient|client|codeSigning|email|kdc Print default x509-types file by name.

<filename> is optional:

  • If <filename> is specified then files are output to <filename>.
  • Existing files of the same name are always preserved, unless option overwrite is given.
  • safessl-easyrsa.cnf has never been an existing file, NEVER preserved.
  • Only type legacy-hard (See below) will over write existing files.

It is also suitable to redirect output as required:

  • easyrsa write <type> > $your-file - Destructive, use with caution.

There are also two composite types to write:

  • legacy - Create all pki/x509-types files and pki/openssl-easyrsa.cnf
  • legacy-hard - Create and OVERWRITE existing files, as legacy above.
  • Note: Both require a working PKI (init-pki) and cannot use file redirection.

TinCanTech avatar Jan 09 '24 03:01 TinCanTech