Skip to content

Add check commands: tls, dns, headers, email - #2

Merged
bobbyonmagic merged 2 commits into
mainfrom
feat/check-tools
Nov 14, 2026
Merged

bobbyonmagic merged 2 commits into
mainfrom
feat/check-tools

Conversation

@bobbyonmagic

@bobbyonmagic bobbyonmagic commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Adds devops-daily check (and ddy check), four local network checks with plain-language findings:

  • check tls <host[:port]>: TLS version, cipher, certificate (SANs, issuer, dates, days left, warn at 21 days or less), chain, trust against system roots, host name match, OCSP stapling.
  • check dns <name> [--type ...] [--server IP]: records with TTLs and the CNAME chain, followed to its end (dangling aliases and loops fail). Uses miekg/dns.
  • check headers <url>: each redirect hop (301/302/303/307/308), then pass/warn/missing for the security headers (CSP incl. script-src-elem/-attr, all policies), plus cache headers and Server. No grades.
  • check email <domain>: MX, SPF (evaluated like a receiver: first all, lookups toward 10, mx host limit, ip4/ip6 syntax, macros), DMARC (v=DMARC1, policy, pct, rua, t=y), DKIM for common selectors plus --selector (malformed keys fail), MTA-STS (id) and TLS-RPT (rua).

International names work (bücher.de is checked as xn--bcher-kva.de, both shown). All take --json and --timeout (default 5s). Exit codes: 0 all good, 1 warnings, 2 a problem or error. Each report ends with one Learn more link. No telemetry: only the checked host and the DNS server are contacted. Tests use local httptest TLS servers and a local DNS server, no internet.

Not in the SSH app. The checks live in internal/check and only internal/cli uses them. cmd/ssh-site/imports_test.go walks the server's imports and fails if it reaches internal/check or internal/cli (checked by planting an import: the test fails).

Example output (real runs):

ddy check tls expired.badssl.com (expired certificate)
$ ddy check tls expired.badssl.com
TLS check for expired.badssl.com:443

Connection
  info     Address       104.154.89.105:443
           The IP address and port this check connected to.
  pass     TLS version   TLS 1.2
           Still safe. TLS 1.3 is newer and a little faster.
  pass     Cipher suite  TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
           The algorithms that encrypt this connection.

Certificate
  info     Subject        *.badssl.com
           Who the certificate was issued to.
  info     Names (SANs)   *.badssl.com, badssl.com
           The host names this certificate is valid for.
  info     Issuer         COMODO RSA Domain Validation Secure Server CA (COMODO CA
                          Limited)
           The certificate authority (CA) that signed it.
  info     Valid          2015-04-09 00:00 UTC to 2015-04-12 23:59 UTC (4 days in total)
  fail     Expires in     expired 4234 days ago (2015-04-12 23:59 UTC)
           Browsers block the site with a warning page. Renew the certificate now.
  fail     Trusted        no, a certificate in the chain has expired or is not valid yet
           Browsers show a warning page for an untrusted certificate.
  pass     Host name      matches expired.badssl.com
           The certificate covers the name you asked for.
  info     OCSP stapling  no
           No revocation proof is attached. That is common now: browsers rarely ask, and
           Let's Encrypt ended OCSP in 2025.

Chain
  The certificates the server sent, its own first. Each is signed by the next one; the
  root comes from your system.
  1  *.badssl.com, issued by COMODO RSA Domain Validation Secure Server CA, expires
     2015-04-12
  2  COMODO RSA Domain Validation Secure Server CA, issued by COMODO RSA Certification
     Authority, expires 2029-02-11
  3  COMODO RSA Certification Authority, issued by AddTrust External CA Root, expires
     2020-05-30

Result: 2 problems.
Learn more: https://devops-daily.com/games/ssl-tls-handshake
exit 2
ddy check tls bücher.de (international name)
$ ddy check tls bücher.de
TLS check for xn--bcher-kva.de:443 (bücher.de)

Connection
  info     Address       172.67.146.137:443
           The IP address and port this check connected to.
  pass     TLS version   TLS 1.3
           The newest version of TLS.
  pass     Cipher suite  TLS_AES_128_GCM_SHA256
           The algorithms that encrypt this connection.

