GNU bug report logs - #50808
[PATCH] services: rsync: support binding rsync to a specific IP address

Previous Next

Package: guix-patches;

Reported by: Jacob Adams <jacob <at> tookmund.com>

Date: Sun, 26 Sep 2021 03:09:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50808 in the body.
You can then email your comments to 50808 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#50808; Package guix-patches. (Sun, 26 Sep 2021 03:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Jacob Adams <jacob <at> tookmund.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 26 Sep 2021 03:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jacob Adams <jacob <at> tookmund.com>
To: guix-patches <at> gnu.org
Date: Sat, 25 Sep 2021 23:05:10 -0400
I was setting up an rsync server behind a wireguard VPN, and found that
I couldn't bind rsync to a specific IP address using the rsync service
configuration in Guix, despite it being supported in the rsyncd
configuration file.
It was an easy extension of the existing service and now I'm happily running
rsync bound to the computer's wireguard address.





Information forwarded to guix-patches <at> gnu.org:
bug#50808; Package guix-patches. (Sun, 26 Sep 2021 03:10:01 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jacob Adams <jacob <at> tookmund.com>
To: guix-patches <at> gnu.org
Cc: Jacob Adams <jacob <at> tookmund.com>
Subject: [PATCH] services: rsync: support binding rsync to a specific IP
 address
Date: Sat, 25 Sep 2021 23:05:11 -0400
 * gnu/services/rsync.scm: Support IP address configuration
 * doc/guix.texi: Document new address rsync configuration option
---
 doc/guix.texi          | 4 ++++
 gnu/services/rsync.scm | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 4bf14014eb..9a858de2d9 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17151,6 +17151,10 @@ Data type representing the configuration for @code{rsync-service}.
 @item @code{package} (default: @var{rsync})
 @code{rsync} package to use.
 
+@item @code{address} (default: @code{""})
+IP address on which @command{rsync} listens for incoming connections.
+If unspecified, it defaults to listening on all available addresses.
+
 @item @code{port-number} (default: @code{873})
 TCP port on which @command{rsync} listens for incoming connections.  If port
 is less than @code{1024} @command{rsync} needs to be started as the
diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
index 6c117bbda4..0a9ed82a42 100644
--- a/gnu/services/rsync.scm
+++ b/gnu/services/rsync.scm
@@ -45,6 +45,8 @@
   rsync-configuration?
   (package       rsync-configuration-package              ; package
                  (default rsync))
