Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running vault v1.14.1 without DBUS_SESSION_BUS_ADDRESS set and no /run/user/<uid>/bus launches a persistent dbus-daemon #22560

Closed
brinnjoyce opened this issue Aug 25, 2023 · 14 comments
Labels
core/dev core Issues and Pull-Requests specific to Vault Core

Comments

@brinnjoyce
Copy link

brinnjoyce commented Aug 25, 2023

Describe the bug
Running vault as a user without DBUS_SESSION_BUS_ADDRESS set and no /run/user/<uid>/bus file causes vault to run dbus-launch which launches a persistent dbus-daemon process like this:
/usr/bin/dbus-daemon --syslog --fork --print-pid 4 --print-address 6 --session.

A new dbus-daemon will be launched every time vault is run.

The dbus-daemon processes use inotify instances, so if vault is executed enough times (configuration management in our instance) the user running vault will run into the fs.inotify.max_user_instances limit or fd limits causing issues for systemd etc.

To Reproduce
Steps to reproduce the behavior:

  1. Run vault --version with no DBUS_SESSION_BUS_ADDRESS set and no /run/user/<uid>/bus file
  2. See that there is now a new dbus-daemon process running as the user that ran vault.

Expected behavior
There should be no extra processes left running.

Environment:

  • Vault CLI Version (retrieve with vault version): v1.14.1
  • Server Operating System/Architecture: Ubuntu 18.04/22.04 amd64

Additional context

This is related to the godbus/dbus issue raised here godbus/dbus#372
Testing this as a workaround does avoid the issue:

env DBUS_SESSION_BUS_ADDRESS=$XDG_RUNTIME_DIR/bus vault --version
@brinnjoyce brinnjoyce changed the title Running vault v1.14.1 as root launches a forked dbus-daemon Running vault v1.14.1 without DBUS_SESSION_BUS_ADDRESS set and no /run/user/<uid>/bus launches a persistent dbus-daemon Aug 25, 2023
@biazmoreira biazmoreira added core Issues and Pull-Requests specific to Vault Core core/dev labels Aug 29, 2023
@biazmoreira
Copy link
Contributor

This is related to the snowflake bug, which I re-opened here snowflakedb/gosnowflake#901

We'll try to work this around with snowflake before trying to fix it directly in Vault.

@danielhass
Copy link

Thanks @vegaman for reporting this and providing a workaround.

We ran into this issue too with v1.14.1 and setting the env variable DBUS_SESSION_BUS_ADDRESS=$XDG_RUNTIME_DIR/bus seems to be a proper workaround so far.

@jkhuang-42
Copy link

Running into this issue on vault version v1.14.3-ent but the workaround did not seem to have any effect, new dbus daemons still seem to be generated each time vault is called.

To be clear, is the workaround just export DBUS_SESSION_BUS_ADDRESS=$XDG_RUNTIME_DIR/bus ?

Also in my environment, XDG_RUNTIME_DIR does not have a value, is that an issue?

@Soromeister
Copy link
Contributor

@jkhuang-42, please see this KB article on how to solve this in the meantime. The article also covers the situation with no XDG_RUNTIME_DIR value.

@aswen
Copy link

aswen commented Jun 13, 2024

I run into this on 2 of the 3 servers that run vault 1.17.0-1 (Debian Bookworm).

It's easy to reproduce:

$ vault --version
WARN[0000]log.go:244 gosnowflake.(*defaultLogger).Warn DBUS_SESSION_BUS_ADDRESS envvar looks to be not set, this can lead to runaway dbus-daemon processes. To avoid this, set envvar DBUS_SESSION_BUS_ADDRESS=$XDG_RUNTIME_DIR/bus (if it exists) or DBUS_SESSION_BUS_ADDRESS=/dev/null. 
Vault v1.17.0 (72850df1bc10581b74ba5f0f7b3736f31c034235), built 2024-06-10T10:11:34Z

and to work around (as mentioned in the opening comment):

$ env DBUS_SESSION_BUS_ADDRESS=$XDG_RUNTIME_DIR/bus vault --version
Vault v1.17.0 (72850df1bc10581b74ba5f0f7b3736f31c034235), built 2024-06-10T10:11:34Z

