# Implement port knocking

**URL:** <https://community.letsencrypt.org/t/implement-port-knocking/171328>\
**Category:** Feature Requests\
**Created:** [February 4, 2022, 5:23pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328 "2022-02-04T17:23:47Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![slapchop44](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@slapchop44](https://community.letsencrypt.org/u/slapchop44)\
**Post date:** [February 4, 2022, 5:23pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/1 "2022-02-04T17:23:47Z")

</div>

I am using LetsEncrypt for internal domain certs. I do not want to expose my DNS server to the entire internet. If LetsEncrypt could knock before it queries for my txt record, I could open my firewall temporarily for LetsEncypt source IP to validate.

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [February 4, 2022, 5:25pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/2 "2022-02-04T17:25:27Z")

</div>

Can't you implement a script to allow the firewall temporarily just before the renewal/issuance and close it again after your ACME client is finished?

---

<div class="post-metadata">

**Author:** ![9peppe](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/9peppe/32/31596_2.png) [@9peppe](https://community.letsencrypt.org/u/9peppe)\
**Post date:** [February 4, 2022, 5:27pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/3 "2022-02-04T17:27:15Z")

</div>

Let's Encrypt only cares about the authoritative nameservers for your domain, it doesn't matter if you use a different one for internal use.

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [February 4, 2022, 5:30pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/4 "2022-02-04T17:30:01Z")

</div>

I'm _assuming_ the authorative DNS servers _are_ internal (but somehow accessible from the public internet too).But you're right, assumptions are the mother of all...

---

<div class="post-metadata">

**Author:** ![9peppe](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/9peppe/32/31596_2.png) [@9peppe](https://community.letsencrypt.org/u/9peppe)\
**Post date:** [February 4, 2022, 5:32pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/5 "2022-02-04T17:32:53Z")

</div>

A firewalled authoritative DNS whose IP address is in a public DNS record makes no sense to me.

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [February 4, 2022, 5:33pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/6 "2022-02-04T17:33:20Z")

</div>

It doesn't to me too, but that's the only situation I can imagine from OPs request based on the info we have.

---

<div class="post-metadata">

**Author:** ![petercooperjr](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/petercooperjr/32/84698_2.png) [@petercooperjr](https://community.letsencrypt.org/u/petercooperjr)\
**Post date:** [February 4, 2022, 6:24pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/7 "2022-02-04T18:24:22Z")

</div>

Most people seem to be fine with having authoritative DNS servers publicly accessible, even if they don't have any other servers public.

But if you need to, the way is to do whatever scripting (to do "port knocking" or whatever actions need to happen to open up the firewall) yourself, as part of the renewal process, in order to have the DNS server (and web server too if using HTTP-01 or TLS-ALPN-01) be open to the world only for the time actively being renewed, and lock the ports back up again after. For instance, certbot offers `--pre-hook` and `--post-hook` for this purpose.

---

<div class="post-metadata">

**Author:** ![9peppe](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/9peppe/32/31596_2.png) [@9peppe](https://community.letsencrypt.org/u/9peppe)\
**Post date:** [February 4, 2022, 6:31pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/8 "2022-02-04T18:31:53Z")

</div>

> [@petercooperjr](#):
>
> Most people seem to be fine with having authoritative DNS servers publicly accessible, even if they don't have any other servers public.

It's more like all part of a public infrastructure starting from the root `.` zone, what's the point in being part of this public delegation graph but refusing queries?

You can make your isolated and private DNS, if you want.

---

<div class="post-metadata">

**Author:** ![jvanasco](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/jvanasco/32/55900_2.png) [@jvanasco](https://community.letsencrypt.org/u/jvanasco)\
**Post date:** [February 4, 2022, 6:51pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/9 "2022-02-04T18:51:38Z")

</div>

> [@slapchop44](#):
>
> If LetsEncrypt could knock before it queries for my txt record, I could open my firewall temporarily for LetsEncypt source IP to validate.

1. Certbot has pre/post hooks designed for that.

2. Your suggestion is not fundamentally different from the suggestions for LetsEncrypt to publish a list of their interrogating server IPs. ISRG has made a clear stance they will not publish their IPs, and their arguments in support of that position apply equally to this use case.

3. For DNS-01 challenges, you can delegate acme-challenge records to an secondary DNS server , such as acme-dns, running on the public internet. For HTTP-01 challenges, you can implement redirects on your firewall.

---

<div class="post-metadata">

**Author:** ![slapchop44](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@slapchop44](https://community.letsencrypt.org/u/slapchop44)\
**Post date:** [February 4, 2022, 7:10pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/10 "2022-02-04T19:10:27Z")

</div>

1: I will have to research what pre/post hooks can do. Thank you for making me aware of this.

2: I'm not sure I agree with what you've said here. LetsEncrypt does not publish a source IP list, because of this I have to expose my internal DNS server to the entire internet. I want to limit my services exposure as much as possible. So to get around the issue, LetsEncrypt could knock, I could see the knock source, and temporarily open the port for that source, keeping my internal DNS server unavailable to the public internet.

3: This looks like a useful workaround, however this is not something I can do with our security policies.

---

<div class="post-metadata">

**Author:** ![slapchop44](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@slapchop44](https://community.letsencrypt.org/u/slapchop44)\
**Post date:** [February 4, 2022, 7:13pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/11 "2022-02-04T19:13:15Z")

</div>

This is pretty much what I would like to do, but I would like to restrict it to the source IP found in a successful knock. Your suggestion leaves my DNS server available to the entire internet for the duration specified in the hook script, not bad, but a knock would be better.

---

<div class="post-metadata">

**Author:** ![slapchop44](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@slapchop44](https://community.letsencrypt.org/u/slapchop44)\
**Post date:** [February 4, 2022, 7:15pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/12 "2022-02-04T19:15:36Z")

</div>

It's useful to use LetsEncrypt for internal domains. I can auto-renew certs with a CA that is already trusted my most devices. Rather than using my own CA where there needs to be a mechanism to install the trusted certs to every service / device that will access the resource.

---

<div class="post-metadata">

**Author:** ![slapchop44](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@slapchop44](https://community.letsencrypt.org/u/slapchop44)\
**Post date:** [February 4, 2022, 7:16pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/13 "2022-02-04T19:16:30Z")

</div>

Yes but that temporarily opens up my internal DNS server to the entire internet. We take security very seriously and would like to do better.

---

<div class="post-metadata">

**Author:** ![9peppe](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/9peppe/32/31596_2.png) [@9peppe](https://community.letsencrypt.org/u/9peppe)\
**Post date:** [February 4, 2022, 7:17pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/14 "2022-02-04T19:17:41Z")

</div>

well... you should use the acme-dns solution.

one dns stays closed, the other stays open. the closed one is used by your clients, the open one is just to validate (but it's the dns in the public system)

---

<div class="post-metadata">

**Author:** ![slapchop44](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@slapchop44](https://community.letsencrypt.org/u/slapchop44)\
**Post date:** [February 4, 2022, 7:19pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/15 "2022-02-04T19:19:34Z")

</div>

I haven't looked into this, I'll check it out. Thanks for the info and the time.

---

<div class="post-metadata">

**Author:** ![Osiris](https://avatars.discourse-cdn.com/v4/letter/o/839c29/32.png) [@Osiris](https://community.letsencrypt.org/u/Osiris)\
**Post date:** [February 4, 2022, 7:20pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/16 "2022-02-04T19:20:55Z")

</div>

> [@9peppe](#):
>
> well... you should use the acme-dns solution.

Depending on where the authorative DNS servers of the domain are located, this might not be possibe. It could be the DNS servers of the TLD refer to the authorative DNS server directly which _could_ already be behind the firewall. And the TLD DNS servers cannot provide a CNAME for the `_acme-challenge` subdomain.

> [@slapchop44](#):
>
> Yes but that temporarily opens up my internal DNS server to the entire internet. We take security very seriously (…)

Why would the first impede on your security? There are millions of DNS servers on the public internet. Or are you running ancient versions of a DNS server, full of remotely exploitable bugs? Only in that case I would slightly agree, but I'd rather say to take down that DNS server entirely. On the other hand, if your DNS server is up to date and you also respond quickly on exploit reports, I wouldn't know why exposing a DNS server to the public internet would be a problem.

---

<div class="post-metadata">

**Author:** ![9peppe](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/9peppe/32/31596_2.png) [@9peppe](https://community.letsencrypt.org/u/9peppe)\
**Post date:** [February 4, 2022, 7:22pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/17 "2022-02-04T19:22:57Z")

</div>

Right. So it's time to suggest a split horizon dns system. Which is a real pain.

---

<div class="post-metadata">

**Author:** ![slapchop44](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@slapchop44](https://community.letsencrypt.org/u/slapchop44)\
**Post date:** [February 4, 2022, 7:23pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/18 "2022-02-04T19:23:35Z")

</div>

So I've just read the README.md for this. Its useful, however its just casing the problem around. I still have to expose a service to the entire internet. This is what I am unable to do.

---

<div class="post-metadata">

**Author:** ![9peppe](https://sea3.discourse-cdn.com/letsencrypt/user_avatar/community.letsencrypt.org/9peppe/32/31596_2.png) [@9peppe](https://community.letsencrypt.org/u/9peppe)\
**Post date:** [February 4, 2022, 7:25pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/19 "2022-02-04T19:25:56Z")

</div>

You have to expose something, either http, tls, or dns.

Your choice what you expose.

You can expose a different dns server than your internal one, but it must be the set of authoritative ones referred in your SOA and NS records. This is what split horizon means: internal clients see a dns, the rest of the internet sees another.

---

<div class="post-metadata">

**Author:** ![slapchop44](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@slapchop44](https://community.letsencrypt.org/u/slapchop44)\
**Post date:** [February 4, 2022, 7:28pm UTC](https://community.letsencrypt.org/t/implement-port-knocking/171328/20 "2022-02-04T19:28:44Z")

</div>

There seem to be some logical fallacies here, and I don't want to get into that.  
Even if I am running the latest greatest DNS service there is, if its available on the internet there is a chance a bad actor can find a way to exploit it. If a bad actor can somehow, some way hack the service, they may now have access to do things in my internal network. Even if its in a DMZ, or a subnet by itself, there is still a risk no matter how small. I'd like to keep that risk as small as possible. If my DNS server only needs to be accessed by LetsEncrypt to verify a txt record, then only LetsEncrypt should be able to connect and verify.

[Next page](https://community.letsencrypt.org/t/implement-port-knocking/171328.md?page=2)
