mutt & mutt_oauth.py - mutt_account_getoauthbearer: コマンドは空の文字列を返します。

mutt & mutt_oauth.py - mutt_account_getoauthbearer: コマンドは空の文字列を返します。

Exchange 365の電子メールアカウントを使用してMutt Terminalの電子メールクライアントを設定しようとしています。私はmutt_oauth.pyOAuthの流れを促進するためにそれを使用します。

私は以下の指示に従いました。閲覧ファイルしかし、問題が発生しました。 muttをロードするとログインしようとしますが、次のエラーが返されます。

mutt_account_getoauthbearer: Command returned empty string

出力は次のとおりですmutt -d 5

[2022-10-19 13:49:59] Mutt/2.2.7 (2022-08-07) debugging at level 5
[2022-10-19 13:49:59] In mutt_reflow_windows
[2022-10-19 13:49:59] In mutt_reflow_windows
[2022-10-19 13:49:59] In mutt_reflow_windows
[2022-10-19 13:49:59] In mutt_reflow_windows
[2022-10-19 13:49:59] Reading configuration file '/opt/homebrew/Cellar/mutt/2.2.7/etc/Muttrc'.
[2022-10-19 13:49:59] parse_attach_list: ldata = 0x1047c9e90, *ldata = 0x0
[2022-10-19 13:49:59] parse_attach_list: added */.* [9]
[2022-10-19 13:49:59] parse_attach_list: ldata = 0x1047c9ea0, *ldata = 0x0
[2022-10-19 13:49:59] parse_attach_list: added text/x-vcard [7]
[2022-10-19 13:49:59] parse_attach_list: added application/pgp.* [2]
[2022-10-19 13:49:59] parse_attach_list: ldata = 0x1047c9ea0, *ldata = 0x600001d588d0
[2022-10-19 13:49:59] parse_attach_list: skipping text/x-vcard
[2022-10-19 13:49:59] parse_attach_list: skipping application/pgp.*
[2022-10-19 13:49:59] parse_attach_list: added application/x-pkcs7-.* [2]
[2022-10-19 13:49:59] parse_attach_list: ldata = 0x1047ca300, *ldata = 0x0
[2022-10-19 13:49:59] parse_attach_list: added text/plain [7]
[2022-10-19 13:49:59] parse_attach_list: ldata = 0x1047c9ea0, *ldata = 0x600001d588d0
[2022-10-19 13:49:59] parse_attach_list: skipping text/x-vcard
[2022-10-19 13:49:59] parse_attach_list: skipping application/pgp.*
[2022-10-19 13:49:59] parse_attach_list: skipping application/x-pkcs7-.*
[2022-10-19 13:49:59] parse_attach_list: added message/external-body [4]
[2022-10-19 13:49:59] parse_attach_list: ldata = 0x1047ca308, *ldata = 0x0
[2022-10-19 13:49:59] parse_attach_list: added message/external-body [4]
[2022-10-19 13:49:59] Reading configuration file '/Users/jlcarveth/.mutt/muttrc'.
[2022-10-19 13:49:59] Using default IMAP port 143
[2022-10-19 13:49:59] Using default IMAPS port 993
[2022-10-19 13:49:59] Setting $hostname
[2022-10-19 13:49:59] getdnsdomainname(): localdomain
[2022-10-19 13:49:59] $hostname set to "JLCM2.localdomain"
[2022-10-19 13:49:59] Reading imap://outlook.office365.com/INBOX...
[2022-10-19 13:49:59] Looking up outlook.office365.com...
[2022-10-19 13:49:59] Connecting to outlook.office365.com...
[2022-10-19 13:49:59] Connected to outlook.office365.com:143 on fd=7
[2022-10-19 13:49:59] imap_cmd_step: grew buffer to 512 bytes
[2022-10-19 13:49:59] 7< * OK The Microsoft Exchange IMAP4 service is ready. [***OMITTED***]
[2022-10-19 13:49:59] IMAP queue drained
[2022-10-19 13:49:59] 7> a0000 CAPABILITY
[2022-10-19 13:49:59] 7< * CAPABILITY IMAP4 IMAP4rev1 LOGINDISABLED STARTTLS SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
[2022-10-19 13:49:59] Handling CAPABILITY
[2022-10-19 13:49:59] 7< a0000 OK CAPABILITY completed.
[2022-10-19 13:49:59] IMAP queue drained
[2022-10-19 13:49:59] 7> a0001 STARTTLS
[2022-10-19 13:49:59] 7< a0001 OK Begin TLS negotiation now.
[2022-10-19 13:49:59] IMAP queue drained
[2022-10-19 13:49:59] ssl_load_certificates: loading trusted certificates
[2022-10-19 13:49:59] mutt_ssl_starttls: Error loading trusted certificates
[2022-10-19 13:49:59] ssl_verify_callback: checking cert chain entry /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert Global Root CA (preverify: 1 skipmode: 0)
[2022-10-19 13:49:59] ssl_verify_callback: checking cert chain entry /C=US/O=DigiCert Inc/CN=DigiCert Cloud Services CA-1 (preverify: 1 skipmode: 0)
[2022-10-19 13:49:59] ssl_verify_callback: checking cert chain entry /C=US/ST=Washington/L=Redmond/O=Microsoft Corporation/CN=outlook.com (preverify: 1 skipmode: 0)
[2022-10-19 13:49:59] ssl_verify_callback: hostname check passed
[2022-10-19 13:49:59] TLSv1.2 connection using TLSv1.2 (ECDHE-RSA-AES256-GCM-SHA384)
[2022-10-19 13:50:00] 7> a0002 CAPABILITY
[2022-10-19 13:50:00] 7< * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
[2022-10-19 13:50:00] Handling CAPABILITY
[2022-10-19 13:50:00] 7< a0002 OK CAPABILITY completed.
[2022-10-19 13:50:00] IMAP queue drained
[2022-10-19 13:50:00] imap_authenticate: Trying method oauthbearer
[2022-10-19 13:50:00] SASL local ip: 192.168.1.248;55042, remote ip:52.96.88.162;143
[2022-10-19 13:50:00] External SSF: 256
[2022-10-19 13:50:00] mutt_sasl_cb_authname: getting user for outlook.office365.com:143
[2022-10-19 13:50:00] imap_auth_sasl: oauthbearer unavailable
[2022-10-19 13:50:00] imap_authenticate: Trying method xoauth2
[2022-10-19 13:50:00] Authenticating (XOAUTH2)...
[2022-10-19 13:50:00] mutt_account_getoauthbearer: Command returned empty string
[2022-10-19 13:50:02] mutt_index_menu[827]: Got op 99
[2022-10-19 13:50:02] q: unknown command
[2022-10-19 13:50:03] mutt_index_menu[827]: Got op 177
[2022-10-19 13:50:03] Closing connection to outlook.office365.com...
[2022-10-19 13:50:03] 7> a0003 LOGOUT
[2022-10-19 13:50:03] 7< * BYE Microsoft Exchange Server IMAP4 server signing off.
[2022-10-19 13:50:03] Handling BYE
[2022-10-19 13:50:03] 7< a0003 OK LOGOUT completed.
[2022-10-19 13:50:03] IMAP queue drained
[2022-10-19 13:50:03] mutt_buffer_pool_free: 10 of 10 returned to pool

