无法使用我自己的 mosquitto 配置文件“无法打开”

无法使用我自己的 mosquitto 配置文件“无法打开”

无法将我自己的配置文件与 mosquitto 一起使用,传递默认配置文件可以正常工作:

localhost:/etc/mosquitto # sudo mosquitto -c /etc/mosquitto/mosquitto.conf 
1706606342: mosquitto version 2.0.15 starting
1706606342: Config loaded from /etc/mosquitto/mosquitto.conf.
1706606342: Starting in local only mode. Connections will only be possible from clients running on this machine.
1706606342: Create a configuration file which defines a listener to allow remote access.
1706606342: For more details see https://mosquitto.org/documentation/authentication-methods/
1706606342: Opening ipv4 listen socket on port 1883.
1706606342: Opening ipv6 listen socket on port 1883.
1706606342: mosquitto version 2.0.15 running
^C1706606343: mosquitto version 2.0.15 terminating

然后,当我尝试使用我自己的配置文件时myconf.conf

localhost:/etc/mosquitto # sudo mosquitto -c /etc/mosquitto/myconf.conf 
1706606346: Error: Unable to open config file /etc/mosquitto/myconf.conf.

即使这些文件完全相同,所有权限都匹配,它也是文字复制。

localhost:/etc/mosquitto # ll
total 92
-rw-r----- 1 root mosquitto   230 16 aug  2022 aclfile.example
drwxr-xr-x 1 root mosquitto    12 25 okt 09:41 ca_certificates
drwxr-xr-x 1 root mosquitto    12 25 okt 09:41 certs
drwxr-xr-x 1 root mosquitto    12 25 okt 09:41 conf.d
-rw-r----- 1 root mosquitto 40470 12 aug 17:43 mosquitto.conf
-rw-r----- 1 root mosquitto 40470 30 jan 10:17 myconf.conf
-rw-r----- 1 root mosquitto    23 16 aug  2022 pskfile.example
-rw-r----- 1 root mosquitto   355 16 aug  2022 pwfile.example

操作系统是 opensuse TW,通过包管理器安装了 mosquitto:

i+ | mosquitto-devel             | Development files for mosquitto                 | package
i+ | mosquitto                   | A MQTT v3.1/v3.1.1 Broker                       | package
i  | libmosquittopp1             | Shared C++ Library for mosquitto                | package
i  | libmosquitto1               | Shared C Library for mosquitto                  | package

Strace 显示权限被拒绝:

openat(AT_FDCWD, "/etc/mosquitto/myconf.conf", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = -1 ENOTDIR (Not a directory)
newfstatat(AT_FDCWD, "/etc/mosquitto/myconf.conf", {st_mode=S_IFREG|0640, st_size=40470, ...}, 0) = 0
openat(AT_FDCWD, "/etc/mosquitto/myconf.conf", O_RDONLY) = -1 EACCES (Permission denied)

编辑1:似乎没有启用 SELinux,我没有Permissive在配置文件中看到设置。

我怎样才能让 mosquitto 使用我自己的配置文件?

相关内容