Without doing anything, Vault runs ok (by the looks of it) on all three servers.

I have a few questions:

  1. What is the risk of running Vault without fixing this? I see no issues on the two vault servers that warn.
  2. Is there anything we should do to fix this permanently?
  3. I see this issue was closed 9 months ago. Did we miss something that fixes this? Should we change something on our servers?
  4. I don't understand that on one of our servers this problem is not manifesting. Even though we don't have DBUS_SESSION_BUS_ADDRESS set on that one.

Thanks for the clarification.

@PJ1288
Copy link

PJ1288 commented Jun 13, 2024

I am running into the same issue as @aswen when upgrading to v1.17.0.
level=warning msg="DBUS_SESSION_BUS_ADDRESS envvar looks to be not set, this can lead to runaway dbus-daemon processe>

@yaboeing
Copy link

We've just upgraded and have the same on

vault --version
WARN[0000]log.go:244 gosnowflake.(*defaultLogger).Warn DBUS_SESSION_BUS_ADDRESS envvar looks to be not set, this can lead to runaway dbus-daemon processes. To avoid this, set envvar DBUS_SESSION_BUS_ADDRESS=$XDG_RUNTIME_DIR/bus (if it exists) or DBUS_SESSION_BUS_ADDRESS=/dev/null.
Vault v1.17.0 (72850df1bc10581b74ba5f0f7b3736f31c034235), built 2024-06-10T10:11:34Z

@MMquant
Copy link

MMquant commented Jul 9, 2024

Just installed vault on RHEL8

$ vault -version
WARN[0000]log.go:244 gosnowflake.(*defaultLogger).Warn DBUS_SESSION_BUS_ADDRESS envvar looks to be not set, this can lead to runaway dbus-daemon processes. To avoid this, set envvar DBUS_SESSION_BUS_ADDRESS=$XDG_RUNTIME_DIR/bus (if it exists) or DBUS_SESSION_BUS_ADDRESS=/dev/null. 
Vault v1.17.1 (b8ab595639e7473eb153571521bbaf522cdafb27), built 2024-06-25T16:33:25Z

@sfc-gh-dszmolka
Copy link

sfc-gh-dszmolka commented Jul 17, 2024

hi folks, this warning is coming from gosnowflake and tries to detect the dbus-daemon leak which can happen due to the situation described in the Issue description and can lead to real issues, again as described by the original poster.
gosnowflake does absolutely nothing else besides logging that single line.

related issues:

if you found false positives (where the warning is emitted, but there are no actual orphaned dbus-daemon processes generated), we're happy to investigate and fix it if one of you could please raise an issue in gosnowflake with the details if that would be possible. thank you in advance!

@thedoc31
Copy link

When will the gosnowflake v1.11.0 with the fix for this warning message be added into the vault executables?

@juparker37
Copy link

juparker37 commented Aug 28, 2024

Edit: Nevermind I see it when using "sudo vault" cli.

sudo vault --help

WARN[0000]log.go:244 gosnowflake.(*defaultLogger).Warn DBUS_SESSION_BUS_ADDRESS envvar looks to be not set, this can lead to runaway dbus-daemon processes. To avoid this, set envvar DBUS_SESSION_BUS_ADDRESS=$XDG_RUNTIME_DIR/bus (if it exists) or DBUS_SESSION_BUS_ADDRESS=/dev/null.
Usage: vault <command> [args]

Common commands:
    read        Read data and retrieves secrets
    write       Write data, configuration, and secrets
    delete      Delete secrets and configuration
    list        List data or secrets
    login       Authenticate locally
    agent       Start a Vault agent
    server      Start a Vault server
    status      Print seal and HA status
    unwrap      Unwrap a wrapped secret

cat /etc/os-release NAME="Red Hat Enterprise Linux" VERSION="8.10 (Ootpa)" ID="rhel" ID_LIKE="fedora" VERSION_ID="8.10" PLATFORM_ID="platform:el8" PRETTY_NAME="Red Hat Enterprise Linux 8.10 (Ootpa)"

