diff options
| author | Ophestra Umiker <cat@ophivana.moe> | 2024-10-09 20:41:42 +0900 |
|---|---|---|
| committer | Ophestra Umiker <cat@ophivana.moe> | 2024-10-09 20:41:42 +0900 |
| commit | 753c5191b13b75a8395a083299b553dbb7d99cbe (patch) | |
| tree | 4316235946aa152a9a06ddd9a109f32830bd9d2e /internal | |
| parent | 6232291caebc2dc1365cdb422ed16c09c06b3f28 (diff) | |
dbus/run: support running xdg-dbus-proxy in a restrictive bubblewrap sandbox
Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/app/share.dbus.go | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/internal/app/share.dbus.go b/internal/app/share.dbus.go index d26534a1..468a8afa 100644 --- a/internal/app/share.dbus.go +++ b/internal/app/share.dbus.go @@ -48,21 +48,8 @@ func (seal *appSeal) shareDBus(config [2]*dbus.Config) error { sessionBus[1] = path.Join(seal.share, "bus") systemBus[1] = path.Join(seal.share, "system_bus_socket") - // resolve upstream session bus address - if addr, ok := os.LookupEnv(dbusSessionBusAddress); !ok { - // fall back to default format - sessionBus[0] = fmt.Sprintf("unix:path=/run/user/%d/bus", os.Getuid()) - } else { - sessionBus[0] = addr - } - - // resolve upstream system bus address - if addr, ok := os.LookupEnv(dbusSystemBusAddress); !ok { - // fall back to default hardcoded value - systemBus[0] = "unix:path=/run/dbus/system_bus_socket" - } else { - systemBus[0] = addr - } + // resolve upstream bus addresses + sessionBus[0], systemBus[0] = dbus.Address() // create proxy instance seal.sys.dbus = dbus.New(sessionBus, systemBus) @@ -93,15 +80,17 @@ func (tx *appSealTx) startDBus() error { tx.dbusWait = make(chan struct{}) // background dbus proxy start - if err := tx.dbus.Start(ready, os.Stderr); err != nil { + if err := tx.dbus.Start(ready, os.Stderr, true); err != nil { return (*StartDBusError)(wrapError(err, "cannot start message bus proxy:", err)) } verbose.Println("starting message bus proxy:", tx.dbus) + verbose.Println("message bus proxy bwrap args:", tx.dbus.Bwrap()) // background wait for proxy instance and notify completion go func() { if err := tx.dbus.Wait(); err != nil { fmt.Println("fortify: warn: message bus proxy returned error:", err) + go func() { ready <- err }() } else { verbose.Println("message bus proxy exit") } |
