Exchange 365 이메일 계정을 사용하여 Mutt Terminal 이메일 클라이언트를 설정하려고 합니다. 저는 mutt_oauth.py
OAuth 흐름을 촉진하기 위해 이를 사용합니다.
나는 다음의 지침을 따랐습니다.읽어보기 파일하지만 문제가 발생했습니다. 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 키에서 비밀번호를 일시적으로 제거하여 문제를 격리할 수 있습니다.