/linux:linux-mail-serverfrom linux
Operate and diagnose Postfix, Exim, and Dovecot mail hosts: queues, SMTP submission, TLS, and SPF/DKIM/DMARC setup on Debian and RHEL.
Ships in linux. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Postfix and Dovecot run on both families and their config layout
(/etc/postfix/main.cf, /etc/dovecot/) is largely identical;
postconf, postmap, postqueue, newaliases behave the same. The
differences are a few package names, the mail log path, and SELinux. Body uses
Debian/Ubuntu; the RHEL family (Fedora, RHEL, CentOS Stream, Rocky, Alma,
Oracle) equivalents are in the matrix.
| Concept | Debian/Ubuntu | RHEL family |
|---|---|---|
| Postfix package / unit | postfix | postfix (same) |
| Default MTA | sometimes exim4 | postfix |
| Dovecot | dovecot-core, dovecot-imapd | dovecot |
| DKIM | opendkim (main) | opendkim (EPEL) |
| Mail log | /var/log/mail.log | /var/log/maillog |
| Config paths | /etc/postfix, /etc/dovecot | same |
| Tools | postconf, postmap, postqueue, newaliases | identical |
RHEL-family gotchas: opendkim (and some milters) come from EPEL
(ensure_epel) on RHEL/Rocky/Alma, but ship in main on Fedora. SELinux governs
Postfix/Dovecot — non-default mail-spool or maildir paths need the right
contexts (restorecon, semanage fcontext) and some integrations need
booleans. Mail logs are in /var/log/maillog (cross-ref linux-log-management).
Deep SELinux coverage is in linux-server-hardening / Phase 2.
In sk-* scripts use the common.sh primitives (pkg_install, ensure_epel,
svc_name) instead of hardcoding the family. See
linux-bash-scripting and
docs/multi-distro/plan.md.
linux-dns-server.linux-network-admin.| Artefact | Source | Required? | If absent |
|---|---|---|---|
| Mail role, software, domain/hostname, and current configuration | Mail host and service owner | required | Return discovery commands; do not edit a guessed topology. |
| Symptom, timestamps, queue IDs, sender/recipient domain, and relevant redacted logs | Incident report and host | required for diagnosis | Mark the affected transport stage not assessed. |
| DNS/TLS/relay ownership and approved test recipient | Domain and service owners | required for change/test | Stop before publishing records or sending mail. |
| Artefact | Consumer | Acceptance condition |
|---|---|---|
| Mail-path diagnosis or configuration change | Mail operator | Locates failure at submission, queue, DNS, transport, policy, mailbox, or reputation layer with evidence. |
| Authentication/TLS evidence | Domain owner | SPF/DKIM/DMARC alignment and certificate/hostname checks are observed, or explicitly unassessed. |
| Delivery verification | Service owner | Approved test mail receives expected SMTP codes and reaches the intended mailbox without creating an open relay. |
| Artefact | Acceptance condition |
|---|---|
| Mail-operation evidence | Includes redacted config, queue samples, log timeline, SMTP transcript, DNS/authentication/TLS results, authorised headers, and rollback. |
Diagnosis defaults to read-only. Mail configuration, queue mutation, DNS publication, certificate changes, service reloads, or sending external test mail require explicit authority. Never expose mailbox credentials, private keys, or message content beyond approved evidence.
Without host, DNS, or recipient access, assess only available layers and label the rest not assessed. A successful TCP connection is not a delivery or reputation pass.
| Choice | Action | Failure or risk avoided |
|---|---|---|
| Queue deferral cluster | Inspect enhanced status/log cause before retry | Amplifying a persistent failure. |
| Authentication passes but spam persists | Examine reputation/content/provider feedback | Rewriting healthy transport config. |
| Submission auth failure | Test SASL/TLS listener and policy | Weakening relay controls. |
For a growing Postfix queue to one provider, sample deferred queue IDs, correlate enhanced status codes and logs, verify DNS/TLS/authentication, correct the evidenced cause, reload only after config validation, retry a small sample, and record delivery before releasing the remainder.
This skill is self-contained. Every command below is a standard mail
tool (postfix, postqueue, postconf, swaks, openssl, dig) present on
both Debian/Ubuntu and the RHEL family; body examples use Debian/Ubuntu
syntax, with RHEL-family differences in the Distro support matrix above.
The sk-* scripts in the Optional fast path section
are convenience wrappers — never required.
This skill covers running and debugging mail on a Debian/Ubuntu or RHEL-family server: Postfix (default), Exim (alternative), Dovecot for IMAP, and the three pillars of email authentication — SPF, DKIM, DMARC.
It does not own:
linux-firewall-ssl.Informed by Linux Network Administrator's Guide (Sendmail/Exim chapters, translated to Postfix) and modern email authentication practice.
mynetworks in main.cf must be
127.0.0.0/8 only by default.postfix check for Postfix,
exim -bV for Exim./var/log/mail.log (syslog) and
journalctl -u postfix — both exist on modern Ubuntu.# Validate config — always run before reload
sudo postfix check
# Show effective config (difference from default)
postconf -n
# Reload
sudo postfix reload
# Or full restart if service behavior is stuck:
sudo systemctl restart postfix
# Service status
sudo systemctl status postfix --no-pager
sudo journalctl -u postfix -n 50 --no-pager
sudo tail -f /var/log/mail.log
# Show queue
sudo postqueue -p
sudo mailq # alias
# Count by status
sudo postqueue -p | grep -c '^[A-F0-9]'
# Inspect a specific message
sudo postcat -q <queue-id>
# Force a flush (try delivery now)
sudo postqueue -f
# Delete a specific stuck message
sudo postsuper -d <queue-id>
# Delete everything (use with extreme care)
sudo postsuper -d ALL
# Install swaks if needed
sudo apt install swaks
# Full SMTP conversation with TLS and auth
swaks --server mail.example.com \
--port 587 \
--from [email protected] \
--to [email protected] \
--auth LOGIN \
--auth-user [email protected] \
--tls \
--header "Subject: test $(date)" \
--body "test body"
# Just the handshake (no auth, no send)
swaks --server mail.example.com --port 587 --quit-after STARTTLS
# With openssl (lower level):
openssl s_client -starttls smtp -connect mail.example.com:587 -crlf
# Type: EHLO test.example.com
# Then: QUIT
# SPF lookup
dig +short TXT example.com | grep spf1
# DKIM selector (replace "default" with your actual selector)
dig +short TXT default._domainkey.example.com
# DMARC
dig +short TXT _dmarc.example.com
# MX record with priorities
dig +short MX example.com
# Reverse DNS (PTR) — must match HELO
dig +short -x $(curl -s https://api.ipify.org)
# Online checkers (for humans, but record the dig output yourself first):
# - https://mxtoolbox.com
# - Gmail Postmaster Tools
Full email-auth deep dive (record syntax, DKIM key generation via
opendkim-genkey, DMARC reporting, example DNS zone snippet) — see
references/email-authentication.md.
Walk references/debugging-delivery.md.
Condensed:
# 1. Queue health
sudo postqueue -p
# 2. Reject reason on a deferred message
sudo postcat -q <queue-id> | tail -20
# 3. SPF / DKIM / DMARC present?
dig +short TXT example.com | grep spf1
dig +short TXT default._domainkey.example.com
dig +short TXT _dmarc.example.com
# 4. PTR matches HELO?
dig +short -x $(postconf -h inet_interfaces | awk '{print $1}')
postconf -h myhostname
# 5. TLS working for submission?
swaks --server mail.example.com --port 587 --quit-after STARTTLS
swaks --server mail.example.com \
--port 587 \
--auth LOGIN \
--auth-user [email protected] \
--tls
Reports each step (connection, STARTTLS, AUTH, MAIL FROM, RCPT TO, DATA).
# 1. How bad?
sudo postqueue -p | tail -5 # last line says "Total requests"
# 2. What's stuck and why?
sudo postqueue -p | head -30
# 3. Pick a message and see the specific rejection:
sudo postcat -q <queue-id>
# 4. Common fixes:
# - Greylist: just wait; Postfix will retry automatically
# - TLS handshake error: check recipient server's cert, your own
# - Auth required: fix relay credentials
# - Relay denied: check mynetworks, smtpd_recipient_restrictions
# 1. Edit main.cf — add to mydestination or virtual_mailbox_domains
sudo nano /etc/postfix/main.cf
# 2. If using virtual mailboxes, update the virtual maps:
sudo nano /etc/postfix/virtual_alias_maps
sudo postmap /etc/postfix/virtual_alias_maps
# 3. Validate
sudo postfix check
# 4. Reload
sudo postfix reload
# 5. Test with swaks
vps-12345.provider.net but Postfix HELOs as
mail.example.com, receivers downgrade you immediately. Fix the PTR
at the VPS provider.postfix reload doesn't reload everything. Changes to master.cf
require sudo systemctl restart postfix. postfix reload only
re-reads main.cf.master.cf — enable both.d=) must match the From: header domain (relaxed alignment)
or exactly (strict). A DKIM-signed bounce that uses the mail server's
hostname as d= won't align with the sender's domain./var/log/mail.log — the
rejection reason is there. The queue only shows the summary.virtual_mailbox_maps must match Dovecot's passdb / userdb. Use
a single source of truth (MySQL, LDAP, or a flat file) and point both
at it.references/postfix-reference.md —
full Postfix reference: main.cf parameters, master.cf, queue
management, 3 complete config examples.references/email-authentication.md —
SPF, DKIM (with opendkim), DMARC deep dive with DNS record examples.references/debugging-delivery.md —
decision tree for delivery problems.postfix(1), postconf(5), master(5), postqueue(1),
postcat(1), swaks(1).No wrapper commands for this skill are shipped in this checkout. Use the native procedures above; planned wrappers remain in the script inventory until their source files are present.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub peterbamuhigire/linux-skills --plugin linux45 skills in this plugin
/cisco-ios-patternsUse when reading or reviewing Cisco IOS/IOS-XE configuration, selecting read-only show commands, or planning and verifying bounded router or switch configuration work. Not for Linux host networking, bulk SSH automation, or config preflight parsing; route those to linux-network-admin, netmiko-ssh-automation, or network-config-validation./linux-access-controlUse when creating, revoking, or auditing Linux users, groups, SSH keys, sudo/wheel access, PAM settings, SELinux user mappings, or file permissions. Use linux-secrets for credential material and linux-server-hardening for broader host policy./linux-archive-integrityUse when creating, signing, encrypting, listing, comparing, or restoring metadata-preserving tar archives on Debian/Ubuntu or RHEL-family hosts. Covers ACLs, xattrs, incrementals, and verification; use linux-rsync-sync for file-tree mirrors.Other plugins' skills for the same job