jac*_*c92 5 ubuntu email plugin sasl
我似乎不知道如何使用mbsyncGmail 的 OAuth,因为我无法在 Ubuntu 上mbsync找到 xoauth2sasl插件。我相当有信心mbsyncOAuth 配置的所有内容都正常工作(例如,手动测试 PassCmd 成功生成访问令牌)
编辑:我已经sasl-bin通过 apt 安装,并从源代码https://github.com/robn/sasl2-oauth 。
问题
sasl插件mbsync?(又名将其添加到下面粘贴的第一个日志中的“可用”SASL 机制列表中)使用mbsync通过安装nix-env,我一直无法通过
C: 0/1 B: 0/0 M: +0/0 *0/0 #0/0 S: +0/0 *0/0 #0/0
IMAP error: selected SASL mechanism(s) not available;
selected: XOAUTH2
available: GS2-IAKERB GS2-KRB5 SCRAM-SHA-1 SCRAM-SHA-256 GSS-SPNEGO GSSAPI DIGEST-MD5 EXTERNAL OTP CRAM-MD5 PLAIN LOGIN ANONYMOUS
C: 1/1 B: 0/0 M: +0/0 *0/0 #0/0 S: +0/0 *0/0 #0/0
Run Code Online (Sandbox Code Playgroud)
我还尝试mbsync/isync过从 apt 重新安装以及isync从源代码构建。这两者都会导致以下错误。
Notice: Master/Slave are deprecated; use Far/Near instead.
C: 0/1 B: 0/0 F: +0/0 *0/0 #0/0 N: +0/0 *0/0 #0/0
Error: SASL(-1): generic failure: Unable to find a callback: 32775
C: 1/1 B: 0/0 F: +0/0 *0/0 #0/0 N: +0/0 *0/0 #0/0
Run Code Online (Sandbox Code Playgroud)
感谢您之前的提示。我已经设法让 XOAUTH2 在 SASL 中工作并将其与 mbsync 一起使用。以下是我如何让它在 Ubuntu 20.10 上运行:
# Clone the Cyrus SASL OAuth2 sources.
git clone https://github.com/moriyoshi/cyrus-sasl-xoauth2.git
# Configure and make.
cd cyrus-sasl-xoauth2
./autogen.sh
./configure
# SASL2 libraries on Ubuntu are in /usr/lib/x86_64-linux-gnu/; modify the Makefile accordingly
sed -i 's%pkglibdir = ${CYRUS_SASL_PREFIX}/lib/sasl2%pkglibdir = ${CYRUS_SASL_PREFIX}/lib/x86_64-linux-gnu/sasl2%' Makefile
make
sudo make install
# Verify XOAUTH2 is known to SASL.
saslpluginviewer | grep XOAUTH2
Run Code Online (Sandbox Code Playgroud)
旧版本(直到 1.3.1?)将 PassCmd 缓冲区设置为 80——这对于 OAuth2 令牌来说是不够的。我编译了当前的1.4.0:
# Clone the isync/mbsync 1.4 sources.
git clone --branch 1.4 --depth 1 https://git.code.sf.net/p/isync/isync isync-isync
# Configure and make.
cd isync-isync
./autogen.sh
./configure
make
Run Code Online (Sandbox Code Playgroud)
从https://gitlab.com/muttmua/mutt/-/blob/master/contrib/mutt_oauth2.py下载 mutt_oauth2.py并使其可执行。
我有一个修改版本,可以使用 OAuth2 令牌创建套接字。这样我就可以通过套接字访问令牌:
curl --unix-socket ~/.mutt/oauth2.socket x
Run Code Online (Sandbox Code Playgroud)
请注意,您的里程可能会有所不同,并且您将需要不同的 PassCmd 来访问 OAuth2 令牌。
配置 mbsync 使用 XOAUTH2 并设置 PassCmd 执行上述curl命令:
IMAPAccount <account-name>
Host outlook.office365.com
User <first.last@yourcompany.com>
AuthMechs XOAUTH2
PassCmd "curl --unix-socket ~/.mutt/oauth2.socket x"
SSLType IMAPS
SSLVersions TLSv1.1 TLSv1.2
Run Code Online (Sandbox Code Playgroud)
mbsync 然后按预期工作;请注意下面curl 的输出:
$ mbsync -a
C: 0/1 B: 0/0 F: +0/0 *0/0 #0/0 N: +0/0 *0/0 #0/0 % Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 1963 0 1963 0 0 479k 0 --:--:-- --:--:-- --:--:-- 479k
C: 1/1 B: 15/15 F: +0/0 *0/0 #0/0 N: +847/847 *0/0 #0/0
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6926 次 |
| 最近记录: |