I copied /System/Library/OpenSSL/openssl.cnf to my home folder so I could set default values for certificate creation. How do I set up OpenSSL to use my config file instead of the regular one? I could add a statement to my ~/.bashrc file. I've done web searches and searched the openssl.org website but could not find the answer. One post on Stack Overflow mentioned a parameter -config but was not referenced in a command.

1 Answer 1


It would depend on what commands you're running.

If you run req or ca they would support a -config parameter. Which would also be visible if you run openssl req -? or openssl ca -?.

If you want to make it the actual default without exclusively specifying it you should check Correct location of openssl.cnf file.

From the above link for the options of the req command:

-config filename

this allows an alternative configuration file to be specified, this overrides the compile time filename or any specified in the OPENSSL_CONF environment variable.

  • I'm running req and using the installed Apple version of OpenSSL. So I would have to use -config myfilenameincludingfullpath in my req command? The link you provide does not include that info. Commented Apr 10, 2017 at 12:23
  • It does and it includes even more info, see the edit I'm about to make. But yes, that would be what you need to do.
    – Seth
    Commented Apr 10, 2017 at 12:29
  • Okay thanks. I did not see that req was a link in your comment. Commented Apr 10, 2017 at 12:30
  • 2
    Adding -config to my statement worked! Commented Apr 10, 2017 at 12:52
  • FYI, openssl doesn't want -config at the start of the parameter list. Throw it at the end of your command and it will accept it.
    – degenerate
    Commented Nov 12, 2023 at 23:02

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .