我有一个系统用户syncoid
作为
$ cat /etc/passwd
syncoid:x:993:990::/var/lib/syncoid:/run/current-system/sw/bin/nologin
使用以下ssh配置:
$ cat /var/lib/syncoid/.ssh/config
Host eve
User other
HostName 192.168.10.1
ProxyJump jumphost
IdentityFile /var/lib/syncoid/.ssh/eve-syncoid
Host jumphost
ForwardAgent yes
User me
HostName 192.168.1.1
IdentityFile /var/lib/syncoid/.ssh/eve-syncoid
我可以连接和登录到跳转与sudo -u syncoid ssh jumphost
。但是,与服务器eve
的sudo -u syncoid ssh -vvv eve
连接将在
OpenSSH_8.8p1, OpenSSL 1.1.1m 14 Dec 2021
debug1: Reading configuration data /var/lib/syncoid/.ssh/config
debug1: /var/lib/syncoid/.ssh/config line 1: Applying options for eve
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 5: Applying options for *
debug2: resolve_canonicalize: hostname 192.168.10.1 is address
debug1: Setting implicit ProxyCommand from ProxyJump: ssh -vvv -W '[%h]:%p' jumphost
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/var/lib/syncoid/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/var/lib/syncoid/.ssh/known_hosts2'
debug1: Executing proxy command: exec ssh -vvv -W '[192.168.10.1]:22' jumphost
debug1: identity file /var/lib/syncoid/.ssh/eve-syncoid type 0
debug1: identity file /var/lib/syncoid/.ssh/eve-syncoid-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.8
debug1: kex_exchange_identification: banner line 0: This account is currently not available.
kex_exchange_identification: Connection closed by remote host
Connection closed by UNKNOWN port 65535
我是否需要一个具有shell的常规用户来执行ProxyJump?
编辑:
eve
而不使用ProxyJump可以工作,所以所有的键和配置都是正确的。发布于 2022-02-20 11:40:00
这实际上不是一个ProxyJump问题--该服务是一个具有有限RootDirectory的强化系统服务,因此它不能访问私有ssh密钥。
必须将带有私钥的文件夹添加到BindReadonlyPaths
后的这个github评论中
config.services.syncoid.service.serviceConfig.BindReadOnlyPaths = [
"/var/lib/syncoid/.ssh"
];
随着评论的进一步深入,这将在未来解决通过这个拉力请求问题。
发布于 2022-02-20 10:03:55
这实际上是NixOS中的syncoid服务定义过于限制性的问题。我不得不重写
systemd.services."syncoid-rpool-user-home" = {
serviceConfig = {
ProtectHome = lib.mkForce false;
StateDirectory = lib.mkForce "";
RootDirectory = lib.mkForce "";
};
};
https://unix.stackexchange.com/questions/690494
复制相似问题