Open joe-at-startupmedia opened 3 months ago
Possibly related to this commit which is not available until godbus 5.0.6. This library is currently using 5.0.5: https://github.com/godbus/dbus/pull/247/commits/7ba66a7d9a5a285a3cb07c30efc02f04d724c222
Because This isuue is about firewalld use dbus remotely connect firewalld dbus interface error #851 .
if i want use tcp remote connect over dbus procotol, but, the program can't get uid, this issue for usual facing over remote connect, the firewalld group said "This is not something we can reasonably support", so my remove the firewalld pokit kit and write this tutorial.
if i write a firewalld-agent, can resovle this issue, because on local Linux, program can get uid, but this solution need IT manager deploy many of agent on many Linux sever, that dificute, so i remove the pokit kit in firewalld code, and just provide a rpm/deb package to IT manager, IT manager just install, This does not require complicated operations, because each of our Linux has the dbus port enabled by default.
please refer install manual Setup firewalld section, you need without policy kit, my provide two version for debian 11 and centos 7, if you want other Linux OS pls refer without policy kit tutorial
About the redhat like, i just use until centos 7, the debian11 and detian 12 still using dbus-daemon. Rocky9 i will download and install to try you issue.
Thank you for you advise, I will try this new featrue.
Interesting.
Just to clarify, this isn't exclusive to remote connections, adjusting the following parameters to use the loopback 127.0.0.1 results in the same error:
/usr/share/dbus-1/system.d/Uranus.conf
<listen>tcp:host=localhost,bind=127.0.0.1,port=55556,family=ipv4</listen>
firewalld-gateway.toml
appname = "Uranus"
port = 2952
address = "127.0.0.1" # <-- use loopback
dbus_port = 55556
mission_retry_number = 3
async_process = true
database_driver = "sqlite"
I0826 01:01:58.231151 2424 structure.go:38] Start connect to D-Bus service: 127.0.0.1:55556
E0826 01:01:58.278588 2424 structure.go:73] Connect to firewalld service failed: GDBus.Error:org.freedesktop.DBus.Error.Failed: Could not determine UID for ':1.18'
At this point Rocky9 is using firewalld version 1.3.4. Modifying both the firewalld and firewall-cmd packages are possible but frankly not worth the configuration overhead nor the security risks. Just to be clear this is what is required (so far) to get this package working on the latest RHEL-based distros:
Honestly this is way too much work and introduces more security vulnerabilities than it's worth. At this point for the adoptability or this project I would highly recommend:
@joe-at-startupmedia Uranus-agent not final choice, although this approach is simpler than now architecture, if use agent, I have more choices and no need for firewalld. but that code is more than firewalld, because firewalld can suitable run on iptables and nftables. I will adapt as soon as possible rocky9 like.
Getting DBUS working on a tcp socket
This library establishes a connection to dbus over tcp. The problem is getting dbus to work with tcp on my Rocky Linux distro (rhel -based)
The first issue is this distro no longer uses dbus-daemon but dbus-broker-launch
As such, following this method to open TCP doesn't work. https://stackoverflow.com/questions/61327052/linux-dbus-remote-tcp-connection-with-systemd-fails
Modify /usr/lib/systemd/system/dbus.socket
Adding that results in the following error: Error: dbus-broker-launch[2476921]: More than one listener socket passed
dbus-broker doesn't like multiple listen streams specified in dbus.socket so we use dbus-daemon instead. This is what Centos 7 (rocky linux predecessor) is using.
Create a new system file at: /usr/lib/systemd/system/dbus.service
Create the uranus busconfig
This is included by the system.conf file
To resolve this, I use dbus-daemon instead:
Note: Make sure you have password access to your machine in case dbus crashes on reboot.
Confirm that DBUS is listening on TCP
Finally, now we have dbus listening on tcp
Next,
Establishing connection to Uranus
Error when attempting to create a host on the localst machine:
https://uranus.com/fw/v1/dashboard?ip=0.0.0.0
Disable SELinux (not Permissive or Enabled) and reboot is the only solution I've found to suppress this error.
After rebooting the machine and attempting to list the host:
Adding this line to the firewalld buspolicy resolves this error
Now restart dbus and attempt to list the policies again in the Uranus UI gives a new error:
Subsequent requests will result in the same error with an incremented UID