diff --git a/common/flatpak-run.c b/common/flatpak-run.c
index d72f270a..54bc6591 100644
--- a/common/flatpak-run.c
+++ b/common/flatpak-run.c
@@ -72,6 +72,7 @@ typedef enum {
FLATPAK_CONTEXT_SOCKET_PULSEAUDIO = 1 << 2,
FLATPAK_CONTEXT_SOCKET_SESSION_BUS = 1 << 3,
FLATPAK_CONTEXT_SOCKET_SYSTEM_BUS = 1 << 4,
+ FLATPAK_CONTEXT_SOCKET_JOURNAL = 1 << 5,
} FlatpakContextSockets;
/* Same order as enum */
@@ -81,6 +82,7 @@ const char *flatpak_context_sockets[] = {
"pulseaudio",
"session-bus",
"system-bus",
+ "journal",
NULL
};
@@ -1531,6 +1533,27 @@ flatpak_run_add_pulseaudio_args (GPtrArray *argv_array,
}
}
+static void
+flatpak_run_add_journal_args (GPtrArray *argv_array,
+ char ***envp_p)
+{
+ const char *journal_socket_socket = g_strdup ("/run/systemd/journal/socket");
+ const char *journal_stdout_socket = g_strdup ("/run/systemd/journal/stdout");
+
+ if (g_file_test (journal_socket_socket, G_FILE_TEST_EXISTS))
+ {
+ add_args (argv_array,
+ "--bind", journal_socket_socket, journal_socket_socket,
+ NULL);
+ }
+ if (g_file_test (journal_stdout_socket, G_FILE_TEST_EXISTS))
+ {
+ add_args (argv_array,
+ "--bind", journal_stdout_socket, journal_stdout_socket,
+ NULL);
+ }
+}
+
static char *
create_proxy_socket (char *template)
{
@@ -1974,6 +1997,12 @@ flatpak_run_add_environment_args (GPtrArray *argv_array,
flatpak_run_add_pulseaudio_args (argv_array, fd_array, envp_p);
}
+ if (context->sockets & FLATPAK_CONTEXT_SOCKET_JOURNAL)
+ {
+ g_debug ("Allowing journal access");
+ flatpak_run_add_journal_args (argv_array, envp_p);
+ }
+
unrestricted_session_bus = (context->sockets & FLATPAK_CONTEXT_SOCKET_SESSION_BUS) != 0;
if (unrestricted_session_bus)
g_debug ("Allowing session-dbus access");
diff --git a/doc/flatpak-build-finish.xml b/doc/flatpak-build-finish.xml
index 5db1bed5..980cd2c2 100644
--- a/doc/flatpak-build-finish.xml
+++ b/doc/flatpak-build-finish.xml
@@ -114,7 +114,7 @@
Expose a well known socket to the application. This updates
the [Context] group in the metadata.
- SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+ SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus, journal.
This option can be used multiple times.
@@ -125,7 +125,7 @@
Don't expose a well known socket to the application. This updates
the [Context] group in the metadata.
- SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+ SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus, journal.
This option can be used multiple times.
diff --git a/doc/flatpak-build.xml b/doc/flatpak-build.xml
index a802753c..f2cdc6fe 100644
--- a/doc/flatpak-build.xml
+++ b/doc/flatpak-build.xml
@@ -139,7 +139,7 @@
Expose a well-known socket to the application. This overrides to
the Context section from the application metadata.
- SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+ SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus, journal.
This option can be used multiple times.
@@ -150,7 +150,7 @@
Don't expose a well-known socket to the application. This overrides to
the Context section from the application metadata.
- SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+ SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus, journal.
This option can be used multiple times.
diff --git a/doc/flatpak-override.xml b/doc/flatpak-override.xml
index 5946f332..11108470 100644
--- a/doc/flatpak-override.xml
+++ b/doc/flatpak-override.xml
@@ -95,7 +95,7 @@
Expose a well-known socket to the application. This overrides to
the Context section from the application metadata.
- SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+ SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus, journal.
This option can be used multiple times.
@@ -106,7 +106,7 @@
Don't expose a well-known socket to the application. This overrides to
the Context section from the application metadata.
- SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+ SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus, journal.
This option can be used multiple times.
diff --git a/doc/flatpak-run.xml b/doc/flatpak-run.xml
index dc9d52ab..fcd1a536 100644
--- a/doc/flatpak-run.xml
+++ b/doc/flatpak-run.xml
@@ -173,7 +173,7 @@
Expose a well known socket to the application. This overrides to
the Context section from the application metadata.
- SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+ SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus, journal.
This option can be used multiple times.
@@ -184,7 +184,7 @@
Don't expose a well known socket to the application. This overrides to
the Context section from the application metadata.
- SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus.
+ SOCKET must be one of: x11, wayland, pulseaudio, system-bus, session-bus, journal.
This option can be used multiple times.