+  (address       rsync-configuration-address              ; string
+                 (default ""))
   (port-number   rsync-configuration-port-number          ; integer
                  (default 873))
   (pid-file      rsync-configuration-pid-file             ; string
@@ -110,7 +112,7 @@
 (define rsync-config-file
   ;; Return the rsync configuration file corresponding to CONFIG.
   (match-lambda
-    (($ <rsync-configuration> package port-number pid-file lock-file log-file
+    (($ <rsync-configuration> package address port-number pid-file lock-file log-file
                               use-chroot? share-path share-comment read-only?
                               timeout user group uid gid)
      (if (not (string=? user "root"))
@@ -132,6 +134,7 @@
       "pid file = " pid-file "\n"
       "lock file = " lock-file "\n"
       "log file = " log-file "\n"
+      (if (not (string=? address "")) (string-append "address = " address "\n") "")
       "port = " (number->string port-number) "\n"
       "use chroot = " (if use-chroot? "true" "false") "\n"
       (if uid (string-append "uid = " uid "\n") "")
-- 
2.30.2





Information forwarded to guix-patches <at> gnu.org:
bug#50808; Package guix-patches. (Sun, 26 Sep 2021 03:15:01 GMT) Full text and rfc822 format available.

Message #11 received at 50808 <at> debbugs.gnu.org (full text, mbox):

From: "Jacob Adams" <jacob <at> tookmund.com>
To: 50808 <at> debbugs.gnu.org
Subject: Fixup bug title
Date: Sun, 26 Sep 2021 03:13:50 +0000
[Message part 1 (text/plain, inline)]
Control: retitle -1 [PATCH] services: rsync: support binding rsync to a specific IP address

Apologies, I'm still learning my way around git send-email.
[Message part 2 (text/html, inline)]

Set bug title to '[PATCH] services: rsync: support binding rsync to a specific IP address'. Request was from "Jacob Adams" <jacob <at> tookmund.com> to control <at> debbugs.gnu.org. (Sun, 26 Sep 2021 03:19:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#50808; Package guix-patches. (Sun, 26 Sep 2021 15:25:02 GMT) Full text and rfc822 format available.

Message #16 received at 50808 <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: Jacob Adams <jacob <at> tookmund.com>
Cc: 50808 <at> debbugs.gnu.org
Subject: Re: [bug#50808] [PATCH] services: rsync: support binding rsync to a
 specific IP address
Date: Sun, 26 Sep 2021 18:24:46 +0300
[Message part 1 (text/plain, inline)]
Hi Jacob,

Nice catch, I would like to have this configurable, too.

Jacob Adams <jacob <at> tookmund.com> writes:

[…]

> +  (address       rsync-configuration-address              ; string
> +                 (default ""))

We could just use ‘#f’ here with ‘string | #f’ comment.

[…]

> +      (if (not (string=? address "")) (string-append "address = " address "\n") "")
>        "port = " (number->string port-number) "\n"
>        "use chroot = " (if use-chroot? "true" "false") "\n"
>        (if uid (string-append "uid = " uid "\n") "")

And here we could just ‘(if address (string-append ...) "")’.

Could you send an updated patch, please?

Thanks,
Oleg.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#50808; Package guix-patches. (Sun, 26 Sep 2021 17:32:02 GMT) Full text and rfc822 format available.

Message #19 received at 50808 <at> debbugs.gnu.org (full text, mbox):

From: Jacob Adams <jacob <at> tookmund.com>
To: 50808 <at> debbugs.gnu.org
Cc: Jacob Adams <jacob <at> tookmund.com>
Subject: [PATCH v2] services: rsync: support binding rsync to a specific IP
 address
Date: Sun, 26 Sep 2021 13:31:31 -0400
 * gnu/services/rsync.scm: Support IP address configuration
 * doc/guix.texi: Document new address rsync configuration option
---
That's a much cleaner approach, thanks! I'm very new to Scheme and
didn't even realize I could do that.

 doc/guix.texi          | 4 ++++
 gnu/services/rsync.scm | 5 ++++-
 2 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 4bf14014eb..a932dbcc09 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -17151,6 +17151,10 @@ Data type representing the configuration for @code{rsync-service}.
 @item @code{package} (default: @var{rsync})
 @code{rsync} package to use.
 
+@item @code{address} (default: @code{#f})
+IP address on which @command{rsync} listens for incoming connections.
+If unspecified, it defaults to listening on all available addresses.
+
 @item @code{port-number} (default: @code{873})
 TCP port on which @command{rsync} listens for incoming connections.  If port
 is less than @code{1024} @command{rsync} needs to be started as the
diff --git a/gnu/services/rsync.scm b/gnu/services/rsync.scm
index 6c117bbda4..59faed78f6 100644
--- a/gnu/services/rsync.scm
+++ b/gnu/services/rsync.scm
@@ -45,6 +45,8 @@
   rsync-configuration?
   (package       rsync-configuration-package              ; package
                  (default rsync))
+  (address       rsync-configuration-address              ; string | #f
+                 (default #f))
   (port-number   rsync-configuration-port-number          ; integer
                  (default 873))
   (pid-file      rsync-configuration-pid-file             ; string
@@ -110,7 +112,7 @@
 (define rsync-config-file
   ;; Return the rsync configuration file corresponding to CONFIG.
   (match-lambda
-    (($ <rsync-configuration> package port-number pid-file lock-file log-file
+    (($ <rsync-configuration> package address port-number pid-file lock-file log-file
                               use-chroot? share-path share-comment read-only?
                               timeout user group uid gid)
      (if (not (string=? user "root"))
@@ -132,6 +134,7 @@
       "pid file = " pid-file "\n"
       "lock file = " lock-file "\n"
       "log file = " log-file "\n"
+      (if address (string-append "address = " address "\n") "")
       "port = " (number->string port-number) "\n"
       "use chroot = " (if use-chroot? "true" "false") "\n"
       (if uid (string-append "uid = " uid "\n") "")
-- 
2.30.2





Added tag(s) patch. Request was from "Jacob Adams" <jacob <at> tookmund.com> to control <at> debbugs.gnu.org. (Sat, 23 Oct 2021 14:49:02 GMT) Full text and rfc822 format available.

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Mon, 25 Oct 2021 12:10:01 GMT) Full text and rfc822 format available.

Notification sent to Jacob Adams <jacob <at> tookmund.com>:
bug acknowledged by developer. (Mon, 25 Oct 2021 12:10:01 GMT) Full text and rfc822 format available.

Message #26 received at 50808-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Jacob Adams <jacob <at> tookmund.com>
Cc: 50808-done <at> debbugs.gnu.org
Subject: Re: bug#50808: [PATCH] services: rsync: support binding rsync to a
 specific IP address
Date: Mon, 25 Oct 2021 14:09:09 +0200
Hi,

Jacob Adams <jacob <at> tookmund.com> skribis:

>  * gnu/services/rsync.scm: Support IP address configuration
>  * doc/guix.texi: Document new address rsync configuration option

I tweaked the commit message and applied it.

Thank you!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 22 Nov 2021 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 155 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.