unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#59018] [PATCH 0/1] OAuth2 for mbsync
@ 2022-11-04 17:56 peter
  2022-11-04 17:56 ` [bug#59019] [PATCH 1/1] gnu: Add cyrus-sasl-xoauth2 peter
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: peter @ 2022-11-04 17:56 UTC (permalink / raw)
  To: 59018; +Cc: Peter Polidoro

From: Peter Polidoro <peter@polidoro.io>

I am trying to get OAuth2 working for mbsync so I can check an email account
that has discontinued basic authorization.

Following these steps:
https://github.com/harishkrupo/oauth2ms/blob/main/steps.org

I am at the point of needing the xoauth2 sasl plugin to make mbsync work with
the XOAUTH2 AuthMech. Perhaps that is already a part of Guix, but I was unable
to find it.

Here is an implementation of the xoaut2 sasl plugin that I attempted to package:
https://github.com/moriyoshi/cyrus-sasl-xoauth2

It seems to compile correctly, but I was unsure of how to do the configuration
in order to make it install into the proper location. It defaults into
installing it to:
/usr/lib/sasl2

Perhaps it instead needs to go into the /lib/sasl2 directory within the
cyrus-sasl package, but I do not know how to specify that in this package's
configuration.

I assume that if cyrus-sasl is able to detect and use this plugin then it will
have the ability to use XOAUTH2 making mbsync work correctly, but that would
have to be tested to make sure more configuration is not needed.

Peter Polidoro (1):
  gnu: Add cyrus-sasl-xoauth2.

 gnu/packages/cyrus-sasl.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

-- 
2.38.0





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

* [bug#59019] [PATCH 1/1] gnu: Add cyrus-sasl-xoauth2.
  2022-11-04 17:56 [bug#59018] [PATCH 0/1] OAuth2 for mbsync peter
@ 2022-11-04 17:56 ` peter
  2022-11-06 21:12 ` [bug#59018] (no subject) dan
  2022-11-15 10:49 ` [bug#59018] [PATCH 0/1] OAuth2 for mbsync Ludovic Courtès
  2 siblings, 0 replies; 9+ messages in thread
From: peter @ 2022-11-04 17:56 UTC (permalink / raw)
  To: 59019; +Cc: Peter Polidoro

From: Peter Polidoro <peter@polidoro.io>

* gnu/packages/cyrus-sasl.scm (cyrus-sasl-xoauth2): New variable.
---
 gnu/packages/cyrus-sasl.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/cyrus-sasl.scm b/gnu/packages/cyrus-sasl.scm
index 2cd18f3e5e..ddb8c476ac 100644
--- a/gnu/packages/cyrus-sasl.scm
+++ b/gnu/packages/cyrus-sasl.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2022 Peter Polidoro <peter@polidoro.io>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -28,6 +29,7 @@ (define-module (gnu packages cyrus-sasl)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix build-system gnu))
 
 (define-public cyrus-sasl
@@ -78,3 +80,33 @@ (define-public cyrus-sasl
    (license (license:non-copyleft "file://COPYING"
                                   "See COPYING in the distribution."))
    (home-page "https://cyrusimap.org/sasl/")))
+
+(define-public cyrus-sasl-xoauth2
+  (package
+    (name "cyrus-sasl-xoauth2")
+    (version "0.2")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/moriyoshi/cyrus-sasl-xoauth2")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1py9f1mn5k5xihrk0lfrwr6723c22gjb7lmgya83ibvislm2x3wl"))))
+    (build-system gnu-build-system)
+    (arguments
+     ;; Not sure what is required here in order to get this installed into the
+     ;; correct location. Maybe it needs to be installed in the plugindir for
+     ;; the cyrus-sasl package above? Not sure how to reference that directory
+     ;; in this package though.
+    '(#:configure-flags (list (string-append "--prefix="
+                                             (assoc-ref %outputs "out")
+                                             "/lib/sasl2"))))
+    (native-inputs (list autoconf automake libtool))
+    (inputs (list cyrus-sasl))
+    (home-page "https://github.com/moriyoshi/cyrus-sasl-xoauth2")
+    (synopsis "XOAUTH2 mechanism plugin for cyrus-sasl")
+    (description "XOAUTH2 mechanism plugin for cyrus-sasl.")
+    (license (list license:expat license:expat))))
+
-- 
2.38.0





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

