Tell me how to add a certificate for the subdomain of the main site?

Hello, can you tell me how can I add a new certificate to a new site? Now there is a working domain lkmpikt.org, and I want to connect another auxiliary site with such a domain md.lkmpikt.org
the server runs on:
nginx version: nginx / 1.18.0 (Ubuntu)
version of the certbot:
certbot 1.18.0

I believe you should use --expand

Like this: certbot --expand -d kmpikt.org,md.lkmpikt.org
https://certbot.eff.org/docs/using.html#re-creating-and-updating-existing-certificates

1 Like

Thanks, I'll try now

1 Like

I tried your advice, but the server reported this:
Requested domain is not a FQDN because it contains an empty label.
Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /tmp/tmpu2tqrwsi/log or re-run Certbot with -v for more details.

Oh no, everything changed, accidentally put a space between
lkmpikt.org and so on md.lkmpikt.org

Sounds like this: False "Requested domain is not a FQDN" · Issue #2916 · certbot/certbot · GitHub

They should really trim the input domains so that spaces don't creep in. @_az ? [ Last I checked I think you were working on Certbot stuff]

1 Like

Thank you, everything worked out. )

2 Likes

I'm not sure what a worthwhile fix here would look like, because Certbot is only seeing kmpikt.org, as the argument to -d, which splits into ['kmpikt.org',''].

Even if Certbot skipped over that empty string, it would then trip up on the domain proceeding the space:

certbot: error: unrecognized arguments: md.lkmpikt.org

If the list was wrapped in quotes (-d "a, b"), then it parses correctly even in the presence of spaces.

I can't think of anything to make this more typo-proof while still sticking to shell conventions :woman_shrugging: .

1 Like

Ah, so how does the example linked in the certbot docs work without using quotes?

Preprocess with: Replace ", " with "," where found?
("comma+space" to "comma")

I don't see a space separating the comma and subsequent hostname in the documentation example(s)?

I'm with @_az here: there is a limit to how far one must go. IMO this is such a thing. Note that the space would already mess up the arguments available to Python in sys.argv. I don't think certbot needs to fix all user errors such as inadequate CLI usage.

1 Like

I'm confused :confused:

He said:

And I replied:

I never said I was advocating anything (and I'm not - I don't want certbot to be the Apache of ACME.
I merely responded to his... expression off having run out of ideas / implied question.

Ah, I understand now. I understood @_az s remark more as a figure of speech and not to be literal.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.