Domains, DNS and Certificates
Outcome: you know how a domain joins a YunoHost server, which DNS records it will ask you to create, and how the padlock in the browser goes from a scary warning to a proper certificate.
A YunoHost server can carry several
domains: one main domain (home of
the portal and the default mail domain)
and others besides — a second name for
a public site, a subdomain per app.
Adding a domain is a webadmin action
(Domains, then add) or a command
(yunohost domain add). What happens
next is the real work, and it happens
at your registrar.
The DNS records YunoHost asks for
For each domain, YunoHost generates a recommended DNS configuration. Read it in the webadmin (Domain, your domain, DNS configuration) or print it:
yunohost domain dns suggest your.domain.tld
Copy it to your registrar's DNS editor exactly. Following the documentation's example, the list contains:
- A (and AAAA, if your server has IPv6) records pointing the domain — and a wildcard for its subdomains — at your server's address. The wildcard is why a new subdomain for a new app usually needs no fresh DNS work.
- Mail records: an MX record naming your server as the domain's mail handler, and the three TXT records that make other mail servers trust it — SPF (who may send for this domain), DKIM (a public key matching the signatures on your outgoing mail), and DMARC (what to do with mail that fails those checks).
- Chat records (SRV records for XMPP) when the domain hosts YunoHost's chat services.
- A suggested TTL of 3600 (one hour) on everything.
Two warnings from the documentation deserve their own paragraphs:
- Do not add an IPv6 record unless IPv6 genuinely works on your server. A broken AAAA record causes real harm, including failed certificate requests.
- The reverse DNS is not set at your registrar. It belongs to whoever owns your IP address — your ISP or VPS provider. Chapter 9 explains why mail cares; the short version is that receiving mail servers compare your server's claimed name against the reverse lookup of its address, and penalise a mismatch.
If you took a free .nohost.me,
.noho.st or .ynh.fr domain instead,
this whole section is done for you —
that automation is the offer — and the
domains can also be kept current on a
changing home IP by YunoHost's dynamic
DNS (the yunohost domain dyndns
commands).
Certificates: from self-signed to Let's Encrypt
Every domain starts with a self-signed certificate: the server vouches for itself. Encryption works, but browsers show a warning because no outside authority vouches for the server's identity. The fix is a certificate from Let's Encrypt, the free authority browsers trust, and YunoHost installs it for you:
- In the webadmin: Domains, your domain, Certificate, then the install button for Let's Encrypt.
- Or by command:
yunohost domain cert install your.domain.tld
Before trying, the documentation insists
on the two preconditions — and the
diagnosis tool (chapter 10) checks both:
your DNS is correct (the domain
resolves to this server) and the domain
is reachable over HTTP from outside
(port 80 forwarded), because Let's
Encrypt proves you control the domain by
visiting it. Once installed, the
certificate renews automatically —
the documentation describes the cycle as
every three months — and
yunohost domain cert status and
yunohost domain cert renew cover
checking and forcing it by hand.
If a certificate ever ends up in a bad state, the documented recovery is to regenerate the self-signed one and start again:
yunohost domain cert install your.domain.tld --self-signed --force
And if YunoHost wrongly insists a
well-configured domain is broken — a
known curiosity on some home networks,
where the server cannot resolve its own
public name — the certificate page
documents the workarounds, from adding
the domain to the server's /etc/hosts
to a deliberate --no-checks flag.
Reach for those only after the diagnosis
agrees your DNS is right; skipping the
checks does not fix the DNS, it merely
stops asking.
Subdomains and apps
With the wildcard record in place, the
usual pattern is one subdomain per
public app — photos.example.org,
files.example.org — each added as its
own domain in YunoHost so it gets its
own certificate and its own permissions,
while smaller or private apps can live
under a path of an existing domain
instead. Chapter 8's installs will ask
you to choose; chapter 3's advice
applies throughout: the name is
structural, so pick names you can live
with.