![无法将 Landscape 客户端注册到本地服务器](https://linux22.com/image/1009285/%E6%97%A0%E6%B3%95%E5%B0%86%20Landscape%20%E5%AE%A2%E6%88%B7%E7%AB%AF%E6%B3%A8%E5%86%8C%E5%88%B0%E6%9C%AC%E5%9C%B0%E6%9C%8D%E5%8A%A1%E5%99%A8.png)
我在 Ubuntu 18.04 VM 上安装了 Landscape Server 18.03,并顺利地进行自我监控。所以那边似乎可以正常工作。
我正在尝试注册另一个 18.04 VM
sudo landscape-config --computer-title "landscape client" --account-name standalone --url https://landscape.localhost/message-system --ping-url http://landscape.localhost/ping
并得到
We were unable to contact the server.
Your internet connection may be down. The landscape client will continue to try and contact the server periodically.
broker.log 包含
sudo tail -n 19 /var/log/landscape/broker.log
2018-08-11 20:45:00,394 INFO [MainThread] Starting urgent message exchange with https://landscape.localhost/message-system.
2018-08-11 20:45:00,400 ERROR [PoolThread-twisted.internet.reactor-0] Error contacting the server at https://landscape.localhost/message-system.
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/landscape/lib/fetch.py", line 116, in fetch
curl.perform()
pycurl.error: (77, '')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/landscape/client/broker/transport.py", line 82, in exchange
message_api)
File "/usr/lib/python3/dist-packages/landscape/client/broker/transport.py", line 56, in _curl
headers=headers, cainfo=self._pubkey, curl=curl))
File "/usr/lib/python3/dist-packages/landscape/lib/fetch.py", line 118, in fetch
raise PyCurlError(e.args[0], e.args[1])
landscape.lib.fetch.PyCurlError: Error 77:
2018-08-11 20:45:00,401 INFO [MainThread] Message exchange failed.
2018-08-11 20:45:00,402 INFO [MainThread] Message exchange completed in 0.01s.
两者的
http://landscape.localhost/ping
curl -k https://landscape.localhost/message-system
工作,但是
curl https://landscape.localhost/message-system
没有,但如果我从 Landscape 服务器复制 ca 证书,那么
sudo curl https://landscape.localhost/message-system --cacert /etc/ssl/certs/landscape.localhost_ca.pem
作品
我已尝试将 client.conf 中的 ssl_public_key 指向 ca 证书和服务器证书,但似乎都没有用。
答案1
Curl 的错误 77 是CURLE_SSL_CACERT_BADFILE
,表明这是提供的 cacert 文件的问题。您的curl --cacert
命令确认该文件没有损坏或格式错误。
因此,这很可能是文件权限问题;也许它可以被所有者/组读取/写入,但不能被其他人读取/写入,因此当您sudo curl
以 root 身份读取时可以读取,但景观用户不能读取。
chmod o+r /etc/ssl/certs/landscape.localhost_ca.pem
应该修复它。
答案2
安装证书后,尝试使用以下命令重新启动客户端服务:
sudo /etc/init.d/landscape-client restart
我也遇到了和你描述的情况一模一样的情况。Curl 可以使用证书,复制的证书上的权限也正确,但仍然不起作用...记得重新启动(毕竟我已经更改了配置文件!),然后就好了!