← /blog

The file is not the configuration

2026-10-18 · Linux hardening · 4 min read

One question about one host: is password authentication on for SSH? Not a hard question. It has a yes/no answer, it is written down somewhere, and the host knows it.

It took four files to answer it. And I never wrote one of them.

What I read first

Open the obvious file, find the obvious line:

$ sed -n 65p /etc/ssh/sshd_config
#PasswordAuthentication yes

It is commented out. So the file declares nothing, the compiled default applies, and the default is… yes. Fine. Question answered, right?

No. Because "commented out" only tells you what this file says. It says nothing about what else is in the chain.

What the host actually does

$ sshd -T | grep -i '^passwordauthentication'
passwordauthentication yes

Enabled. Two caveats before going further. First, sshd -T does not tell you why — whether that is the default or something set it, so the next question is which file decided.

Second, and more important: sshd -T parses the configuration and prints what the daemon would apply. It does not read the memory of the running process. If someone edited a file after the last reload, sshd -T shows the new value while the daemon still enforces the old one. The two are usually the same; they are not the same statement. The way to close that gap is a fresh connection whose behavior you observe, or a reload followed by the same check.

Where it comes from

/etc/ssh/sshd_config
  └ Include /etc/ssh/sshd_config.d/*.conf
    └ 40-redhat-crypto-policies.conf
      └ Include /etc/crypto-policies/back-ends/opensshserver.config

Four files. The second is a glob — any file dropped into that directory joins the configuration, and nothing in the main file hints at what is in there. The fourth is generated by the crypto-policies subsystem: not a file you edit, a file the system writes.

On this host, the value turned out to be the compiled default — nothing in the chain overrode it. But you cannot know that without reading the whole chain, and the chain has a wildcard in the middle and a generated file at the end.

The glob cuts both ways

A glob is a promise and a trap. Two cases, same directory, two evenings apart.

$ sudo ls -l /etc/ssh/sshd_config.d/
-rw-r--r-- 1 root root 17  00-hardening.conf
-rw-r--r-- 1 root root 17  '00=hardening.conf'    ← read anyway

The second file was a typo: = where a - belonged. It matched *.conf, so sshd read it, and sshd -T showed values from a file that cat on the expected path did not reveal. Two drop-ins were in force at the same time, and only one of them was in my head.

$ sudo ls -l /etc/ssh/sshd_config.d/
-rw-r--r-- 1 root root 47  00-hardening.conf
-rw-r--r-- 1 root root 44  00-hardening.conf.bak   ← never read

The opposite happens just as often. A backup copy left in the same directory looks like broken configuration and is silently ignored: no warning, no error, nothing in the log. It behaves like an empty file while looking like a problem.

So the check is not “does this file end in .conf”. It is “which files match the glob this host actually uses”:

$ grep -n '^Include' /etc/ssh/sshd_config
24:Include /etc/ssh/sshd_config.d/*.conf

Here the glob is *.conf, so 00=hardening.conf counted and 00-hardening.conf.bak did not. On another host the include line can read differently, or be missing — in which case the whole directory is decoration and your careful edits do nothing.

Why this matters more than it sounds

Because it turns a sentence you have probably said into one you cannot support:

“I read the config.” Which config? The file you opened, or the configuration the daemon resolved — which is that file plus every file it includes, recursively, plus whatever the distro generates into it?

And it is worse on an immutable host. On Fedora Atomic, Bazzite or a bootc image, /usr is the signed image and /etc is a persistent layer on top of it: across upgrades, bootc performs a three-way merge — the new image's /etc as the base, the diff between the current and previous /etc applied onto it, and files you modified kept over the image default (which is exposed read-only as /usr/etc). Enable [etc] transient = true and /etc is not persisted at all, so the image's copy wins outright.

Either way the conclusion holds: the file in /etc is a layer, not the truth. The old advice — “check the config file” — quietly stopped being true, and ostree admin config-diff is the command that shows what actually diverged.

What to do instead

Ask the two questions separately, and never accept an answer to only one of them:

1. what does it EVALUATE to?        sshd -T · sysctl -n · nft list ruleset
                                    (that is the next start/reload, not
                                     the running process — close the gap
                                     with a fresh connection or a reload)
2. which file and line SET it?      follow the includes, recursively,
                                    and say when the answer is "the default"

That is the idea behind state-witness, the tool I have been building. Being precise about what it delivers today: it reports the effective value (read through sshd -T, sysctl -n, the live filter) together with the mechanism it was read from, and it says “skip, and here is why” when a check cannot run. It does not yet attribute a value to a specific file and line — the config-file hunt is still something a human does, with the includes in front of them.

That distinction is the difference between a tool that sounds clever and one you can trust: attribute what you actually read, and name what you have not implemented.

The takeaway

A finding without provenance is a claim. A finding with provenance is evidence — you can re-run it, and it either reproduces or it doesn't. “Password authentication is enabled” is a claim. “Password authentication is enabled, and here is the chain that resolves to that” is something you can check.

Four files to answer one question is not a flaw in the host. It is how Linux configuration has always worked. The flaw is pretending otherwise.

Sources: sshd_config(5) and sshd(8) for -T; bootc — Filesystem for the /etc three-way merge and etc.transient.

Want your server checked? I run a read-only Server Health Check — what's exposed, severity, top 3 fixes. If I find nothing, you don't pay.