このエラーを解決する方法がわかりません。実行すると、トークンが印刷され、問題がないため、トークンが有効なようです。python3 mutt_oauth.py [email protected] --verbose --test

私は~/.mutt/muttrcとても簡単です。

set imap_user="***OMITTED***"
set folder="imap://outlook.office365.com/"
#set imap_pass='***OMITTED***'
set smtp_url = "smtp://${imap_user}@smtp.office365.com:587/"
set imap_authenticators="oauthbearer:xoauth2"
set imap_oauth_refresh_command="/Users/jlcarveth/mutt_oauth.py \
    --quiet ${imap_user}.tokens"
set smtp_authenticators='${imap_authenticators}'
set smtp_oauth_refresh_command=${imap_oauth_refresh_command}
set spoolfile=+INBOX

# Store message headers locally to speed things up
set header_cache=~/.cache/mutt
set message_cachedir=~/.cache/mutt

# Allow mutt to open an IMAP connection passively
unset imap_passive

set imap_keepalive = 300

マート v 2.2.7

答え1

この行はここにあります。

set imap_oauth_refresh_command="/Users/jlcarveth/mutt_oauth.py \
--quiet ${imap_user}.tokens"

${imap_user}.tokens絶対パスではありません。私の考えでは、これがあなたの問題だと思います。ここにトークンファイルのフルパスを追加してみてください。

答え2

Muttのメソッドは、定義mutt_account_getoauthbearerしたものを使用してimap_oauth_refresh_commandトークンを取得または更新しようとします。Command returned empty string何らかの理由で外部スクリプト呼び出しが失敗したことを意味します。考えられる理由:

  • 外部リフレッシュコマンドへのパスが正しくありません。を指定しました をmutt_oauth.py意味しますかmutt_oauth2.py, スクリプト名を変更しましたか?

  • パスが${imap_user}.tokens間違っています。 (@ mokchiraが指摘したように、トークンストアのフルパスでなければなりません。)

  • キーはパスワードで保護されていますが、環境変数がシェルに対して正しく設定されていないgpg-agentため、パスワードの入力を求められません。GPG_TTY

/path/to/mutt_oauth.py /path/to/${imap_user}.tokensシェルで実行すると認証トークンが返されますが、Muttでまだエラーが発生するGPG_TTY場合は、ここからGPGキーからパスワードを一時的に削除して問題を分離できます。

関連情報