unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#38059] [PATCH 0/2] gnu: Add pagekite.
@ 2019-11-04 14:44 Alex Griffin
  2019-11-04 14:47 ` [bug#38059] [PATCH 1/2] gnu: Add python-socksipychain Alex Griffin
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Alex Griffin @ 2019-11-04 14:44 UTC (permalink / raw)
  To: 38059

This patch series adds PageKite, an easy way to make TCP servers (like HTTP or SSH) accessible on the internet, even from behind NAT or restrictive firewalls. I'm also working on writing a PageKite service, but it's not done yet and the package is still useful without it.

https://pagekite.net/

-- 
Alex Griffin

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

* [bug#38059] [PATCH 1/2] gnu: Add python-socksipychain.
  2019-11-04 14:44 [bug#38059] [PATCH 0/2] gnu: Add pagekite Alex Griffin
@ 2019-11-04 14:47 ` Alex Griffin
  2019-11-10 11:21   ` Ludovic Courtès
  2019-11-04 14:47 ` [bug#38059] [PATCH 2/2] gnu: Add pagekite Alex Griffin
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 13+ messages in thread
From: Alex Griffin @ 2019-11-04 14:47 UTC (permalink / raw)
  To: 38059

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



-- 
Alex Griffin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-Add-python-socksipychain.patch --]
[-- Type: text/x-patch; name="0001-gnu-Add-python-socksipychain.patch", Size: 1974 bytes --]

From 4b3e2d8a6e5897659ebc06bc809277ee6fc29121 Mon Sep 17 00:00:00 2001
From: Alex Griffin <a@ajgrf.com>
Date: Sat, 2 Nov 2019 13:43:21 -0500
Subject: [PATCH 1/2] gnu: Add python-socksipychain.

* gnu/packages/python-xyz.scm (python-socksipychain, python2-socksipychain):
New variables.
---
 gnu/packages/python-xyz.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 29362e2f2b..7b05718192 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -4454,6 +4454,35 @@ as the original project seems to have been abandoned circa 2007.")
 (define-public python2-socksipy-branch
   (package-with-python2 python-socksipy-branch))
 
