Motivation :
goimapnotify doesn't seem to allow the use of pipes for its
passwordCmd parameter. I use multiline password files to optionally
store additional data, which is quite standard as it's featured on the
main documentation page of password-store
(https://www.passwordstore.org/#organization). I couldn't use
goimapnotify properly as a result.
This patch series does the following :
* the mail-account-get-pass-cmd is replaced by mail-account-pass-args,
which is used between the binary provided by feature-password-store
and the mail-account-fqda.
* wrap the password-store binary like if piped into "| head -1" when
used for password-querying commands.
* adapt isync configuration to both previous changes.
Nicolas Graves (6):
rde: mail: Split mail-account-get-pass-cmd
rde: mail: Allow gexp mail-account-get-pass-cmd in serialization
rde: mail: Use pass-binary from feature-password-store
rde: password-store: Add pass-binary value
rde: password-store: Wrap pass-binary to handle multiline files
rde: isync: Use char serialization to quote PassCmd
src/gnu/home-services/mail.scm | 3 ++-
src/rde/features/mail.scm | 39 ++++++++++++++++-------------
src/rde/features/password-utils.scm | 25 +++++++++++++++++-
3 files changed, 47 insertions(+), 20 deletions(-)
--
2.45.2
Splits mail-account-get-pass-cmd into string
mail-account-pass-binary and list of strings mail-account-pass-args.
---
src/rde/features/mail.scm | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/src/rde/features/mail.scm b/src/rde/features/mail.scm
index 329144d9..3d06d5c2 100644
--- a/src/rde/features/mail.scm+++ b/src/rde/features/mail.scm
@@ -64,7 +64,8 @@
mail-account-user
mail-account-get-user
mail-account-synchronizer
- mail-account-get-pass-cmd+ mail-account-pass-binary+ mail-account-pass-args mailing-list
mailing-list-id
@@ -109,15 +110,20 @@ scenarios, during generation of @file{mbsyncrc} for example.")
"User name. Will default to @code{fqda}.")
;; TODO: Add sign? field. or maybe just annoy users, which doesn't
;; have a gpg key for all emails they use?
- (pass-cmd+ (pass-binary (maybe-string #f)
- "Command returning a password. If value not provided @code{pass-show mail/$fqda} will be used, where @code{$fqda} is a value of fqda-field."))+ "Binary to use to get password. This field is composed with+@code{pass-args} to produce the command returning a password.")+ (pass-args+ (list-of-strings '())+ "List of strings passed to @code{pass-binary} to produce the command+returning a password."))(define (mail-account-get-pass-cmd mail-account)
- (if (mail-account-pass-cmd mail-account)- (mail-account-pass-cmd mail-account)+ (if (mail-account-pass-binary mail-account)+ (string-join (cons* (mail-account-pass-binary mail-account)+ (mail-account-pass-args mail-account))+ " ") (string-append "pass show mail/" (mail-account-fqda mail-account))))
(define (mail-account-get-user account)
@@ -1047,11 +1053,11 @@ control whether to NOTIFY? when new emails arrive."
(pipeline-depth #f))
(ensure-pred symbol? subfolders)
- (define (isync-settings mail-directory mail-account)+ (define (isync-settings mail-directory mail-account config) (let* ((id (mail-account-id mail-account))
(account (symbol->string id))
(user (mail-account-get-user mail-account))
- (pass-cmd (mail-account-get-pass-cmd mail-account)))+ (pass-cmd (mail-account-get-pass-cmd mail-account config))) `(,#~(string-append "# Account '" #$(symbol->string id)
" starts here")
(IMAPAccount ,id)
@@ -1252,7 +1258,7 @@ mail accounts. ISYNC-VERBOSE controls output verboseness of
(define (serialize-mail-acc mail-acc)
((assoc-ref isync-serializers (mail-account-type mail-acc))
- mail-directory mail-acc))+ mail-directory mail-acc config)) (list
(simple-service
--
2.45.2
[PATCH rde 2/6] rde: mail: Allow gexp mail-account-get-pass-cmd in serialization
---
src/rde/features/mail.scm | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/src/rde/features/mail.scm b/src/rde/features/mail.scm
index d5457028..8663507c 100644
--- a/src/rde/features/mail.scm+++ b/src/rde/features/mail.scm
@@ -64,7 +64,6 @@
mail-account-user
mail-account-get-user
mail-account-synchronizer
- mail-account-pass-binary mail-account-pass-args
mailing-list
@@ -110,21 +109,19 @@ scenarios, during generation of @file{mbsyncrc} for example.")
"User name. Will default to @code{fqda}.")
;; TODO: Add sign? field. or maybe just annoy users, which doesn't
;; have a gpg key for all emails they use?
- (pass-binary- (maybe-string #f)- "Binary to use to get password. This field is composed with-@code{pass-args} to produce the command returning a password.") (pass-args
- (list-of-strings '())- "List of strings passed to @code{pass-binary} to produce the command-returning a password."))+ (list-of-strings+ (list "show"))+ "List of strings prefixed with @code{pass-binary} and suffixed with+@code{fqda} to produce the command returning the password."))-(define (mail-account-get-pass-cmd mail-account)- (if (mail-account-pass-binary mail-account)- (string-join (cons* (mail-account-pass-binary mail-account)- (mail-account-pass-args mail-account))- " ")- (string-append "pass show mail/" (mail-account-fqda mail-account))))+(define (mail-account-get-pass-cmd mail-account config)+ (file-append+ (get-value 'pass-binary config)+ (string-join+ `("" ,@(mail-account-pass-args mail-account)+ ,(mail-account-fqda mail-account))+ " ")))(define (mail-account-get-user account)
"Return the value of user field or fqda if a value for user filed is not
@@ -435,7 +432,7 @@ Example:
"-" address "\n"
"from " address "\n"
"user " (mail-account-get-user acc) "\n"
- "passwordeval " (mail-account-get-pass-cmd acc) "\n"+ "passwordeval " (mail-account-get-pass-cmd acc config) "\n" (msmtp-serializer msmtp-provider-settings acc)))
(mail-account-get-addresses acc)))
mail-accs)))))
@@ -970,7 +967,7 @@ control whether to NOTIFY? when new emails arrive."
(tls . #f)
(tlsOptions . ((rejectUnauthorized . #t)))
(username . ,(mail-account-fqda acc))
- (passwordCmd . ,(mail-account-get-pass-cmd acc))+ (passwordCmd . ,(mail-account-get-pass-cmd acc config)) (xoauth2 . #f)
(alias . ,(mail-account-id acc))
(trigger . 20)
--
2.45.2
[PATCH rde 4/6] rde: password-store: Add pass-binary value
This is a light update to the first patch series. It's rebased, and
the last command wraps the PassCmd explicitely instead of the previous
char serialization method.
Nicolas Graves (6):
rde: mail: Split mail-account-get-pass-cmd
rde: mail: Allow gexp mail-account-get-pass-cmd in serialization
rde: mail: Use pass-binary from feature-password-store
rde: password-store: Add pass-binary value
rde: password-store: Wrap pass-binary to handle multiline files
rde: isync: Wrap pass-cmd in quotes
src/rde/features/mail.scm | 45 +++++++++++++++--------------
src/rde/features/password-utils.scm | 25 +++++++++++++++-
2 files changed, 48 insertions(+), 22 deletions(-)
--
2.46.0
---
src/rde/features/mail.scm | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)
diff --git a/src/rde/features/mail.scm b/src/rde/features/mail.scm
index 5b7e56fb5..e16d9e18d 100644
--- a/src/rde/features/mail.scm+++ b/src/rde/features/mail.scm
@@ -66,7 +66,6 @@
mail-account-user
mail-account-get-user
mail-account-synchronizer
- mail-account-pass-binary mail-account-pass-args
mailing-list
@@ -113,21 +112,19 @@ scenarios, during generation of @file{mbsyncrc} for example.")
"User name. Will default to @code{fqda}.")
;; TODO: Add sign? field. or maybe just annoy users, which doesn't
;; have a gpg key for all emails they use?
- (pass-binary- (maybe-string #f)- "Binary to use to get password. This field is composed with-@code{pass-args} to produce the command returning a password.") (pass-args
- (list-of-strings '())- "List of strings passed to @code{pass-binary} to produce the command-returning a password."))+ (list-of-strings+ (list "show"))+ "List of strings prefixed with @code{pass-binary} and suffixed with+@code{fqda} to produce the command returning the password."))-(define (mail-account-get-pass-cmd mail-account)- (if (mail-account-pass-binary mail-account)- (string-join (cons* (mail-account-pass-binary mail-account)- (mail-account-pass-args mail-account))- " ")- (string-append "pass show mail/" (mail-account-fqda mail-account))))+(define (mail-account-get-pass-cmd mail-account config)+ (file-append+ (get-value 'pass-binary config)+ (string-join+ `("" ,@(mail-account-pass-args mail-account)+ ,(mail-account-fqda mail-account))+ " ")))(define (mail-account-get-user account)
"Return the value of user field or fqda if a value for user filed is not
@@ -435,7 +432,7 @@ unlikely you ever need this)."
"-" address "\n"
"from " address "\n"
"user " (mail-account-get-user acc) "\n"
- "passwordeval " (mail-account-get-pass-cmd acc) "\n"+ "passwordeval " (mail-account-get-pass-cmd acc config) "\n" (msmtp-serializer msmtp-provider-settings acc)))
(mail-account-get-addresses acc)))
mail-accs)))))
@@ -970,7 +967,7 @@ control whether to NOTIFY? when new emails arrive."
(tls . #f)
(tlsOptions . ((rejectUnauthorized . #t)))
(username . ,(mail-account-fqda acc))
- (passwordCmd . ,(mail-account-get-pass-cmd acc))+ (passwordCmd . ,(mail-account-get-pass-cmd acc config)) (xoauth2 . #f)
(alias . ,(mail-account-id acc))
(trigger . 20)
--
2.46.0
[PATCH rde v2 4/6] rde: password-store: Add pass-binary value