all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#50808]
@ 2021-09-26  3:05 Jacob Adams
  2021-09-26  3:05 ` [bug#50808] [PATCH] services: rsync: support binding rsync to a specific IP address Jacob Adams
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jacob Adams @ 2021-09-26  3:05 UTC (permalink / raw)
  To: 50808


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.





^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#50808] [PATCH] services: rsync: support binding rsync to a specific IP address
  2021-09-26  3:05 [bug#50808] Jacob Adams
@ 2021-09-26  3:05 ` Jacob Adams
  2021-09-26 15:24   ` Oleg Pykhalov
  2021-09-26  3:13 ` [bug#50808] Fixup bug title Jacob Adams
  2021-09-26 17:31 ` [bug#50808] [PATCH v2] services: rsync: support binding rsync to a specific IP address Jacob Adams
  2 siblings, 1 reply; 6+ messages in thread
From: Jacob Adams @ 2021-09-26  3:05 UTC (permalink / raw)
  To: 50808; +Cc: Jacob Adams

 * 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





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [bug#50808] Fixup bug title
  2021-09-26  3:05 [bug#50808] Jacob Adams
  2021-09-26  3:05 ` [bug#50808] [PATCH] services: rsync: support binding rsync to a specific IP address Jacob Adams
@ 2021-09-26  3:13 ` Jacob Adams
  2021-09-26 17:31 ` [bug#50808] [PATCH v2] services: rsync: support binding rsync to a specific IP address Jacob Adams
  2 siblings, 0 replies; 6+ messages in thread
From: Jacob Adams @ 2021-09-26  3:13 UTC (permalink / raw)
  To: 50808

[-- Attachment #1: Type: text/plain, Size: 152 bytes --]

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.

[-- Attachment #2: Type: text/html, Size: 331 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#50808] [PATCH] services: rsync: support binding rsync to a specific IP address
  2021-09-26  3:05 ` [bug#50808] [PATCH] services: rsync: support binding rsync to a specific IP address Jacob Adams
@ 2021-09-26 15:24   ` Oleg Pykhalov
  0 siblings, 0 replies; 6+ messages in thread
From: Oleg Pykhalov @ 2021-09-26 15:24 UTC (permalink / raw)
  To: Jacob Adams; +Cc: 50808

[-- Attachment #1: Type: text/plain, Size: 702 bytes --]

Hi Jacob,

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

Jacob Adams <jacob@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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [bug#50808] [PATCH v2] services: rsync: support binding rsync to a specific IP address
  2021-09-26  3:05 [bug#50808] Jacob Adams
  2021-09-26  3:05 ` [bug#50808] [PATCH] services: rsync: support binding rsync to a specific IP address Jacob Adams
  2021-09-26  3:13 ` [bug#50808] Fixup bug title Jacob Adams
@ 2021-09-26 17:31 ` Jacob Adams
  2021-10-25 12:09   ` bug#50808: [PATCH] " Ludovic Courtès
  2 siblings, 1 reply; 6+ messages in thread
From: Jacob Adams @ 2021-09-26 17:31 UTC (permalink / raw)
  To: 50808; +Cc: Jacob Adams

 * 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





^ permalink raw reply related	[flat|nested] 6+ messages in thread

* bug#50808: [PATCH] services: rsync: support binding rsync to a specific IP address
  2021-09-26 17:31 ` [bug#50808] [PATCH v2] services: rsync: support binding rsync to a specific IP address Jacob Adams
@ 2021-10-25 12:09   ` Ludovic Courtès
  0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2021-10-25 12:09 UTC (permalink / raw)
  To: Jacob Adams; +Cc: 50808-done

Hi,

Jacob Adams <jacob@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’.




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-10-25 12:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-26  3:05 [bug#50808] Jacob Adams
2021-09-26  3:05 ` [bug#50808] [PATCH] services: rsync: support binding rsync to a specific IP address Jacob Adams
2021-09-26 15:24   ` Oleg Pykhalov
2021-09-26  3:13 ` [bug#50808] Fixup bug title Jacob Adams
2021-09-26 17:31 ` [bug#50808] [PATCH v2] services: rsync: support binding rsync to a specific IP address Jacob Adams
2021-10-25 12:09   ` bug#50808: [PATCH] " Ludovic Courtès

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.