+(define-public python-socksipychain
+  (package
+    (name "python-socksipychain")
+    (version "2.0.15")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/pagekite/PySocksipyChain.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1pkljnh9hfwla8sg7mil4f9zrnsqj0dbhr3crxjw3k8dnjz70dvk"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f)) ; Tests try to access the network.
+    (home-page "http://pagekite.net/wiki/Floss/PySocksipyChain/")
+    (synopsis "Python SOCKS module with chained proxies support")
+    (description
+     "SocksiPyChain is a modified version of the SocksiPy SOCKS module, which
+adds support for arbitrary chaining of proxy servers and various modes of
+TLS/SSL encryption.  It was developed for use in PageKite, and also includes
+a simple netcat replacement with chaining support.")
+    (license license:bsd-3)))
+
+(define-public python2-socksipychain
+  (package-with-python2 python-socksipychain))
+
 (define-public python-pycodestyle
   (package
     (name "python-pycodestyle")
-- 
2.23.0


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

* [bug#38059] [PATCH 2/2] gnu: Add pagekite.
  2019-11-04 14:44 [bug#38059] [PATCH 0/2] gnu: Add pagekite Alex Griffin
  2019-11-04 14:47 ` [bug#38059] [PATCH 1/2] gnu: Add python-socksipychain Alex Griffin
@ 2019-11-04 14:47 ` Alex Griffin
  2019-11-10 11:22   ` Ludovic Courtès
  2019-11-06 17:44 ` [bug#38059] [PATCH 3/3] services: Add pagekite-service-type Alex Griffin
  2019-11-06 18:19 ` Alex Griffin
  3 siblings, 1 reply; 13+ messages in thread
From: Alex Griffin @ 2019-11-04 14:47 UTC (permalink / raw)
  To: 38059

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



-- 
Alex Griffin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0002-gnu-Add-pagekite.patch --]
[-- Type: text/x-patch; name="0002-gnu-Add-pagekite.patch", Size: 2516 bytes --]

From 835678c62d341ea4cd8d93f6475ac955198ef276 Mon Sep 17 00:00:00 2001
From: Alex Griffin <a@ajgrf.com>
Date: Sat, 2 Nov 2019 14:11:51 -0500
Subject: [PATCH 2/2] gnu: Add pagekite.

* gnu/packages/web.scm (pagekite): New variable.
---
 gnu/packages/networking.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gnu/packages/networking.scm b/gnu/packages/networking.scm
index 9173871497..703c3e744c 100644
--- a/gnu/packages/networking.scm
+++ b/gnu/packages/networking.scm
@@ -32,6 +32,7 @@
 ;;; Copyright © 2019 Timotej Lazar <timotej.lazar@araneo.si>
 ;;; Copyright © 2019 Brice Waegeneire <brice@waegenei.re>
 ;;; Copyright © 2019 Tonton <tonton@riseup.net>
+;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -2676,3 +2677,39 @@ maximum extent possible.")
 B.A.T.M.A.N. mesh networking routing protocol provided by the Linux kernel
 module @code{batman-adv}, for Layer 2.")
    (license license:gpl2+)))
+
+(define-public pagekite
+  (package
+    (name "pagekite")
+    (version "1.0.0.190721")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://pagekite.net/pk/src/pagekite-"
+                           version ".tar.gz"))
+       (sha256
+        (base32 "0y4vaqd3pjr6if8jcnhjwignkxgrajmnx1rd1p37anj8xjg7l8zh"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:python ,python-2
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'install 'install-man-page
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (man (string-append out "/share/man")))
+               (invoke "make"
+                       (string-append "PYTHONPATH=" (getenv "PYTHONPATH"))
+                       "doc/pagekite.1")
+               (install-file "doc/pagekite.1" (string-append man "/man1"))
+               #t))))))
+    (inputs
+     `(("python2-socksipychain" ,python2-socksipychain)))
+    (home-page "https://pagekite.net/")
+    (synopsis "Make localhost servers publicly visible")
+    (description
+     "PageKite implements a tunneled reverse proxy which makes it easy to make
+a service (such as an HTTP or SSH server) on localhost visible to the wider
+Internet, even behind NAT or restrictive firewalls.  A managed front-end relay
+service is available at https://pagekite.net/, or you can run your own.")
+    (license license:agpl3+)))
-- 
2.23.0


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

* [bug#38059] [PATCH 3/3] services: Add pagekite-service-type
  2019-11-04 14:44 [bug#38059] [PATCH 0/2] gnu: Add pagekite Alex Griffin
  2019-11-04 14:47 ` [bug#38059] [PATCH 1/2] gnu: Add python-socksipychain Alex Griffin
  2019-11-04 14:47 ` [bug#38059] [PATCH 2/2] gnu: Add pagekite Alex Griffin
@ 2019-11-06 17:44 ` Alex Griffin
  2019-11-06 18:19 ` Alex Griffin
  3 siblings, 0 replies; 13+ messages in thread
From: Alex Griffin @ 2019-11-06 17:44 UTC (permalink / raw)
  To: 38059

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

This patch adds a PageKite service, so you can finally run that Guix home server without fiddling with dyndns, firewall rules, and port forwarding!

-- 
Alex Griffin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-services-Add-pagekite-service-type.patch --]
[-- Type: text/x-patch; name="0003-services-Add-pagekite-service-type.patch", Size: 8315 bytes --]

From ec63d0cd530d4782f0964b9da27e46d80ec7c3f9 Mon Sep 17 00:00:00 2001
From: Alex Griffin <a@ajgrf.com>
Date: Mon, 4 Nov 2019 19:29:24 -0600
Subject: [PATCH 3/3] services: Add pagekite-service-type.

* gnu/services/networking.scm (pagekite-service-type): New service type.
(<pagekite-configuration>): New record type.
(pagekite-shepherd-service): New procedure.
* doc/guix.texi (Networking Services): Document it.
---
 doc/guix.texi               |  48 ++++++++++++++++
 gnu/services/networking.scm | 111 +++++++++++++++++++++++++++++++++++-
 2 files changed, 158 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 7b1ee163c4..b855363921 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -66,6 +66,7 @@ Copyright @copyright{} 2019 Josh Holland@*
 Copyright @copyright{} 2019 Diego Nicola Barbato@*
 Copyright @copyright{} 2019 Ivan Petkov@*
 Copyright @copyright{} 2019 Jakob L. Kreuze@*
+Copyright @copyright{} 2019 Alex Griffin@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -13953,6 +13954,53 @@ Package object of the Open vSwitch.
 @end table
 @end deftp
 
+@defvr {Scheme Variable} pagekite-service-type
+This is the service type for the @uref{https://pagekite.net, PageKite} service,
+a tunneling solution for making localhost servers publicly visible, even from
+behind NAT or restrictive firewalls.  The value for this service type is a
+@code{pagekite-configuration} record.
+
+Here's an example exposing the local HTTP and SSH daemons:
+
+@lisp
+(service pagekite-service-type
+         (pagekite-configuration
+           (kites '("http:@@kitename:localhost:80:@@kitesecret"
+                    "raw/22:@@kitename:localhost:22:@@kitesecret"))
+           (extra-file "/etc/pagekite.rc")))
+@end lisp
+@end defvr
+
+@deftp {Data Type} pagekite-configuration
+Data type representing the configuration of PageKite.
+
+@table @asis
+@item @code{package} (default: @var{pagekite})
+Package object of PageKite.
+
+@item @code{kitename} (default: @code{#f})
+PageKite name for authenticating to the frontend server.
+
+@item @code{kitesecret} (default: @code{#f})
+Shared secret for authenticating to the frontend server.  You should probably
+put this inside @code{extra-file} instead.
+
+@item @code{frontend} (default: @code{#f})
+Connect to the named PageKite frontend server instead of the
+@uref{https://pagekite.net,,pagekite.net} service.
+
+@item @code{kites} (default: @code{'("http:@@kitename:localhost:80:@@kitesecret")})
+List of service kites to use.  The format is
+@code{proto:kitename:host:port:secret}.
+
+@item @code{extra-file} (default: @code{#f})
+Extra configuration file to read, which you are expected to create manually.
+Use this to add additional options, manage shared secrets out-of-band, or run
+PageKite as a frontend server.
+
+@end table
+@end deftp
+
 @node X Window
 @subsection X Window
 
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index a1c1aad9f6..c61b0ec1e4 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2019 Florian Pelz <pelzflorian@pelzflorian.de>
 ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2019 Sou Bunnbu <iyzsong@member.fsf.org>
+;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -154,7 +155,17 @@
             nftables-configuration?
             nftables-configuration-package
             nftables-configuration-ruleset
-            %default-nftables-ruleset))
+            %default-nftables-ruleset
+
+            pagekite-service-type
+            pagekite-configuration
+            pagekite-configuration?
+            pagekite-configuration-package
+            pagekite-configuration-kitename
+            pagekite-configuration-kitesecret
+            pagekite-configuration-frontend
+            pagekite-configuration-kites
+            pagekite-configuration-extra-file))
 
 ;;; Commentary:
 ;;;
@@ -1527,4 +1538,102 @@ table inet filter {
                              (compose list nftables-configuration-package))))
    (default-value (nftables-configuration))))
 
+\f
+;;;
+;;; PageKite
+;;;
+
+(define-record-type* <pagekite-configuration>
+  pagekite-configuration
+  make-pagekite-configuration
+  pagekite-configuration?
+  (package pagekite-configuration-package
+           (default pagekite))
+  (kitename pagekite-configuration-kitename
+            (default #f))
+  (kitesecret pagekite-configuration-kitesecret
+              (default #f))
+  (frontend pagekite-configuration-frontend
+            (default #f))
+  (kites pagekite-configuration-kites
+         (default '("http:@kitename:localhost:80:@kitesecret")))
+  (extra-file pagekite-configuration-extra-file
+              (default #f)))
+
+(define pagekite-configuration-file
+  (match-lambda
+    (($ <pagekite-configuration> package kitename kitesecret
+                                 frontend kites extra-file)
+     (mixed-text-file "pagekite.rc"
+                      (if extra-file
+                          (string-append "optfile = " extra-file "\n")
+                          "")
+                      (if kitename
+                          (string-append "kitename = " kitename "\n")
+                          "")
+                      (if kitesecret
+                          (string-append "kitesecret = " kitesecret "\n")
+                          "")
+                      (if frontend
+                          (string-append "frontend = " frontend "\n")
+                          "defaults\n")
+                      (string-join (map (lambda (kite)
+                                          (string-append "service_on = " kite))
+                                        kites)
+                                   "\n"
+                                   'suffix)))))
+
+(define (pagekite-shepherd-service config)
+  (match config
+    (($ <pagekite-configuration> package kitename kitesecret
+                                 frontend kites extra-file)
+     (with-imported-modules (source-module-closure
+                             '((gnu build shepherd)
+                               (gnu system file-systems)))
+       (shepherd-service
+        (documentation "Run the PageKite service.")
+        (provision '(pagekite))
+        (requirement '(networking))
+        (modules '((gnu build shepherd)
+                   (gnu system file-systems)))
+        (start #~(make-forkexec-constructor/container
+                  (list #$(file-append package "/bin/pagekite")
+                        "--clean"
+                        "--nullui"
+                        "--nocrashreport"
+                        "--runas=pagekite:pagekite"
+                        (string-append "--optfile="
+                                       #$(pagekite-configuration-file config)))
+                  #:log-file "/var/log/pagekite.log"
+                  #:mappings #$(if extra-file
+                                   #~(list (file-system-mapping
+                                            (source #$extra-file)
+                                            (target source)))
+                                   '())))
+        ;; SIGTERM doesn't always work for reason.
+        (stop #~(make-kill-destructor SIGINT)))))))
+
+(define %pagekite-accounts
+  (list (user-group (name "pagekite") (system? #t))
+        (user-account
+         (name "pagekite")
+         (group "pagekite")
+         (system? #t)
+         (comment "PageKite user")
+         (home-directory "/var/empty")
+         (shell (file-append shadow "/sbin/nologin")))))
+
+(define pagekite-service-type
+  (service-type
+   (name 'pagekite)
+   (default-value (pagekite-configuration))
+   (extensions
+    (list (service-extension shepherd-root-service-type
+                             (compose list pagekite-shepherd-service))
+          (service-extension account-service-type
+                             (const %pagekite-accounts))))
+   (description
+    "Run @url{https://pagekite.net/,PageKite}, a tunneling solution to make
+local servers publicly accessible on the web, even behind NATs and firewalls.")))
+
 ;;; networking.scm ends here
-- 
2.23.0


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

* [bug#38059] [PATCH 3/3] services: Add pagekite-service-type.
  2019-11-04 14:44 [bug#38059] [PATCH 0/2] gnu: Add pagekite Alex Griffin
                   ` (2 preceding siblings ...)
  2019-11-06 17:44 ` [bug#38059] [PATCH 3/3] services: Add pagekite-service-type Alex Griffin
@ 2019-11-06 18:19 ` Alex Griffin
  2019-11-10 11:31   ` Ludovic Courtès
  3 siblings, 1 reply; 13+ messages in thread
From: Alex Griffin @ 2019-11-06 18:19 UTC (permalink / raw)
  To: 38059

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

This patch fixes a bug where the service wouldn't compile if you omitted `extra-file`, as well as some minor mistakes in the comments and documentation.

-- 
Alex Griffin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0003-services-Add-pagekite-service-type.patch --]
[-- Type: text/x-patch; name="0003-services-Add-pagekite-service-type.patch", Size: 8321 bytes --]

From 46a5e48f5e89be4da3611bd11b55ed0e325c6538 Mon Sep 17 00:00:00 2001
From: Alex Griffin <a@ajgrf.com>
Date: Mon, 4 Nov 2019 19:29:24 -0600
Subject: [PATCH 3/3] services: Add pagekite-service-type.

* gnu/services/networking.scm (pagekite-service-type): New service type.
(<pagekite-configuration>): New record type.
(pagekite-shepherd-service): New procedure.
* doc/guix.texi (Networking Services): Document it.
---
 doc/guix.texi               |  47 +++++++++++++++
 gnu/services/networking.scm | 111 +++++++++++++++++++++++++++++++++++-
 2 files changed, 157 insertions(+), 1 deletion(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 7b1ee163c4..f01eb4ebe2 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -66,6 +66,7 @@ Copyright @copyright{} 2019 Josh Holland@*
 Copyright @copyright{} 2019 Diego Nicola Barbato@*
 Copyright @copyright{} 2019 Ivan Petkov@*
 Copyright @copyright{} 2019 Jakob L. Kreuze@*
+Copyright @copyright{} 2019 Alex Griffin@*
 
 Permission is granted to copy, distribute and/or modify this document
 under the terms of the GNU Free Documentation License, Version 1.3 or
@@ -13953,6 +13954,52 @@ Package object of the Open vSwitch.
 @end table
 @end deftp
 
+@defvr {Scheme Variable} pagekite-service-type
+This is the service type for the @uref{https://pagekite.net, PageKite} service,
+a tunneling solution for making localhost servers publicly visible, even from
+behind NAT or restrictive firewalls.  The value for this service type is a
+@code{pagekite-configuration} record.
+
+Here's an example exposing the local HTTP and SSH daemons:
+
+@lisp
+(service pagekite-service-type
+         (pagekite-configuration
+           (kites '("http:@@kitename:localhost:80:@@kitesecret"
+                    "raw/22:@@kitename:localhost:22:@@kitesecret"))
+           (extra-file "/etc/pagekite.rc")))
+@end lisp
+@end defvr
+
+@deftp {Data Type} pagekite-configuration
+Data type representing the configuration of PageKite.
+
+@table @asis
+@item @code{package} (default: @var{pagekite})
+Package object of PageKite.
+
+@item @code{kitename} (default: @code{#f})
+PageKite name for authenticating to the frontend server.
+
+@item @code{kitesecret} (default: @code{#f})
+Shared secret for authenticating to the frontend server.  You should probably
+put this inside @code{extra-file} instead.
+
+@item @code{frontend} (default: @code{#f})
+Connect to the named PageKite frontend server instead of the
+@uref{https://pagekite.net,,pagekite.net} service.
+
+@item @code{kites} (default: @code{'("http:@@kitename:localhost:80:@@kitesecret")})
+List of service kites to use.  Exposes HTTP on port 80 by default. The format
+is @code{proto:kitename:host:port:secret}.
+
+@item @code{extra-file} (default: @code{#f})
+Extra configuration file to read, which you are expected to create manually.
+Use this to add additional options and manage shared secrets out-of-band.
+
+@end table
+@end deftp
+
 @node X Window
 @subsection X Window
 
diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
index a1c1aad9f6..cd3402255d 100644
--- a/gnu/services/networking.scm
+++ b/gnu/services/networking.scm
@@ -12,6 +12,7 @@
 ;;; Copyright © 2019 Florian Pelz <pelzflorian@pelzflorian.de>
 ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 ;;; Copyright © 2019 Sou Bunnbu <iyzsong@member.fsf.org>
+;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -154,7 +155,17 @@
             nftables-configuration?
             nftables-configuration-package
             nftables-configuration-ruleset
-            %default-nftables-ruleset))
+            %default-nftables-ruleset
+
+            pagekite-service-type
+            pagekite-configuration
+            pagekite-configuration?
+            pagekite-configuration-package
+            pagekite-configuration-kitename
+            pagekite-configuration-kitesecret
+            pagekite-configuration-frontend
+            pagekite-configuration-kites
+            pagekite-configuration-extra-file))
 
 ;;; Commentary:
 ;;;
@@ -1527,4 +1538,102 @@ table inet filter {
                              (compose list nftables-configuration-package))))
    (default-value (nftables-configuration))))
 
+\f
+;;;
+;;; PageKite
+;;;
+
+(define-record-type* <pagekite-configuration>
+  pagekite-configuration
+  make-pagekite-configuration
+  pagekite-configuration?
+  (package pagekite-configuration-package
+           (default pagekite))
+  (kitename pagekite-configuration-kitename
+            (default #f))
+  (kitesecret pagekite-configuration-kitesecret
+              (default #f))
+  (frontend pagekite-configuration-frontend
+            (default #f))
+  (kites pagekite-configuration-kites
+         (default '("http:@kitename:localhost:80:@kitesecret")))
+  (extra-file pagekite-configuration-extra-file
+              (default #f)))
+
+(define pagekite-configuration-file
+  (match-lambda
+    (($ <pagekite-configuration> package kitename kitesecret
+                                 frontend kites extra-file)
+     (mixed-text-file "pagekite.rc"
+                      (if extra-file
+                          (string-append "optfile = " extra-file "\n")
+                          "")
+                      (if kitename
+                          (string-append "kitename = " kitename "\n")
+                          "")
+                      (if kitesecret
+                          (string-append "kitesecret = " kitesecret "\n")
+                          "")
+                      (if frontend
+                          (string-append "frontend = " frontend "\n")
+                          "defaults\n")
+                      (string-join (map (lambda (kite)
+                                          (string-append "service_on = " kite))
+                                        kites)
+                                   "\n"
+                                   'suffix)))))
+
+(define (pagekite-shepherd-service config)
+  (match config
+    (($ <pagekite-configuration> package kitename kitesecret
+                                 frontend kites extra-file)
+     (with-imported-modules (source-module-closure
+                             '((gnu build shepherd)
+                               (gnu system file-systems)))
+       (shepherd-service
+        (documentation "Run the PageKite service.")
+        (provision '(pagekite))
+        (requirement '(networking))
+        (modules '((gnu build shepherd)
+                   (gnu system file-systems)))
+        (start #~(make-forkexec-constructor/container
+                  (list #$(file-append package "/bin/pagekite")
+                        "--clean"
+                        "--nullui"
+                        "--nocrashreport"
+                        "--runas=pagekite:pagekite"
+                        (string-append "--optfile="
+                                       #$(pagekite-configuration-file config)))
+                  #:log-file "/var/log/pagekite.log"
+                  #:mappings #$(if extra-file
+                                   #~(list (file-system-mapping
+                                            (source #$extra-file)
+                                            (target source)))
+                                   #~'())))
+        ;; SIGTERM doesn't always work for some reason.
+        (stop #~(make-kill-destructor SIGINT)))))))
+
+(define %pagekite-accounts
+  (list (user-group (name "pagekite") (system? #t))
+        (user-account
+         (name "pagekite")
+         (group "pagekite")
+         (system? #t)
+         (comment "PageKite user")
+         (home-directory "/var/empty")
+         (shell (file-append shadow "/sbin/nologin")))))
+
+(define pagekite-service-type
+  (service-type
+   (name 'pagekite)
+   (default-value (pagekite-configuration))
+   (extensions
+    (list (service-extension shepherd-root-service-type
+                             (compose list pagekite-shepherd-service))
+          (service-extension account-service-type
+                             (const %pagekite-accounts))))
+   (description
+    "Run @url{https://pagekite.net/,PageKite}, a tunneling solution to make
+local servers publicly accessible on the web, even behind NATs and firewalls.")))
+
 ;;; networking.scm ends here
-- 
2.23.0


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

* [bug#38059] [PATCH 1/2] gnu: Add python-socksipychain.
  2019-11-04 14:47 ` [bug#38059] [PATCH 1/2] gnu: Add python-socksipychain Alex Griffin
@ 2019-11-10 11:21   ` Ludovic Courtès
  0 siblings, 0 replies; 13+ messages in thread
From: Ludovic Courtès @ 2019-11-10 11:21 UTC (permalink / raw)
  To: Alex Griffin; +Cc: 38059

Hi Alex,

"Alex Griffin" <a@ajgrf.com> skribis:

> From 4b3e2d8a6e5897659ebc06bc809277ee6fc29121 Mon Sep 17 00:00:00 2001
> From: Alex Griffin <a@ajgrf.com>
> Date: Sat, 2 Nov 2019 13:43:21 -0500
> Subject: [PATCH 1/2] gnu: Add python-socksipychain.
>
> * gnu/packages/python-xyz.scm (python-socksipychain, python2-socksipychain):
> New variables.

LGTM!  It would be great to avoid the python2 variant (Python 2.x is a
few months away from EOL!), but let’s discuss it in the next patch.

Thanks,
Ludo’.

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

* [bug#38059] [PATCH 2/2] gnu: Add pagekite.
  2019-11-04 14:47 ` [bug#38059] [PATCH 2/2] gnu: Add pagekite Alex Griffin
@ 2019-11-10 11:22   ` Ludovic Courtès
  2019-11-11  1:05     ` Alex Griffin
  0 siblings, 1 reply; 13+ messages in thread
From: Ludovic Courtès @ 2019-11-10 11:22 UTC (permalink / raw)
  To: Alex Griffin; +Cc: 38059

"Alex Griffin" <a@ajgrf.com> skribis:

> From 835678c62d341ea4cd8d93f6475ac955198ef276 Mon Sep 17 00:00:00 2001
> From: Alex Griffin <a@ajgrf.com>
> Date: Sat, 2 Nov 2019 14:11:51 -0500
> Subject: [PATCH 2/2] gnu: Add pagekite.
>
> * gnu/packages/web.scm (pagekite): New variable.

[...]

> +    (arguments
> +     `(#:python ,python-2

Can it work with Python 3.x?  It would be really great.  Perhaps there
are not-yet-upstreamed patches floating around for that?

> +    (synopsis "Make localhost servers publicly visible")
> +    (description
> +     "PageKite implements a tunneled reverse proxy which makes it easy to make
> +a service (such as an HTTP or SSH server) on localhost visible to the wider
> +Internet, even behind NAT or restrictive firewalls.  A managed front-end relay
> +service is available at https://pagekite.net/, or you can run your own.")
                           ^
Use @url here.

Thanks,
Ludo’.

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

* [bug#38059] [PATCH 3/3] services: Add pagekite-service-type.
  2019-11-06 18:19 ` Alex Griffin
@ 2019-11-10 11:31   ` Ludovic Courtès
  2019-11-11  1:11     ` Alex Griffin
  0 siblings, 1 reply; 13+ messages in thread
From: Ludovic Courtès @ 2019-11-10 11:31 UTC (permalink / raw)
  To: Alex Griffin; +Cc: 38059

Hi,

"Alex Griffin" <a@ajgrf.com> skribis:

> From 46a5e48f5e89be4da3611bd11b55ed0e325c6538 Mon Sep 17 00:00:00 2001
> From: Alex Griffin <a@ajgrf.com>
> Date: Mon, 4 Nov 2019 19:29:24 -0600
> Subject: [PATCH 3/3] services: Add pagekite-service-type.
>
> * gnu/services/networking.scm (pagekite-service-type): New service type.
> (<pagekite-configuration>): New record type.
> (pagekite-shepherd-service): New procedure.
> * doc/guix.texi (Networking Services): Document it.

[...]

> +(define pagekite-configuration-file
> +  (match-lambda
> +    (($ <pagekite-configuration> package kitename kitesecret
> +                                 frontend kites extra-file)

[...]

> +(define (pagekite-shepherd-service config)
> +  (match config
> +    (($ <pagekite-configuration> package kitename kitesecret
> +                                 frontend kites extra-file)

I recommend using ‘match-record’ in these two cases since it matches
fields by name and is thus less error-prone.

> +        (start #~(make-forkexec-constructor/container

Nice.  :-)

Is there some meaningful test that could be written for this service?  I
suppose it’d be hard to test without also running a relay.  Anyway, if
you can think of a non-trivial test that could detect regressions,
you’re welcome to add it to (gnu tests …).

Otherwise LGTM!

Thanks,
Ludo’.

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

* [bug#38059] [PATCH 2/2] gnu: Add pagekite.
  2019-11-10 11:22   ` Ludovic Courtès
@ 2019-11-11  1:05     ` Alex Griffin
  2019-11-11 14:02       ` Ludovic Courtès
  0 siblings, 1 reply; 13+ messages in thread
From: Alex Griffin @ 2019-11-11  1:05 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 38059

On Sun, Nov 10, 2019, at 11:22 AM, Ludovic Courtès wrote:
> "Alex Griffin" <a@ajgrf.com> skribis:
> > +    (arguments
> > +     `(#:python ,python-2
> 
> Can it work with Python 3.x?  It would be really great.  Perhaps there
> are not-yet-upstreamed patches floating around for that?

There are indeed some [WIP patches][1], but I couldn't get them working. I think it's likely that PageKite will get Python 3 support before Python 2 is EOL. There's a discussion [here][2] with maintainers from both Fedora and Debian expressing concern. At the moment, though, I don't think I can package it with Python 3 unless I finish porting it myself.

[1]: https://github.com/pagekite/PyPagekite/pull/71
[2]: https://github.com/pagekite/PyPagekite/issues/40

-- 
Alex Griffin

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

* [bug#38059] [PATCH 3/3] services: Add pagekite-service-type.
  2019-11-10 11:31   ` Ludovic Courtès
@ 2019-11-11  1:11     ` Alex Griffin
  2019-11-11 14:04       ` Ludovic Courtès
  0 siblings, 1 reply; 13+ messages in thread
From: Alex Griffin @ 2019-11-11  1:11 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 38059

On Sun, Nov 10, 2019, at 11:31 AM, Ludovic Courtès wrote:
> Is there some meaningful test that could be written for this service?  I
> suppose it’d be hard to test without also running a relay.  Anyway, if
> you can think of a non-trivial test that could detect regressions,
> you’re welcome to add it to (gnu tests …).
> 
> Otherwise LGTM!

It might be possible to run both the frontend and backend on localhost and test it that way. The service currently only supports running as a backend, though. Let me know what you think.

Thanks,
-- 
Alex Griffin

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

* [bug#38059] [PATCH 2/2] gnu: Add pagekite.
  2019-11-11  1:05     ` Alex Griffin
@ 2019-11-11 14:02       ` Ludovic Courtès
  0 siblings, 0 replies; 13+ messages in thread
From: Ludovic Courtès @ 2019-11-11 14:02 UTC (permalink / raw)
  To: Alex Griffin; +Cc: 38059

Hi Alex,

"Alex Griffin" <a@ajgrf.com> skribis:

> On Sun, Nov 10, 2019, at 11:22 AM, Ludovic Courtès wrote:
>> "Alex Griffin" <a@ajgrf.com> skribis:
>> > +    (arguments
>> > +     `(#:python ,python-2
>> 
>> Can it work with Python 3.x?  It would be really great.  Perhaps there
>> are not-yet-upstreamed patches floating around for that?
>
> There are indeed some [WIP patches][1], but I couldn't get them working. I think it's likely that PageKite will get Python 3 support before Python 2 is EOL. There's a discussion [here][2] with maintainers from both Fedora and Debian expressing concern. At the moment, though, I don't think I can package it with Python 3 unless I finish porting it myself.
>
> [1]: https://github.com/pagekite/PyPagekite/pull/71
> [2]: https://github.com/pagekite/PyPagekite/issues/40

OK, sounds good.  Perhaps just add a comment referring to these two URLs
for future reference, and we’ll leave at that for now.

Thank you,
Ludo’.

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

* [bug#38059] [PATCH 3/3] services: Add pagekite-service-type.
  2019-11-11  1:11     ` Alex Griffin
@ 2019-11-11 14:04       ` Ludovic Courtès
  2019-11-11 20:18         ` bug#38059: " Alex Griffin
  0 siblings, 1 reply; 13+ messages in thread
From: Ludovic Courtès @ 2019-11-11 14:04 UTC (permalink / raw)
  To: Alex Griffin; +Cc: 38059

"Alex Griffin" <a@ajgrf.com> skribis:

> On Sun, Nov 10, 2019, at 11:31 AM, Ludovic Courtès wrote:
>> Is there some meaningful test that could be written for this service?  I
>> suppose it’d be hard to test without also running a relay.  Anyway, if
>> you can think of a non-trivial test that could detect regressions,
>> you’re welcome to add it to (gnu tests …).
>> 
>> Otherwise LGTM!
>
> It might be possible to run both the frontend and backend on localhost and test it that way. The service currently only supports running as a backend, though. Let me know what you think.

Then I think you can push it as-is, with an eye on implementing the
missing bits later.  :-)

The goal is to ensure we ship services that actually work, and to make
it easy to test for regressions when we upgrade the package or modify
the service.

Thanks!

Ludo’.

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

* bug#38059: [PATCH 3/3] services: Add pagekite-service-type.
  2019-11-11 14:04       ` Ludovic Courtès
@ 2019-11-11 20:18         ` Alex Griffin
  0 siblings, 0 replies; 13+ messages in thread
From: Alex Griffin @ 2019-11-11 20:18 UTC (permalink / raw)
  To: 38059-done; +Cc: Ludovic Courtès

On Mon, Nov 11, 2019, at 2:04 PM, Ludovic Courtès wrote:
> Then I think you can push it as-is, with an eye on implementing the
> missing bits later.  :-)
> 
> The goal is to ensure we ship services that actually work, and to make
> it easy to test for regressions when we upgrade the package or modify
> the service.

Pushed as a2161c861f! I'll keep an eye on the status of Python 3 support see if I can't extend the service and tests when I have time.

-- 
Alex Griffin

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

end of thread, other threads:[~2019-11-11 20:20 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-11-04 14:44 [bug#38059] [PATCH 0/2] gnu: Add pagekite Alex Griffin
2019-11-04 14:47 ` [bug#38059] [PATCH 1/2] gnu: Add python-socksipychain Alex Griffin
2019-11-10 11:21   ` Ludovic Courtès
2019-11-04 14:47 ` [bug#38059] [PATCH 2/2] gnu: Add pagekite Alex Griffin
2019-11-10 11:22   ` Ludovic Courtès
2019-11-11  1:05     ` Alex Griffin
2019-11-11 14:02       ` Ludovic Courtès
2019-11-06 17:44 ` [bug#38059] [PATCH 3/3] services: Add pagekite-service-type Alex Griffin
2019-11-06 18:19 ` Alex Griffin
2019-11-10 11:31   ` Ludovic Courtès
2019-11-11  1:11     ` Alex Griffin
2019-11-11 14:04       ` Ludovic Courtès
2019-11-11 20:18         ` bug#38059: " Alex Griffin

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).