← Back to section · Tutorials & Labs
Anatomy of openssl.cnf: The Sections That Actually Do Something
openssl.cnf is a file most people have never opened, yet it is in effect every day. This article dissects its entry structure, the provider activation sections and the TLS system-default section, and explains how to verify a change really took effect.
Every system with OpenSSL installed has an openssl.cnf lying in it. It decides which providers get loaded, where the default TLS floor sits, and what gets pre-filled when certificate requests are generated. Most people never open it — until the day they need to enable FIPS, attach an external provider, or disable old protocols machine-wide, and find themselves not knowing where to start. This article takes the sections that actually do something apart one by one, reading from the entry point downwards.
First, Confirm Which Copy You Are Editing
openssl version -d # OPENSSLDIR; the config file usually sits under it as openssl.cnf
openssl version -a | head
echo $OPENSSL_CONF # if set, the file it points to wins over the default path
Once the OPENSSL_CONF environment variable is set, it overrides the default path wholesale — containers and some application frameworks are fond of doing this. If you edited for an hour with no effect, suspect number one is that you edited the wrong file. For a program-specific configuration, most applications also accept a one-off -config <file> (for example openssl req -config my.cnf). Another easy trap is distribution variance: some systems split the main file into an include directory assembled with the .include directive, so read the head of the file before editing anything.
The Entry Point: openssl_conf and openssl_init
The two key lines at the top of the file are:
openssl_conf = openssl_init
[openssl_init]
providers = provider_sect
ssl_conf = ssl_sect
The first line declares “the startup configuration lives in the openssl_init section”; that section then registers two things: provider definitions are found in provider_sect, and the TLS system defaults in ssl_sect. In some distributions’ default file the openssl_conf line is commented out, which means providers follow the built-in default behaviour (default and base load automatically); the moment you want to manage providers manually, enabling that line is step one.
The Provider Sections: Listing a Name Is Not Activation
[provider_sect]
default = default_sect
legacy = legacy_sect
# fips = fips_sect
[default_sect]
activate = 1
[legacy_sect]
activate = 1
This is the most misread spot in the whole file: registering a name in provider_sect only declares “this provider’s configuration lives in such-and-such a section” — whether it actually loads depends on an activate = 1 in that section. Adding the legacy section and activating it is the standard fix when you need old algorithms back; conversely, to tighten the security surface you can activate only the providers you need. fips is a special case: it first needs its own fipsmodule.cnf generated with openssl fipsinstall, which is then .included and activated in the configuration; miss a step and startup fails. External providers (such as oqsprovider) follow the same pattern: register the name, point module = <filename> at its .so, then activate — all three, or it is not installed.
The ssl Section: The Machine-Wide TLS Floor
[ssl_sect]
system_default = system_default_sect
[system_default_sect]
MinProtocol = TLSv1.2
CipherString = DEFAULT:@SECLEVEL=2
Groups = X25519MLKEM768:X25519:secp256r1
The system_default section constrains every OpenSSL application that follows the system configuration (not all programs obey — applications with their own TLS settings override it). MinProtocol sets the protocol floor; the @SECLEVEL=2 inside CipherString is the security-level switch (level 2 corresponds to at least 112 bits of security strength and disables a batch of weak algorithms and small keys along the way); Groups restricts which groups TLS may negotiate — on 3.5, to make the whole machine prefer hybrid groups by default, put X25519MLKEM768 first here. Later in the file there are sections such as [req] and [v3_ca], governing default fields and extensions for certificate requests and issuance — fair game when experimenting, but normally left alone for system configuration.
After Changing Anything, Verify
Configuration files have the habit of failing silently — a mistake often produces no error, just no effect — so verification after a change has two steps. One: run openssl list -providers to confirm the target provider is activated and the target algorithms appear in the list output. Two: run a real negotiation, connecting with openssl s_client to a local s_server or a real service, and confirm the negotiated group and protocol version match what system_default prescribes. Only when both agree is the change done. If step one already fails, check whether OPENSSL_CONF points at some other file — the number-one own goal in this field.
Supplement: Several Advanced but Useful Mechanisms
The include directive. Configuration files support .include <path> to splice in another file; FIPS’s fipsmodule.cnf is brought in exactly this way, and distributions use it to separate vendor defaults from local overrides. When troubleshooting and the main file looks short with sections “missing”, an included file has probably taken over — follow the include chain to the end before drawing conclusions. Environment overrides. Besides OPENSSL_CONF, OPENSSL_CONF_INCLUDE appends a higher-priority include directory, a trick container images use to inject provider settings without touching the base configuration. When debugging locally, OPENSSL_CONF=/dev/null temporarily returns a program to the no-configuration default behaviour; comparing that against normal behaviour immediately shows whether a problem lives in the configuration file — the fastest single cut for localising “configuration weirdness”. Application-specific sections. Sections named after an application (such as [CA_default] for the ca command) affect only that subcommand and are not part of the global skeleton; adjust them for experiments, but steer around them for system configuration so lab settings do not leak into machine-wide defaults.
One final working habit: copy a dated backup before editing openssl.cnf. Its syntax tolerance is poor — a mistyped section name or a missing equals sign usually does not produce a “configuration syntax error”; the program silently ignores that section instead, and the symptom becomes “a provider vanished into thin air”. With a backup you can roll back and diff, and within five minutes tell whether you broke it or the environment changed. On production systems, editing this file should go through the same change process as any system configuration; do not edit it casually just because it is “only a text file”.
A concrete example puts the sections above into practice. Goal: on a 3.5 machine, disable TLS 1.1 and below at the system level and make the hybrid group the default first choice. There are exactly two edits — write MinProtocol = TLSv1.2 and the Groups line above into system_default_sect, then save. Verification takes three steps: openssl list -providers confirms the configuration did not break provider loading; start a local service with openssl s_server using the system configuration; then connect with a bare openssl s_client — the protocol version in the output should be no lower than TLSv1.2 and the negotiated group should hit the hybrid group. If s_client still negotiates an old protocol, suspect that you connected to a different service instance, or that the application carries its own TLS configuration and does not read system_default, rather than editing this file over and over.
Zoom out once more: this file is also the lever by which an organisation’s security baseline lands. Writing MinProtocol, the security level and group priorities into a uniformly distributed openssl.cnf is easier to audit and easier to keep consistent than adjusting every application’s TLS settings individually; an audit only needs to collect this file from each machine and diff it, and machines deviating from the baseline stand out immediately. That is the fundamental reason it deserves a place in configuration management and change processes.
Summary
The skeleton of openssl.cnf has just three layers: the entry section registers the provider and ssl lines, the provider sections decide who gets loaded (activate is the real switch), and the ssl section sets the machine-wide TLS floor. It is not mysterious, but it has two tempers — editing the wrong file gives no hint, and a wrong activation fails in silence. So the discipline is fixed: identify the file with version -d first, and after changing it, verify twice, with list and with s_client.
Tags: OpenSSLopenssl.cnfconfigurationprovider