@gbotica,
You stated
However, it seems that the need to create custom templates (to add the ssl_ciphers updates and ssl_dhparam parameters) creates another problem ... as Plesk deploys updates that include changes to these web configuration templates, we would need to check if these files are modified and then merge them with our /custom template versions -- hardly a very elegant solution -- in order to patch for one problem, we are blocking our server from receiving future patches.
Is there a better way?
And yep, there is a simple, better and update-proof way: do not fiddle with templates, (custom) configure Nginx!
Just add a custom .conf file to /etc/nginx/conf.d/, for instance ssl-custom.conf.
Note that the file ssl.conf already exists and that your custom directives have to be somewhat adjusted.
The ssl.conf file contains the following lines by default:
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
The ssl-custom.conf file should hence include the lines:
ssl_session_timeout 5m;
ssl_session_cache shared:SSL:50m;
ssl_dhparam <location of .pem file>;
and one could also include the cipher suite in this ssl-custom.conf file (uncomment the ssl_ciphers in ssl.conf) or adjust the cipher suite in ssl.conf.
Please be aware of the caveats of the approach to adopt a Ephemeral Diffie-Hellmann (DHE) key exchange process by implementing the ssl_dhparam directive:
a) a potential conflict with standard ssl related nginx directives,
b) a heavy punishment, in terms of performance,
c) a necessity to create an elaborate cipher suite, that has to become even more extensive when wanting to allow for backwards compatibility,
d) some versions of OpenSSL (i.e. the standard versions) do not return the required or some of the required algorithms,
e) certificates and keys have to be
perfectly aligned: nginx relies on OpenSSL and the "danger" of the default 1024-bit OpenSSL key for key exchange exists, in the sense that security of a 2048-bit certificate can be comprised, if the default 1024-bit key is used by mistake,
and the above caveats are only the most important ones.
In conclusion, if you really want to implement the ssl_dhparam directive, generate a stronger DHE parameter that is in line with the certificate being used.
And in the current solution proposed, nobody seems to hint to the dangers of using default OpenSSL keys with, for instance, 2048-bit certificates.
In my humble opinion, good ideas and solutions should be implemented well and I am asking openly whether this is the way forward to hardening Nginx SSL/TLS configuration.
Anyway, the idea behind PFS (Perfect Forward Secrecy) is excellent, I am in favour of DHE key exchange.
Regards....