What is the purpose of the -nodes
argument in openssl?

- 110,530
- 99
- 389
- 494

- 1,431
- 2
- 10
- 6
-
2Stack Overflow is a site for programming and development questions. This question appears to be off-topic because it is not about programming or development. See [What topics can I ask about here](http://stackoverflow.com/help/on-topic) in the Help Center. Perhaps [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) would be a better place to ask. – jww Apr 01 '15 at 10:54
-
33@jww I disagree, openssl is a low-level toolkit and developers have to deal with it all the time. The line is fairly blurry, and it would be a big loss to not allow openssl questions here simply because it happens to be a CLI rather than the C lib. – gtd Apr 16 '15 at 19:45
-
@gtd - that's a frequent complaint when I flag these. Also see [Where do I post questions about Dev Ops?](http://meta.stackexchange.com/q/134306). (But I think I made a mistake on this one - the question is from 2011, and I believe its was on-topic back then. I don't like to penalize for the policy change). – jww Apr 16 '15 at 19:52
-
2@gtd - re: *"openssl is a low-level toolkit and developers have to deal with it all the time."* - that's what [Super User](http://superuser.com/) or [Unix & Linux Stack Exchange](http://unix.stackexchange.com/) are for. *"... it would be a big loss to not allow openssl questions ..."* - openssl C programming questions are always welcomed here. The loss of the non-programming questions will not be missed because Stack Overflow is a programming and development site. There's other sites to go to when you don't know how to use a command. – jww Apr 16 '15 at 19:55
-
Thanks for the link, I'll post my response there since I think this is a very important issue. – gtd Apr 16 '15 at 20:01
2 Answers
The option -nodes
is not the English word "nodes", but rather is "no DES". When given as an argument, it means OpenSSL will not encrypt the private key in a PKCS#12 file.
To encrypt the private key, you can omit -nodes
and your key will be encrypted with 3DES-CBC. To encrypt the key, OpenSSL prompts you for a password and it uses that password to generate an encryption key using the key-derivation function EVP_BytesToKey.
Depending on your version of OpenSSL and compiled options, you may be able to provide these options in place of -nodes
:
-des encrypt private keys with DES
-des3 encrypt private keys with triple DES (default)
-idea encrypt private keys with idea
-seed encrypt private keys with seed
-aes128, -aes192, -aes256
encrypt PEM output with cbc aes
-camellia128, -camellia192, -camellia256
encrypt PEM output with cbc camellia
Ultimately at the library level OpenSSL calls the function PEM_write_bio_PrivateKey with the encryption algorithm (or lack thereof) you choose.

- 17,306
- 6
- 61
- 82
-
2
-
4@Flimm: Protected with a password, yes. The password generates an encryption key using a key-derivation algorithm, and the encryption is done with the key, not the password. The only way to use the encrypted key is to decrypt it first, for which you need to know the password it was encrypted with to generate the same key. – indiv Apr 12 '13 at 14:42
-
1why shoulud I encrypt my private key file? those arent published to anyone, hence the name. Or am I wrong? – phil294 Sep 25 '18 at 02:20
-
2@Blauhirn: You'd encrypt your private key file for the same reason you'd encrypt any file: you don't want someone who obtains a copy to be able to read it or use it. Whether you should encrypt the private key depends on the importance of the key and your threat model. – indiv Sep 25 '18 at 17:48
edit: nginx v1.7.3 has added an ssl_password_file directive which reads passphrases from a specified file trying each passphrase on the context's encrypted-private.key
indiv is correct that the -nodes
argument means that OpenSSL will create UNencrypted private.key; otherwise, there will be a passphrase prompt to create encrypted-private.key. see req, pkcs12, CA.pl
however, I feel the purpose (for programmers) is because:
- HTTP servers (e.g. Apache, Nginx) cannot read encrypted-private.key without passphrase →
- Option A - each time HTTP server starts, must provide passphrase for encrypted-private.key
- Option B - specify
ssl_password_file file.keys;
inhttp { }
orserver { }
context. [ref] - Option C - use
-nodes
to create private.key without encryption
useful: lock down private.key
- { add HTTP server to ssl-cert group }
sudo chown root:ssl-cert private.key
- change owner of private.key to root user, ssl-cert groupsudo chmod 640 private.key
- change access permissions of private.key to owner R/W, group R- now, HTTP server should be able to start and read UNencrypted private.key
Option A
stronger security, yet when server restarts, have to manually type in passphrase for encrypted-private.key
Option B
medium security, and probably good balance between A/C
Option C
weaker security, yet NOT prompted for UNencrypted private.key passphrase

- 5,237
- 1
- 28
- 22
-
1Nginx **can** read encrypted private keys since version 1.7.3, see: http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_password_file – 5lava Nov 19 '14 at 18:31
-
2What is the purpose of bringing nginx and its versions into the discussion? Also, (B) and (C) offer equivalent security (namely, filesystem ACLs). The problem you are describing is the *Unattended Key Storage Problem*, and its a problem without a solution. See Gutmann's [Engineering Security](https://www.cs.auckland.ac.nz/~pgut001/pubs/book.pdf) book. – jww Apr 01 '15 at 10:58
-
@jww the question asks "what is the _purpose_...". I considered the question's context (QnA for programmers), which I attempted to indicate via "however, I feel the purpose (for programmers) is because:". specifically regarding security.. may be a discussion for [security.stackexchange.com](http://security.stackexchange.com) – Jake Berger Apr 02 '15 at 11:47