sudo yum -y install vault

Updating Subscription Management repositories.
Hashicorp Stable - x86_64                                                      6.9 MB/s | 1.4 MB     00:00
Dependencies resolved.
===============================================================================================================
 Package                 Architecture             Version                    Repository                   Size
===============================================================================================================
Installing:
 vault                   x86_64                   1.17.3-1                   hashicorp                   149 M

Transaction Summary
===============================================================================================================
Install  1 Package

Total download size: 149 M
Installed size: 420 M
Downloading Packages:
vault-1.17.3-1.x86_64.rpm                                                       73 MB/s | 149 MB     00:02
---------------------------------------------------------------------------------------------------------------
Total                                                                           73 MB/s | 149 MB     00:02
Hashicorp Stable - x86_64                                                       61 kB/s | 3.9 kB     00:00
Importing GPG key 0xA621E701:
 Userid     : "HashiCorp Security (HashiCorp Package Signing) <[email protected]>"
 Fingerprint: 798A EC65 4E5C 1542 8C8E 42EE AA16 FCBC A621 E701
 From       : https://rpm.releases.hashicorp.com/gpg
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                       1/1
  Running scriptlet: vault-1.17.3-1.x86_64                                                                 1/1
  Installing       : vault-1.17.3-1.x86_64                                                                 1/1
  Running scriptlet: vault-1.17.3-1.x86_64                                                                 1/1
Generating Vault TLS key and self-signed certificate...
Generating a RSA private key
................................................................................................................................................................++++
...............................................................................................++++
writing new private key to 'tls.key'
-----
Vault TLS key and self-signed certificate have been generated in '/opt/vault/tls'.
time="2024-08-27T20:32:54-04:00" level=warning msg="DBUS_SESSION_BUS_ADDRESS envvar looks to be not set, this can lead to runaway dbus-daemon processes. To avoid this, set envvar DBUS_SESSION_BUS_ADDRESS=$XDG_RUNTIME_DIR/bus (if it exists) or DBUS_SESSION_BUS_ADDRESS=/dev/null." func="gosnowflake.(*defaultLogger).Warn" file="log.go:244"

  Verifying        : vault-1.17.3-1.x86_64                                                                 1/1
Installed products updated.

Installed:
  vault-1.17.3-1.x86_64

Complete!
vault --version
Vault v1.17.3 (c91c85442144e1228c02123fc4b19337f7d52700), built 2024-08-06T14:28:45Z

@fen9li
Copy link

fen9li commented Sep 1, 2024

Hey I still get same error even after upgrade to v1.17.3...

[xxxxxx@xxxxxx ~]$ vault -version
WARN[0000]log.go:244 gosnowflake.(*defaultLogger).Warn DBUS_SESSION_BUS_ADDRESS envvar looks to be not set, this can lead to runaway dbus-daemon processes. To avoid this, set envvar DBUS_SESSION_BUS_ADDRESS=$XDG_RUNTIME_DIR/bus (if it exists) or DBUS_SESSION_BUS_ADDRESS=/dev/null.
Vault v1.17.3 (c91c85442144e1228c02123fc4b19337f7d52700), built 2024-08-06T14:28:45Z
[xxxxxx@xxxxxx ~]$

Work around works:

[psplatforms@ip-10-244-145-54 ~]$ export DBUS_SESSION_BUS_ADDRESS=$XDG_RUNTIME_DIR/bus
[psplatforms@ip-10-244-145-54 ~]$ vault --versionVault v1.17.3 (c91c85442144e1228c02123fc4b19337f7d52700), built 2024-08-06T14:28:45Z[psplatforms@ip-10-244-145-54 ~]$

But still want to know how to fix this issue. Thank you.

@biazmoreira
Copy link
Contributor

The dependency was updated yesterday and will probably make it to the next release.

@joelofftsuny
Copy link

The dependency was updated yesterday and will probably make it to the next release.

What version number will include this fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core/dev core Issues and Pull-Requests specific to Vault Core
Projects
None yet
Development

No branches or pull requests