Certificate
  info     Subject        xn--bcher-kva.de
           Who the certificate was issued to.
  info     Names (SANs)   *.xn--bcher-kva.de, xn--bcher-kva.de
           The host names this certificate is valid for.
  info     Issuer         YE1 (Let's Encrypt)
           The certificate authority (CA) that signed it.
  info     Valid          2026-11-14 06:31 UTC to 2027-02-12 06:31 UTC (90 days in
                          total)
  pass     Expires in     89 days (2027-02-12 06:31 UTC)
           A warning starts at 21 days. Certificates are getting shorter (Let's Encrypt:
           64 days from February 2027, later 45), so renewal must be automatic.
  pass     Trusted        yes, chains to ISRG Root X2
           Your system trusts the CA that signed this chain.
  pass     Host name      matches xn--bcher-kva.de
           The certificate covers the name you asked for.
  info     OCSP stapling  no
           No revocation proof is attached. That is common now: browsers rarely ask, and
           Let's Encrypt ended OCSP in 2025.

Chain
  The certificates the server sent, its own first. Each is signed by the next one; the
  root comes from your system.
  1     xn--bcher-kva.de, issued by YE1, expires 2027-02-12
  2     YE1, issued by Root YE, expires 2028-09-02
  3     Root YE, issued by ISRG Root X2, expires 2032-09-02
  4     ISRG Root X2, issued by ISRG Root X1, expires 2032-09-02
  root  ISRG Root X2 (from your system)

Result: all good.
Learn more: https://devops-daily.com/games/ssl-tls-handshake
exit 0
ddy check dns www.github.com --type A,AAAA,MX --server 1.1.1.1 (CNAME chain)
$ ddy check dns www.github.com --type A,AAAA,MX --server 1.1.1.1
DNS check for www.github.com

DNS server
  Asked  1.1.1.1:53 (chosen with --server)

CNAME chain
  This name is an alias. The records below come from github.com.
  TTL 3535s (58m55s)  www.github.com -> github.com

A records
  IPv4 addresses. Browsers and other clients connect to these.
  TTL 55s  140.82.121.3

AAAA records
  IPv6 addresses.
  warn     none

MX records
  The servers that receive mail for this domain, lowest number tried first.
  TTL 300s (5m)  0 github-com.mail.protection.outlook.com

Result: 1 warning, no problems.
Learn more: https://devops-daily.com/games/dns-simulator
exit 1
ddy check headers devops-daily.com (our site)
$ ddy check headers devops-daily.com
Header check for https://devops-daily.com/

Requests
  Each request, its HTTP status and where a redirect sent you next.
  1.  200 https://devops-daily.com/

Final response
  pass     HTTPS   yes
           The page is encrypted in transit.
  info     Status  200

Security headers
  Headers that turn on browser protections. Each one closes a common attack.
  pass     Strict-Transport-Security  max-age=63072000; includeSubDomains; preload
           Browsers will use only HTTPS here for 730 days after a visit.
  warn     Content-Security-Policy    script-src 'self' 'unsafe-inline' https: (and 10
                                      more directives; --json shows the whole policy)
           Scripts are allowed from 'unsafe-inline' https: (script-src), so an injected
           script can still run. Use nonces or hashes instead.
  pass     X-Content-Type-Options     nosniff
           Browsers will not guess a file's type, so an uploaded text file cannot run as
           a script.
  pass     Frame protection           frame-ancestors 'self'
           The CSP decides which sites may show this page in a frame (stops
           clickjacking).
  pass     Referrer-Policy            strict-origin-when-cross-origin
           Controls how much of the page URL other sites see when a visitor follows a
           link.
  pass     Permissions-Policy         camera=(), microphone=(), geolocation=(),
                                      payment=(), usb=()
           Turns off browser features (camera, microphone, location and so on) the page
           does not use.

Caching and server
  Cache-Control  public, max-age=0, must-revalidate
                 Shared caches and CDNs may keep it; stale at once; once stale, it must
                 be checked before reuse.
  Age            not set
                 No cache in front of the server says it served this copy, so it
                 probably came from the server itself.
  ETag           not set
                 Without it (or Last-Modified), browsers download the page again instead
                 of revalidating it.
  Server         cloudflare
                 The software that answered, as the server reports it.

Result: 1 warning, no problems.
Learn more: https://devops-daily.com/guides/owasp-top-10/05-security-misconfiguration
exit 1
ddy check headers http://github.com (redirect and headers)
$ ddy check headers http://github.com
Header check for http://github.com/

Requests
  Each request, its HTTP status and where a redirect sent you next.
  1.  301 http://github.com/ -> https://github.com/
  2.  200 https://github.com/

Final response
  pass     HTTPS   yes
           The page is encrypted in transit.
  info     Status  200

Security headers
  Headers that turn on browser protections. Each one closes a common attack.
  pass     Strict-Transport-Security  max-age=31536000; includeSubdomains; preload
           Browsers will use only HTTPS here for 365 days after a visit.
  pass     Content-Security-Policy    script-src github.githubassets.com
                                      'sha256-6AKuI+cDd1MoUL1u4eqrA9PXmnPAkOB4h7421hPUUm
                                      0=' (and 14 more directives; --json shows the
                                      whole policy)
           Scripts may load only from the sources listed, which stops most cross-site
           scripting.
  pass     X-Content-Type-Options     nosniff
           Browsers will not guess a file's type, so an uploaded text file cannot run as
           a script.
  pass     Frame protection           frame-ancestors 'none'
           The CSP decides which sites may show this page in a frame (stops
           clickjacking).
  pass     Referrer-Policy            strict-origin-when-cross-origin
           Controls how much of the page URL other sites see when a visitor follows a
           link.
  info     Permissions-Policy         not set
           Optional. Lets you turn off browser features (camera, microphone, location)
           the page does not use.

