我在 Debian Jessie 上安装了 Bareos 17.2.4-9。它是使用 switch 从源代码构建的--with-openssl
。
它无需启用 TLS 即可完美运行,但是当我尝试将其配置为使用 TLS 时,我得到了...
# bconsole
Connecting to Director Server-Name:9101
Authorization problem with Director at "Server-Name:9101"
Most likely the passwords do not agree.
If you are using TLS, there may have been a certificate validation error during the TLS handshake.
Please see http://doc.bareos.org/master/html/bareos-manual-main-reference.html#AuthorizationErrors for help.
我怀疑这是因为自签名证书和服务器名称之间存在验证问题。服务器域名未设置。
我创建了证书如下...
# hostname
Server-Name
# domainname
(none)
# openssl req -new -x509 -nodes -out Server-Name.pem -keyout Server-Name.pem -days 3650
# chmod 600 Server-Name.pem
Generating a 2048 bit RSA private key
..+++
............................+++
writing new private key to 'Server-Name.pem'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:DE
State or Province Name (full name) [Some-State]:NI
Locality Name (eg, city) []:Leer
Organization Name (eg, company) [Internet Widgits Pty Ltd]:GNM
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:Server-Name
Email Address []:[email protected]
配置文件是...
/etc/bareos/bareos-dir.d/director/bareos-dir.conf
Director { # define myself
Name = bareos-dir
QueryFile = "/usr/lib/bareos/scripts/query.sql"
Maximum Concurrent Jobs = 10
Password = "secret" # Console password
Messages = Daemon
Auditing = yes
DirAddress = Server-Name
TLS Enable = yes
TLS Require = yes
TLS CA Certificate File = /etc/bareos/TLS/Bareos-Server-Name.pem
TLS Certificate = /etc/bareos/TLS/Bareos-Server-Name.pem
TLS Key = /etc/bareos/TLS/Bareos-Server-Name.pem
# TLS Verify Peer = yes
TLS Allowed CN = Server-Name
}
/etc/bareos/bconsole.conf
Director {
Name = bareos-dir
# address = localhost
address = Server-Name
Password = "secret"
Description = "Bareos Console credentials for local Director"
}
答案1
注意:从 Bareos 18.2 版开始,TLS已启用默认情况下,但服务器向后兼容旧客户端。
请尝试以下方法:
将服务器上的客户端地址(在 中
bareos-dir.d/client/*.conf
)从名称更改为 IP。如果成功,则表示您的 DNS 查找失败,并且 BareOS 无法验证它是否与正确的机器通信。如果您有多个接口,请将以下内容添加到
client/myself.conf
(或您的客户端配置存储在文件守护进程中的任何位置):
FD Address = IP-Address
FD Source Address = IP-Address
这决定了要使用的传出接口并减少了路由错误(在云主机上很有用)。请参阅这里了解有关这些内容的更多信息。
- 如果你使用的是不常见或自定义的操作系统,则可能必须提供TLS 证书或者TLS CA 证书目录, 也。 TLS 验证对端也将有助于确定同行验证是否失败。
调试 - 验证 SSL 连接
从每一端(备份服务器到客户端以及客户端到备份服务器),尝试:
openssl s_client -connect [client-fqdn]:9102 -state -nbio
和
openssl s_client -connect [client-ip]:9102 -state -nbio
奖励答案
每一个连接现在已启用 TLS,因此 TLS Auth 失败不一定发生在 Director(服务器)和 FileDaemon(客户端)之间。 任何然而,TLS 故障被(错误地)报告为这样。因此,错误如下:
Fatal error: Connect failure: ERR=error:140943FC:SSL routines:ssl3_read_bytes:sslv3 alert bad record mac
Error: TLS shutdown failure.: ERR=error:140E0197:SSL routines:SSL_shutdown:shutdown while in init
Fatal error: TLS negotiation failed
...例如,可能是 Director 和 StorageDaemon 之间的 TLS Auth 失败。
检查每个链接!
答案2
尝试从 bareos-dir.conf 中的密码中删除引号并重新启动。