* [bug#59018] (no subject)
  2022-11-04 17:56 [bug#59018] [PATCH 0/1] OAuth2 for mbsync peter
  2022-11-04 17:56 ` [bug#59019] [PATCH 1/1] gnu: Add cyrus-sasl-xoauth2 peter
@ 2022-11-06 21:12 ` dan
  2022-11-06 21:18   ` ( via Guix-patches via
  2022-11-15 10:49 ` [bug#59018] [PATCH 0/1] OAuth2 for mbsync Ludovic Courtès
  2 siblings, 1 reply; 9+ messages in thread
From: dan @ 2022-11-06 21:12 UTC (permalink / raw)
  To: 59018

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

He peter,

Thanks for the work.  Did you just forget to submit the patch 
file?

-- 
dan

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

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

* [bug#59018] (no subject)
  2022-11-06 21:12 ` [bug#59018] (no subject) dan
@ 2022-11-06 21:18   ` ( via Guix-patches via
  2022-11-07  1:32     ` dan
  0 siblings, 1 reply; 9+ messages in thread
From: ( via Guix-patches via @ 2022-11-06 21:18 UTC (permalink / raw)
  To: dan, 59018

On Sun Nov 6, 2022 at 9:12 PM GMT, dan wrote:
> Thanks for the work.  Did you just forget to submit the patch 
> file?

Funny. The patch seems to have appeared in my inbox, but not on mumi's or debbugs' UI...

    -- (




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

* [bug#59018] (no subject)
  2022-11-06 21:18   ` ( via Guix-patches via
@ 2022-11-07  1:32     ` dan
  0 siblings, 0 replies; 9+ messages in thread
From: dan @ 2022-11-07  1:32 UTC (permalink / raw)
  To: (; +Cc: 59018


Nov 7, 2022 5:18:25 AM ( <paren@disroot.org>:

> On Sun Nov 6, 2022 at 9:12 PM GMT, dan wrote:
>> Thanks for the work.  Did you just forget to submit the patch
>> file?
>
> Funny. The patch seems to have appeared in my inbox, but not on mumi's 
> or debbugs' UI...
>
>     -- (
> Funny. The patch seems to have appeared in my inbox, but not on mumi's 
> or debbugs' UI...

My bad, it's actually #59019




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

* [bug#59018] [PATCH 0/1] OAuth2 for mbsync
  2022-11-04 17:56 [bug#59018] [PATCH 0/1] OAuth2 for mbsync peter
  2022-11-04 17:56 ` [bug#59019] [PATCH 1/1] gnu: Add cyrus-sasl-xoauth2 peter
  2022-11-06 21:12 ` [bug#59018] (no subject) dan
@ 2022-11-15 10:49 ` Ludovic Courtès
  2022-11-15 14:55   ` Peter Polidoro
  2 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2022-11-15 10:49 UTC (permalink / raw)
  To: peter; +Cc: 59018

Hi,

peter@polidoro.io skribis:

> It seems to compile correctly, but I was unsure of how to do the configuration
> in order to make it install into the proper location. It defaults into
> installing it to:
> /usr/lib/sasl2
>
> Perhaps it instead needs to go into the /lib/sasl2 directory within the
> cyrus-sasl package, but I do not know how to specify that in this package's
> configuration.

Adding files to another package is not possible.

Packages usually have a search path environment variable for plugins.  I
don’t see one for cyrus-sasl (I just grepped for “getenv” so I might
have overlooked it).  The “Guix way” would be to have cyrus-sasl honor,
say, $CYRUS_SASL_PLUGIN_PATH and look for plugins in those directories,
add a search path to the package¹, and have the plugin installed in
$prefix/lib/sasl2 like you did.

Could you check whether cyrus-sasl already has such a mechanism, or add
one (possibly discussing with upstream), and send updated patches?

Nitpick:

> +    (description "XOAUTH2 mechanism plugin for cyrus-sasl.")

Also, please improve the description².

Thanks in advance,
Ludo’.

¹ https://guix.gnu.org/manual/devel/en/html_node/Search-Paths.html
² https://guix.gnu.org/manual/devel/en/html_node/Synopses-and-Descriptions.html




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

* [bug#59018] [PATCH 0/1] OAuth2 for mbsync
  2022-11-15 10:49 ` [bug#59018] [PATCH 0/1] OAuth2 for mbsync Ludovic Courtès
@ 2022-11-15 14:55   ` Peter Polidoro
  2022-11-17 17:27     ` Ludovic Courtès
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Polidoro @ 2022-11-15 14:55 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 59018

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

Hi,

Ludovic Courtès <ludo@gnu.org> writes:

> Packages usually have a search path environment variable for 
> plugins.  I
> don’t see one for cyrus-sasl (I just grepped for “getenv” so I 
> might
> have overlooked it).  The “Guix way” would be to have cyrus-sasl 
> honor,
> say, $CYRUS_SASL_PLUGIN_PATH and look for plugins in those 
> directories,
> add a search path to the package¹, and have the plugin installed 
> in
> $prefix/lib/sasl2 like you did.
>
> Could you check whether cyrus-sasl already has such a mechanism, 
> or add
> one (possibly discussing with upstream), and send updated 
> patches?

Thank you for your help on this package.

According to the Cyrus SASL quickstart guide:

"Note that the library can use the environment variable SASL_PATH 
to locate the directory where the mechanisms are; this should be a 
colon-separated list of directories containing plugins."[1]

Unfortunately I still do not know enough about Guix packaging to 
set this environment variable properly, nor do I know how to 
properly set the installation path in the package configuration.

This plugin's build and installation instructions are:

./autogen.sh
./configure
sudo make install

Footnotes:
[1] 
https://www.cyrusimap.org/sasl/sasl/quickstart.html#typical-installation


[-- Attachment #2: 0001-gnu-Add-cyrus-sasl-xoauth2.patch --]
[-- Type: text/x-diff, Size: 2649 bytes --]

From d5e9f604531dbf9cf7a16a107a3745d0203e1dd7 Mon Sep 17 00:00:00 2001
Message-Id: <d5e9f604531dbf9cf7a16a107a3745d0203e1dd7.1668524316.git.peter@polidoro.io>
From: Peter Polidoro <peter@polidoro.io>
Date: Tue, 15 Nov 2022 09:50:51 -0500
Subject: [PATCH] gnu: Add cyrus-sasl-xoauth2.

* gnu/packages/cyrus-sasl.scm (cyrus-sasl-xoauth2): New variable.
---
 gnu/packages/cyrus-sasl.scm | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/gnu/packages/cyrus-sasl.scm b/gnu/packages/cyrus-sasl.scm
index 2cd18f3e5e..abc0bc0c2b 100644
--- a/gnu/packages/cyrus-sasl.scm
+++ b/gnu/packages/cyrus-sasl.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2022 Peter Polidoro <peter@polidoro.io>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -28,6 +29,7 @@ (define-module (gnu packages cyrus-sasl)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix build-system gnu))
 
 (define-public cyrus-sasl
@@ -78,3 +80,28 @@ (define-public cyrus-sasl
    (license (license:non-copyleft "file://COPYING"
                                   "See COPYING in the distribution."))
    (home-page "https://cyrusimap.org/sasl/")))
+
+(define-public cyrus-sasl-xoauth2
+  (package
+    (name "cyrus-sasl-xoauth2")
+    (version "0.2")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/moriyoshi/cyrus-sasl-xoauth2")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1py9f1mn5k5xihrk0lfrwr6723c22gjb7lmgya83ibvislm2x3wl"))))
+    (build-system gnu-build-system)
+    (native-inputs (list autoconf automake libtool))
+    (inputs (list cyrus-sasl))
+    (home-page "https://github.com/moriyoshi/cyrus-sasl-xoauth2")
+    (synopsis "XOAUTH2 mechanism plugin for cyrus-sasl")
+    (description "This package adds the Open Authorization standard, OAuth2,
+authentication mechanism to cyrus-sasl as a plugin.  OAuth is an open standard
+for access delegation, commonly used as a way for internet users to grant
+websites or applications access to their information on other websites but
+without giving them the passwords.")
+    (license (list license:expat license:expat))))
-- 
2.38.1


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

* [bug#59018] [PATCH 0/1] OAuth2 for mbsync
  2022-11-15 14:55   ` Peter Polidoro
@ 2022-11-17 17:27     ` Ludovic Courtès
  2022-11-18 15:50       ` Peter Polidoro
  0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2022-11-17 17:27 UTC (permalink / raw)
  To: Peter Polidoro; +Cc: 59018

Peter Polidoro <peter@polidoro.io> skribis:

> According to the Cyrus SASL quickstart guide:
>
> "Note that the library can use the environment variable SASL_PATH to
> locate the directory where the mechanisms are; this should be a
> colon-separated list of directories containing plugins."[1]
>
> Unfortunately I still do not know enough about Guix packaging to set
> this environment variable properly, nor do I know how to properly set
> the installation path in the package configuration.

We’d need to add a ‘native-search-paths’ field for “SASL_PATH” to
cyrus-sasl, as explained in the “Search Paths” section of the manual.
But that can come as a separate patch.

> From d5e9f604531dbf9cf7a16a107a3745d0203e1dd7 Mon Sep 17 00:00:00 2001
> Message-Id: <d5e9f604531dbf9cf7a16a107a3745d0203e1dd7.1668524316.git.peter@polidoro.io>
> From: Peter Polidoro <peter@polidoro.io>
> Date: Tue, 15 Nov 2022 09:50:51 -0500
> Subject: [PATCH] gnu: Add cyrus-sasl-xoauth2.
>
> * gnu/packages/cyrus-sasl.scm (cyrus-sasl-xoauth2): New variable.

It fails to build:

--8<---------------cut here---------------start------------->8---
starting phase `install'
make[1]: Entering directory '/tmp/guix-build-cyrus-sasl-xoauth2-0.2.drv-0/source'
 /gnu/store/d251rfgc9nm2clzffzhgiipdvfvzkvwi-coreutils-8.32/bin/mkdir -p '/usr/lib/sasl2'
/gnu/store/d251rfgc9nm2clzffzhgiipdvfvzkvwi-coreutils-8.32/bin/mkdir: cannot create directory ‘/usr’: Permission denied
make[1]: *** [Makefile:418: install-pkglibLTLIBRARIES] Error 1
--8<---------------cut here---------------end--------------->8---

Could you send an updated patch?  TIA!

Ludo’.




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

* [bug#59018] [PATCH 0/1] OAuth2 for mbsync
  2022-11-17 17:27     ` Ludovic Courtès
@ 2022-11-18 15:50       ` Peter Polidoro
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Polidoro @ 2022-11-18 15:50 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 59018

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

Ludovic Courtès <ludo@gnu.org> writes:
>
> Could you send an updated patch?  TIA!
>
> Ludo’.

I was able to get the package to build by adding a 
"--with-cyrus-sasl" configure-flag.

I am not sure if I used the correct value for this flag, however.

The package's configure file says:

  --with-cyrus-sasl=PREFIX
                          Installation prefix of Cyrus-SASL 
                          (defaults to /usr)

That seems to imply that should be the install location of the 
cyrus-sasl package and that the cyrus-sasl-xoauth2 package will 
get installed into the location specified by the "--prefix" 
configure-flag.

The build failed, though, since it was trying to install into the 
/usr directory, even though "--prefix" was set to something else. 
So I set "--with-cyrus-sasl" to be the path of the 
cyrus-sasl-xoauth2 package out and that seems to work now. I 
assume the compilation would have failed if "--with-cyrus-sasl" 
needed to point to the cyrus-sasl location for dependency reasons.

Now hopefully adding the correct search path to the cyrus-sasl 
package will get the cyrus-sasl-xoauth2 properly recognized as a 
plugin. I can work on that patch when I have some time.

Thank you for your all of your help and patience as I am still 
learning how to create guix packages.


[-- Attachment #2: 0001-gnu-Add-cyrus-sasl-xoauth2.patch --]
[-- Type: text/x-diff, Size: 2817 bytes --]

From ba3fe6dff1d2dbf1cb4d3c383acad57e40f79367 Mon Sep 17 00:00:00 2001
Message-Id: <ba3fe6dff1d2dbf1cb4d3c383acad57e40f79367.1668793140.git.peter@polidoro.io>
From: Peter Polidoro <peter@polidoro.io>
Date: Fri, 18 Nov 2022 12:38:06 -0500
Subject: [PATCH] gnu: Add cyrus-sasl-xoauth2.

* gnu/packages/cyrus-sasl.scm (cyrus-sasl-xoauth2): New variable.
---
 gnu/packages/cyrus-sasl.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/cyrus-sasl.scm b/gnu/packages/cyrus-sasl.scm
index 2cd18f3e5e..1134996d34 100644
--- a/gnu/packages/cyrus-sasl.scm
+++ b/gnu/packages/cyrus-sasl.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
+;;; Copyright © 2022 Peter Polidoro <peter@polidoro.io>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -28,6 +29,7 @@ (define-module (gnu packages cyrus-sasl)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix git-download)
   #:use-module (guix build-system gnu))
 
 (define-public cyrus-sasl
@@ -78,3 +80,31 @@ (define-public cyrus-sasl
    (license (license:non-copyleft "file://COPYING"
                                   "See COPYING in the distribution."))
    (home-page "https://cyrusimap.org/sasl/")))
+
+(define-public cyrus-sasl-xoauth2
+  (package
+    (name "cyrus-sasl-xoauth2")
+    (version "0.2")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/moriyoshi/cyrus-sasl-xoauth2")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1py9f1mn5k5xihrk0lfrwr6723c22gjb7lmgya83ibvislm2x3wl"))))
+    (build-system gnu-build-system)
+    (arguments
+     '(#:configure-flags (list (string-append "--with-cyrus-sasl="
+                                              (assoc-ref %outputs "out")))))
+    (native-inputs (list autoconf automake libtool))
+    (inputs (list cyrus-sasl))
+    (home-page "https://github.com/moriyoshi/cyrus-sasl-xoauth2")
+    (synopsis "XOAUTH2 mechanism plugin for cyrus-sasl")
+    (description "This package adds the Open Authorization standard, OAuth2,
+authentication mechanism to cyrus-sasl as a plugin.  OAuth is an open standard
+for access delegation, commonly used as a way for internet users to grant
+websites or applications access to their information on other websites but
+without giving them the passwords.")
+    (license (list license:expat license:expat))))
-- 
2.38.1


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

end of thread, other threads:[~2022-11-18 17:41 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-04 17:56 [bug#59018] [PATCH 0/1] OAuth2 for mbsync peter
2022-11-04 17:56 ` [bug#59019] [PATCH 1/1] gnu: Add cyrus-sasl-xoauth2 peter
2022-11-06 21:12 ` [bug#59018] (no subject) dan
2022-11-06 21:18   ` ( via Guix-patches via
2022-11-07  1:32     ` dan
2022-11-15 10:49 ` [bug#59018] [PATCH 0/1] OAuth2 for mbsync Ludovic Courtès
2022-11-15 14:55   ` Peter Polidoro
2022-11-17 17:27     ` Ludovic Courtès
2022-11-18 15:50       ` Peter Polidoro

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).