[mbsync] Get the account credentials from the secret service

Instead of using my custom Python script that looks them up, just use the
command-line application included in the ‘libsecret’ package on Archlinux.

Remove the custom helper script that I’d written for them.
This commit is contained in:
Tom Willemse 2021-10-21 23:45:24 -07:00
parent 92d2d4650e
commit f5896ccc12
3 changed files with 2 additions and 31 deletions

View file

@ -2,7 +2,7 @@
IMAPAccount ryuslash
Host imap-ryuslash.alwaysdata.net
User tom@ryuslash.org
PassCmd "~/usr/bin/get-mail-password ryuslash"
PassCmd "secret-tool lookup application mbsync account ryuslash"
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
@ -26,7 +26,7 @@ SyncState *
IMAPAccount gmail
Host imap.gmail.com
User ryuslash@gmail.com
PassCmd "~/usr/bin/get-mail-password gmail"
PassCmd "secret-tool lookup application mbsync account gmail"
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt

View file

@ -1,12 +0,0 @@
#!/usr/bin/python3
import sys
import secretstorage
connection = secretstorage.dbus_init()
collection = secretstorage.get_collection_by_alias(connection, "login")
for foo in collection.search_items(
{"application": "mbsync", "account": sys.argv[1]}
):
print(foo.get_secret().decode())

View file

@ -1,17 +0,0 @@
#!/usr/bin/python3
import sys
from getpass import getpass
import secretstorage
connection = secretstorage.dbus_init()
collection = secretstorage.get_collection_by_alias(connection, "login")
attributes = {"application": "mbsync", "account": sys.argv[1]}
collection.create_item(
"Password for '{}' on '{}'".format(
attributes["account"], attributes["application"]
),
attributes,
getpass().encode(),
)