Relay DNS and mailbox provisioning over restricted SSH connections
This commit is contained in:
1 parent
df9f7c3284
commit
dc19e4a59a
10 files changed
+91
-2
No files matched your search
@@ -0,0 +1,20 @@
|
|||||||
|
Match User coulobre-dns-request,coulobre-mail-request
|
||||||
|
AuthenticationMethods publickey
|
||||||
|
PubkeyAuthentication yes
|
||||||
|
PasswordAuthentication no
|
||||||
|
KbdInteractiveAuthentication no
|
||||||
|
AuthorizedKeysFile /etc/ssh/coulobre-node-keys/%u
|
||||||
|
AuthorizedKeysCommand none
|
||||||
|
TrustedUserCAKeys none
|
||||||
|
DisableForwarding yes
|
||||||
|
PermitTunnel no
|
||||||
|
PermitTTY no
|
||||||
|
PermitUserRC no
|
||||||
|
|
||||||
|
Match User coulobre-dns-request
|
||||||
|
ForceCommand /usr/bin/socat -t 185 STDIO UNIX-CONNECT:/run/coulobre-dns-apply.sock
|
||||||
|
|
||||||
|
Match User coulobre-mail-request
|
||||||
|
ForceCommand /usr/bin/socat -t 185 STDIO UNIX-CONNECT:/run/coulobre-mail-apply.sock
|
||||||
|
|
||||||
|
Match all
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
Host coulobre-dns-node
|
||||||
|
HostName dns.example.org
|
||||||
|
Port 22
|
||||||
|
User coulobre-dns-request
|
||||||
|
IdentityFile /etc/coulobre-remote/dns/id_ed25519
|
||||||
|
IdentityAgent none
|
||||||
|
IdentitiesOnly yes
|
||||||
|
PreferredAuthentications publickey
|
||||||
|
UserKnownHostsFile /etc/coulobre-remote/dns/known_hosts
|
||||||
|
GlobalKnownHostsFile none
|
||||||
|
StrictHostKeyChecking yes
|
||||||
|
BatchMode yes
|
||||||
|
ConnectTimeout 5
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
Host coulobre-mail-node
|
||||||
|
HostName mail.example.org
|
||||||
|
Port 22
|
||||||
|
User coulobre-mail-request
|
||||||
|
IdentityFile /etc/coulobre-remote/mail/id_ed25519
|
||||||
|
IdentityAgent none
|
||||||
|
IdentitiesOnly yes
|
||||||
|
PreferredAuthentications publickey
|
||||||
|
UserKnownHostsFile /etc/coulobre-remote/mail/known_hosts
|
||||||
|
GlobalKnownHostsFile none
|
||||||
|
StrictHostKeyChecking yes
|
||||||
|
BatchMode yes
|
||||||
|
ConnectTimeout 5
|
||||||
@@ -12,6 +12,7 @@ COULOBRE_BROKER_URL=amqp://coulobre:@127.0.0.1:5672/coulobre
|
|||||||
# COULOBRE_LOCAL_WEB_HTTPS=1
|
# COULOBRE_LOCAL_WEB_HTTPS=1
|
||||||
# COULOBRE_LOCAL_WEB_SFTP=1
|
# COULOBRE_LOCAL_WEB_SFTP=1
|
||||||
# COULOBRE_LOCAL_DATABASE_PROVISIONING=1
|
# COULOBRE_LOCAL_DATABASE_PROVISIONING=1
|
||||||
|
# These two switches also enable provisioners using the SSH service drop-ins.
|
||||||
# COULOBRE_LOCAL_DNS_PUBLISHING=1
|
# COULOBRE_LOCAL_DNS_PUBLISHING=1
|
||||||
# COULOBRE_LOCAL_MAILBOX_PROVISIONING=1
|
# COULOBRE_LOCAL_MAILBOX_PROVISIONING=1
|
||||||
# COULOBRE_LOCAL_DATABASE_CREDENTIALS=1
|
# COULOBRE_LOCAL_DATABASE_CREDENTIALS=1
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Coulobre remote BIND9 publishing request
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=coulobre-dns-publisher
|
||||||
|
Group=coulobre-dns-publisher
|
||||||
|
UMask=0077
|
||||||
|
ReadWritePaths=
|
||||||
|
ExecStart=
|
||||||
|
ExecStart=/usr/bin/ssh -T -F /etc/coulobre-remote/dns/ssh_config coulobre-dns-node
|
||||||
|
RuntimeMaxSec=190s
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Coulobre Panel local BIND9 publishing worker
|
Description=Coulobre Panel BIND9 publishing worker
|
||||||
Requires=coulobre-dns-apply.socket
|
Requires=coulobre-dns-apply.socket
|
||||||
Wants=network-online.target
|
Wants=network-online.target
|
||||||
After=network-online.target coulobre-dns-apply.socket mariadb.service rabbitmq-server.service
|
After=network-online.target coulobre-dns-apply.socket mariadb.service rabbitmq-server.service
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Coulobre remote mailbox provisioning request
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=coulobre-mail-provisioner
|
||||||
|
Group=coulobre-mail-provisioner
|
||||||
|
UMask=0077
|
||||||
|
StateDirectory=
|
||||||
|
ExecStart=
|
||||||
|
ExecStart=/usr/bin/ssh -T -F /etc/coulobre-remote/mail/ssh_config coulobre-mail-node
|
||||||
|
RuntimeMaxSec=190s
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Coulobre Panel local mailbox provisioning worker
|
Description=Coulobre Panel mailbox provisioning worker
|
||||||
Requires=coulobre-mail-apply.socket
|
Requires=coulobre-mail-apply.socket
|
||||||
Wants=network-online.target
|
Wants=network-online.target
|
||||||
After=network-online.target coulobre-mail-apply.socket mariadb.service rabbitmq-server.service
|
After=network-online.target coulobre-mail-apply.socket mariadb.service rabbitmq-server.service
|
||||||
|
|||||||
@@ -212,6 +212,10 @@ def apply_on_local_node(
|
|||||||
|
|
||||||
if len(body) > RESPONSE_LIMIT:
|
if len(body) > RESPONSE_LIMIT:
|
||||||
raise ValueError(f"The {node} returned an oversized response.")
|
raise ValueError(f"The {node} returned an oversized response.")
|
||||||
|
if not body:
|
||||||
|
raise ValueError(
|
||||||
|
f"The {node} closed the connection without a response."
|
||||||
|
)
|
||||||
invalid_response = (
|
invalid_response = (
|
||||||
f"The {node} returned an invalid response for this {resource}."
|
f"The {node} returned an invalid response for this {resource}."
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -149,6 +149,22 @@ class DnsPublicationTests(TestCase):
|
|||||||
|
|
||||||
|
|
||||||
class DnsPublicationSocketTests(SimpleTestCase):
|
class DnsPublicationSocketTests(SimpleTestCase):
|
||||||
|
def test_closed_connection_reports_a_missing_reply(self):
|
||||||
|
zone = DnsZone(
|
||||||
|
"site.example",
|
||||||
|
1,
|
||||||
|
("ns.provider.example",),
|
||||||
|
"hostmaster.site.example",
|
||||||
|
)
|
||||||
|
with patch("coulobre.hosting.node_client.socket.socket") as socket:
|
||||||
|
connection = socket.return_value.__enter__.return_value
|
||||||
|
connection.makefile.return_value.__enter__.return_value = BytesIO()
|
||||||
|
with self.assertRaisesMessage(
|
||||||
|
ValueError,
|
||||||
|
"The BIND9 node closed the connection without a response.",
|
||||||
|
):
|
||||||
|
publish_local_zone(zone)
|
||||||
|
|
||||||
def test_receipt_must_identify_the_exact_soa_serial(self):
|
def test_receipt_must_identify_the_exact_soa_serial(self):
|
||||||
zone = DnsZone(
|
zone = DnsZone(
|
||||||
"site.example",
|
"site.example",
|
||||||
|
|||||||
Reference in new issue
Block a user