Caching and server
  Cache-Control  max-age=0, private, must-revalidate
                 Stale at once; only the browser may keep it, not shared caches or CDNs;
                 once stale, it must be checked before reuse.
  Age            not set
                 No cache in front of the server says it served this copy, so it
                 probably came from the server itself.
  ETag           W/"df1f958fca408030974d5375518a6472"
                 A version tag. Browsers send it back to ask "has this changed?" and get
                 a short 304 reply if not.
  Server         github.com
                 The software that answered, as the server reports it.

Result: all good.
Learn more: https://devops-daily.com/guides/owasp-top-10/05-security-misconfiguration
exit 0
ddy check email devops-daily.com --server 1.1.1.1 (our domain)
$ ddy check email devops-daily.com --server 1.1.1.1
Email check for devops-daily.com

DNS server
  Asked  1.1.1.1:53 (chosen with --server)

Mail servers (MX)
  The servers that receive mail for this domain. Senders try the lowest number first.
  10  flex.ns1.bg

SPF
  Lists the servers allowed to send mail as this domain. Receivers compare it with the
  sending server.
  pass     Record         v=spf1 include:amazonses.com
                          include:spf.efwd.registrar-servers.com ip4:79.124.76.82 ~all
  pass     DNS lookups    2 of 10
           Each include, a, mx, ptr, exists and redirect costs one DNS lookup, nested
           ones too. Over 10 and SPF fails.
  pass     Other servers  ~all
           Softfail: mail from servers not listed is marked suspicious. Fine together
           with a DMARC policy.

DMARC
  Tells receivers what to do with mail that fails both SPF and DKIM for this domain, and
  where to send reports.
  pass     Record         v=DMARC1;p=none;
  warn     Policy (p)     none
           Monitoring only: mail that fails is still delivered. Move to quarantine, then
           reject, once the reports look clean.
  info     Percent (pct)  not set (all mail)
           The policy applies to all failing mail.
  warn     Reports (rua)  not set
           Without rua you get no reports, so you cannot see who sends mail as you or
           whether it passes.

DKIM
  Public keys that receivers use to check the signature on your mail. Each key sits
  under a selector name.
  Not found  default, google, selector1, selector2, k1, s1, mail, dkim
  Result     no key at the common selectors
             That does not prove DKIM is missing: many providers (Amazon SES, for
             example) use their own selector names. Find s= in the DKIM-Signature header
             of a message from this domain and run again with --selector <name>.

