From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.8 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, T_SCC_BODY_TEXT_LINE,UNWANTED_LANGUAGE_BODY shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id EE9831F601 for ; Thu, 11 Aug 2022 20:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1660248792; bh=Twpvf7L0pnL5RqYff0niGicKy60PKnsFBTMOdYqg7nI=; h=From:To:Subject:Date:In-Reply-To:References:From; b=zyF3nBfAB1gVXP6LnBZzlItSCkEc9g6lDwfUPxwY7uy86PTdLFFh5hMmVb/GGERHO Rvtb4vOY3RgVBiAEEA2yH0AibXq69vsPy/lJ40Ba+wz+nUKPSsbCr5dR3tBQwBRsvM B47FJKukPIH8SSmRP+Yxjm9QikfUzAa2uE99vTGE= From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 2/4] examples: consolidate systemd socket examples Date: Thu, 11 Aug 2022 20:13:09 +0000 Message-Id: <20220811201311.21922-3-e@80x24.org> In-Reply-To: <20220811201311.21922-1-e@80x24.org> References: <20220811201311.21922-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: systemd.socket(5) files can actually contain multiple listen sockets, so shave down inode overhead and simplify config file management by consolidating all applicable ports into a single file for each daemon. --- MANIFEST | 3 --- examples/public-inbox-imap-onion.socket | 12 ------------ examples/public-inbox-imapd.socket | 14 +++++++++++++- examples/public-inbox-imapd@.service | 9 +++------ examples/public-inbox-imaps.socket | 12 ------------ examples/public-inbox-nntpd.socket | 18 ++++++++++++++++-- examples/public-inbox-nntpd@.service | 6 +++--- examples/public-inbox-nntps.socket | 12 ------------ 8 files changed, 35 insertions(+), 51 deletions(-) delete mode 100644 examples/public-inbox-imap-onion.socket delete mode 100644 examples/public-inbox-imaps.socket delete mode 100644 examples/public-inbox-nntps.socket diff --git a/MANIFEST b/MANIFEST index 196b9627..9900b776 100644 --- a/MANIFEST +++ b/MANIFEST @@ -134,13 +134,10 @@ examples/nginx_proxy examples/public-inbox-config examples/public-inbox-httpd.socket examples/public-inbox-httpd@.service -examples/public-inbox-imap-onion.socket examples/public-inbox-imapd.socket examples/public-inbox-imapd@.service -examples/public-inbox-imaps.socket examples/public-inbox-nntpd.socket examples/public-inbox-nntpd@.service -examples/public-inbox-nntps.socket examples/public-inbox-watch.service examples/public-inbox.psgi examples/unsubscribe-milter.socket diff --git a/examples/public-inbox-imap-onion.socket b/examples/public-inbox-imap-onion.socket deleted file mode 100644 index 76b4e7ca..00000000 --- a/examples/public-inbox-imap-onion.socket +++ /dev/null @@ -1,12 +0,0 @@ -# ==> /etc/systemd/system/public-inbox-imap-onion.socket <== -# This unit is for the corresponding line in torrc(5): -# HiddenServicePort 143 unix:/run/imapd.onion.sock -[Unit] -Description = public-inbox-imap .onion socket - -[Socket] -ListenStream = /run/imapd.onion.sock -Service = public-inbox-imapd@1.service - -[Install] -WantedBy = sockets.target diff --git a/examples/public-inbox-imapd.socket b/examples/public-inbox-imapd.socket index fcd924fd..c3c55ea1 100644 --- a/examples/public-inbox-imapd.socket +++ b/examples/public-inbox-imapd.socket @@ -1,11 +1,23 @@ # ==> /etc/systemd/system/public-inbox-imapd.socket <== +# This contains 5 sockets for an public-inbox-imapd instance. +# The TCP ports are well-known ports registered in /etc/services. +# The /run/imapd.onion.sock entry is meant for the Tor hidden service +# enabled by the following line in the torrc(5) file: +# HiddenServicePort 143 unix:/run/imapd.onion.sock [Unit] -Description = public-inbox-imapd socket +Description = public-inbox-imapd sockets [Socket] ListenStream = 0.0.0.0:143 +ListenStream = 0.0.0.0:993 +ListenStream = /run/imapd.onion.sock + +# Separating IPv4 from IPv6 listeners makes for nicer output +# of IPv4 addresses in various reporting/monitoring tools BindIPv6Only = ipv6-only ListenStream = [::]:143 +ListenStream = [::]:993 + Service = public-inbox-imapd@1.service [Install] diff --git a/examples/public-inbox-imapd@.service b/examples/public-inbox-imapd@.service index e0446ed3..f7428d85 100644 --- a/examples/public-inbox-imapd@.service +++ b/examples/public-inbox-imapd@.service @@ -7,10 +7,8 @@ [Unit] Description = public-inbox-imapd IMAP server %i -Wants = public-inbox-imapd.socket public-inbox-imaps.socket \ -public-inbox-imap-onion.socket -After = public-inbox-imapd.socket public-inbox-imaps.socket \ -public-inbox-imap-onion.socket +Wants = public-inbox-imapd.socket +After = public-inbox-imapd.socket [Service] Environment = PI_CONFIG=/home/pi/.public-inbox/config \ @@ -29,8 +27,7 @@ StandardError = syslog # simultaneous services NonBlocking = true -Sockets = public-inbox-imapd.socket public-inbox-imaps.socket \ -public-inbox-imap-onion.socket +Sockets = public-inbox-imapd.socket KillSignal = SIGQUIT User = nobody diff --git a/examples/public-inbox-imaps.socket b/examples/public-inbox-imaps.socket deleted file mode 100644 index b61cc742..00000000 --- a/examples/public-inbox-imaps.socket +++ /dev/null @@ -1,12 +0,0 @@ -# ==> /etc/systemd/system/public-inbox-imaps.socket <== -[Unit] -Description = public-inbox-imaps socket - -[Socket] -ListenStream = 0.0.0.0:993 -BindIPv6Only = ipv6-only -ListenStream = [::]:993 -Service = public-inbox-imapd@1.service - -[Install] -WantedBy = sockets.target diff --git a/examples/public-inbox-nntpd.socket b/examples/public-inbox-nntpd.socket index eeddf343..0a3ccb2f 100644 --- a/examples/public-inbox-nntpd.socket +++ b/examples/public-inbox-nntpd.socket @@ -1,9 +1,23 @@ # ==> /etc/systemd/system/public-inbox-nntpd.socket <== +# This contains 5 sockets for an public-inbox-nntpd instance. +# The TCP ports are well-known ports registered in /etc/services. +# The /run/nntpd.onion.sock entry is meant for the Tor hidden service +# enabled by the following line in the torrc(5) file: +# HiddenServicePort 119 unix:/run/nntpd.onion.sock [Unit] -Description = public-inbox-nntpd socket +Description = public-inbox-nntpd sockets [Socket] -ListenStream = 119 +ListenStream = 0.0.0.0:119 +ListenStream = 0.0.0.0:563 +ListenStream = /run/nntpd.onion.sock + +# Separating IPv4 from IPv6 listeners makes for nicer output +# of IPv4 addresses in various reporting/monitoring tools +BindIPv6Only = ipv6-only +ListenStream = [::]:119 +ListenStream = [::]:563 + Service = public-inbox-nntpd@1.service [Install] diff --git a/examples/public-inbox-nntpd@.service b/examples/public-inbox-nntpd@.service index 4dd2f5d7..d6aea067 100644 --- a/examples/public-inbox-nntpd@.service +++ b/examples/public-inbox-nntpd@.service @@ -7,8 +7,8 @@ [Unit] Description = public-inbox NNTP server %i -Wants = public-inbox-nntpd.socket public-inbox-nntps.socket -After = public-inbox-nntpd.socket public-inbox-nntps.socket +Wants = public-inbox-nntpd.socket +After = public-inbox-nntpd.socket [Service] Environment = PI_CONFIG=/home/pi/.public-inbox/config \ @@ -27,7 +27,7 @@ StandardError = syslog # simultaneous services NonBlocking = true -Sockets = public-inbox-nntpd.socket public-inbox-nntps.socket +Sockets = public-inbox-nntpd.socket KillSignal = SIGQUIT User = nobody diff --git a/examples/public-inbox-nntps.socket b/examples/public-inbox-nntps.socket deleted file mode 100644 index fa678196..00000000 --- a/examples/public-inbox-nntps.socket +++ /dev/null @@ -1,12 +0,0 @@ -# ==> /etc/systemd/system/public-inbox-nntps.socket <== -[Unit] -Description = public-inbox-nntps socket - -[Socket] -ListenStream = 0.0.0.0:563 -BindIPv6Only = ipv6-only -ListenStream = [::]:563 -Service = public-inbox-nntpd@1.service - -[Install] -WantedBy = sockets.target