MTA-STS and TLS-RPT
  Optional. They make other mail servers use TLS when they deliver to you, and report
  when that fails.
  MTA-STS  not set
           Without it, a sender may deliver in plain text when TLS to your servers
           fails. The policy would live at
           https://mta-sts.devops-daily.com/.well-known/mta-sts.txt.
  TLS-RPT  not set
           Lets senders report TLS problems when they deliver to you.

Result: 2 warnings, no problems.
Learn more: https://devops-daily.com/games/email-auth-lab
exit 1
ddy check email gmail.com --server 1.1.1.1 (SPF, DMARC, MTA-STS)
$ ddy check email gmail.com --server 1.1.1.1
Email check for gmail.com

DNS server
  Asked  1.1.1.1:53 (chosen with --server)

Mail servers (MX)
  The servers that receive mail for this domain. Senders try the lowest number first.
  5   gmail-smtp-in.l.google.com
  10  alt1.gmail-smtp-in.l.google.com
  20  alt2.gmail-smtp-in.l.google.com
  30  alt3.gmail-smtp-in.l.google.com
  40  alt4.gmail-smtp-in.l.google.com

SPF
  Lists the servers allowed to send mail as this domain. Receivers compare it with the
  sending server.
  pass     Record         v=spf1 redirect=_spf.google.com
  pass     DNS lookups    1 of 10
           Each include, a, mx, ptr, exists and redirect costs one DNS lookup, nested
           ones too. Over 10 and SPF fails.
  pass     Other servers  ~all (from redirect=_spf.google.com)
           Softfail: mail from servers not listed is marked suspicious. Fine together
           with a DMARC policy.

DMARC
  Tells receivers what to do with mail that fails both SPF and DKIM for this domain, and
  where to send reports.
  pass     Record           v=DMARC1; p=none; sp=quarantine;
                            rua=mailto:mailauth-reports@google.com
  warn     Policy (p)       none
           Monitoring only: mail that fails is still delivered. Move to quarantine, then
           reject, once the reports look clean.
  info     Subdomains (sp)  quarantine
           The policy for subdomains.
  info     Percent (pct)    not set (all mail)
           The policy applies to all failing mail.
  pass     Reports (rua)    mailto:mailauth-reports@google.com
           Daily summary reports of who sends mail as you go here.

DKIM
  Public keys that receivers use to check the signature on your mail. Each key sits
  under a selector name.
  Not found  default, google, selector1, selector2, k1, s1, mail, dkim
  Result     no key at the common selectors
             That does not prove DKIM is missing: many providers (Amazon SES, for
             example) use their own selector names. Find s= in the DKIM-Signature header
             of a message from this domain and run again with --selector <name>.

MTA-STS and TLS-RPT
  Optional. They make other mail servers use TLS when they deliver to you, and report
  when that fails.
  pass     MTA-STS  v=STSv1; id=20190429T010101;
           Senders fetch the policy from
           https://mta-sts.gmail.com/.well-known/mta-sts.txt (not downloaded by this
           check).
  pass     TLS-RPT  v=TLSRPTv1;rua=mailto:sts-reports@google.com
           Senders report TLS problems delivering to you to the rua address.

Result: 1 warning, no problems.
Learn more: https://devops-daily.com/games/email-auth-lab
exit 1

Four local network checks with plain-language findings, --json,
--timeout and exit codes 0/1/2. They live in internal/check and are
kept out of the SSH app; cmd/ssh-site/imports_test.go enforces it.
…n, CSP, redirects, CNAME chains, IDN

SPF stops at the first all, counts redirect only when used, checks the
mx host limit, ip4/ip6 syntax and macros. DMARC needs v=DMARC1 exactly
and explains t=y. DKIM, MTA-STS and TLS-RPT records are validated.
CSP covers script-src-elem/-attr and all policies for frame-ancestors;
HSTS duplicates and repeated Referrer-Policy headers are handled. Only
real redirect statuses are followed and --timeout covers dial and TLS.
CNAME-only answers are followed to their end. International names are
converted with IDNA and shown in both forms. DKIM not found and missing
Referrer-Policy/Permissions-Policy are now info.
@bobbyonmagic
bobbyonmagic merged commit 3ebf1f8 into main Nov 14, 2026
3 checks passed
@bobbyonmagic
bobbyonmagic deleted the feat/check-tools branch November 14, 2026 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant