mirror of
https://github.com/flatpak/flatpak.git
synced 2026-05-14 11:34:34 -04:00
Add --socket=gpg-agent
This commit is contained in:
committed by
Alexander Larsson
parent
061102df30
commit
764e5a4d0c
@@ -49,6 +49,7 @@ typedef enum {
|
|||||||
FLATPAK_CONTEXT_SOCKET_SSH_AUTH = 1 << 6,
|
FLATPAK_CONTEXT_SOCKET_SSH_AUTH = 1 << 6,
|
||||||
FLATPAK_CONTEXT_SOCKET_PCSC = 1 << 7,
|
FLATPAK_CONTEXT_SOCKET_PCSC = 1 << 7,
|
||||||
FLATPAK_CONTEXT_SOCKET_CUPS = 1 << 8,
|
FLATPAK_CONTEXT_SOCKET_CUPS = 1 << 8,
|
||||||
|
FLATPAK_CONTEXT_SOCKET_GPG_AGENT = 1 << 9,
|
||||||
} FlatpakContextSockets;
|
} FlatpakContextSockets;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ const char *flatpak_context_sockets[] = {
|
|||||||
"ssh-auth",
|
"ssh-auth",
|
||||||
"pcsc",
|
"pcsc",
|
||||||
"cups",
|
"cups",
|
||||||
|
"gpg-agent",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -601,6 +601,46 @@ flatpak_run_add_cups_args (FlatpakBwrap *bwrap)
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
flatpak_run_add_gpg_agent_args (FlatpakBwrap *bwrap)
|
||||||
|
{
|
||||||
|
const char * agent_socket;
|
||||||
|
g_autofree char * sandbox_agent_socket = NULL;
|
||||||
|
g_autoptr(GError) gpgconf_error = NULL;
|
||||||
|
g_autoptr(GSubprocess) process = NULL;
|
||||||
|
g_autoptr(GInputStream) base_stream = NULL;
|
||||||
|
g_autoptr(GDataInputStream) data_stream = NULL;
|
||||||
|
|
||||||
|
process = g_subprocess_new (G_SUBPROCESS_FLAGS_STDOUT_PIPE,
|
||||||
|
&gpgconf_error,
|
||||||
|
"gpgconf", "--list-dir", "agent-socket", NULL);
|
||||||
|
|
||||||
|
if (gpgconf_error)
|
||||||
|
{
|
||||||
|
g_debug ("GPG-Agent directories: %s", gpgconf_error->message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
base_stream = g_subprocess_get_stdout_pipe (process);
|
||||||
|
data_stream = g_data_input_stream_new (base_stream);
|
||||||
|
|
||||||
|
agent_socket = g_data_input_stream_read_line (data_stream,
|
||||||
|
NULL, NULL,
|
||||||
|
&gpgconf_error);
|
||||||
|
|
||||||
|
if (!agent_socket || gpgconf_error)
|
||||||
|
{
|
||||||
|
g_debug ("GPG-Agent directories: %s", gpgconf_error->message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sandbox_agent_socket = g_strdup_printf ("/run/user/%d/gnupg/S.gpg-agent", getuid ());
|
||||||
|
|
||||||
|
flatpak_bwrap_add_args (bwrap,
|
||||||
|
"--ro-bind-try", agent_socket, sandbox_agent_socket,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/* Try to find a default server from a pulseaudio confguration file */
|
/* Try to find a default server from a pulseaudio confguration file */
|
||||||
static char *
|
static char *
|
||||||
flatpak_run_get_pulseaudio_server_user_config (const char *path)
|
flatpak_run_get_pulseaudio_server_user_config (const char *path)
|
||||||
@@ -1783,6 +1823,11 @@ flatpak_run_add_environment_args (FlatpakBwrap *bwrap,
|
|||||||
flatpak_run_add_cups_args (bwrap);
|
flatpak_run_add_cups_args (bwrap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (context->sockets & FLATPAK_CONTEXT_SOCKET_GPG_AGENT)
|
||||||
|
{
|
||||||
|
flatpak_run_add_gpg_agent_args (bwrap);
|
||||||
|
}
|
||||||
|
|
||||||
flatpak_run_add_session_dbus_args (bwrap, proxy_arg_bwrap, context, flags, app_id);
|
flatpak_run_add_session_dbus_args (bwrap, proxy_arg_bwrap, context, flags, app_id);
|
||||||
flatpak_run_add_system_dbus_args (bwrap, proxy_arg_bwrap, context, flags);
|
flatpak_run_add_system_dbus_args (bwrap, proxy_arg_bwrap, context, flags);
|
||||||
flatpak_run_add_a11y_dbus_args (bwrap, proxy_arg_bwrap, context, flags);
|
flatpak_run_add_a11y_dbus_args (bwrap, proxy_arg_bwrap, context, flags);
|
||||||
|
|||||||
@@ -134,7 +134,7 @@
|
|||||||
Expose a well-known socket to the application. This updates
|
Expose a well-known socket to the application. This updates
|
||||||
the [Context] group in the metadata.
|
the [Context] group in the metadata.
|
||||||
SOCKET must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
SOCKET must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
||||||
ssh-auth, pcsc, cups.
|
ssh-auth, pcsc, cups, gpg-agent.
|
||||||
This option can be used multiple times.
|
This option can be used multiple times.
|
||||||
</para><para>
|
</para><para>
|
||||||
The fallback-x11 option makes the X11 socket available only if
|
The fallback-x11 option makes the X11 socket available only if
|
||||||
@@ -151,7 +151,7 @@
|
|||||||
Don't expose a well known socket to the application. This updates
|
Don't expose a well known socket to the application. This updates
|
||||||
the [Context] group in the metadata.
|
the [Context] group in the metadata.
|
||||||
SOCKET must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
SOCKET must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
||||||
ssh-auth, pcsc, cups.
|
ssh-auth, pcsc, cups, gpg-agent.
|
||||||
This option can be used multiple times.
|
This option can be used multiple times.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|||||||
@@ -149,7 +149,7 @@
|
|||||||
Expose a well-known socket to the application. This overrides to
|
Expose a well-known socket to the application. This overrides to
|
||||||
the Context section from the application metadata.
|
the Context section from the application metadata.
|
||||||
<arg choice="plain">SOCKET</arg> must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
<arg choice="plain">SOCKET</arg> must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
||||||
ssh-auth, pcsc, cups.
|
ssh-auth, pcsc, cups, gpg-agent.
|
||||||
This option can be used multiple times.
|
This option can be used multiple times.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -161,7 +161,7 @@
|
|||||||
Don't expose a well-known socket to the application. This overrides to
|
Don't expose a well-known socket to the application. This overrides to
|
||||||
the Context section from the application metadata.
|
the Context section from the application metadata.
|
||||||
<arg choice="plain">SOCKET</arg> must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
<arg choice="plain">SOCKET</arg> must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
||||||
ssh-auth, pcsc, cups.
|
ssh-auth, pcsc, cups, gpg-agent.
|
||||||
This option can be used multiple times.
|
This option can be used multiple times.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|||||||
@@ -134,7 +134,7 @@
|
|||||||
Expose a well-known socket to the application. This overrides to
|
Expose a well-known socket to the application. This overrides to
|
||||||
the Context section from the application metadata.
|
the Context section from the application metadata.
|
||||||
<arg choice="plain">SOCKET</arg> must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
<arg choice="plain">SOCKET</arg> must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
||||||
ssh-auth, pcsc, cups.
|
ssh-auth, pcsc, cups, gpg-agent.
|
||||||
This option can be used multiple times.
|
This option can be used multiple times.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -146,7 +146,7 @@
|
|||||||
Don't expose a well-known socket to the application. This overrides to
|
Don't expose a well-known socket to the application. This overrides to
|
||||||
the Context section from the application metadata.
|
the Context section from the application metadata.
|
||||||
<arg choice="plain">SOCKET</arg> must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
<arg choice="plain">SOCKET</arg> must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
||||||
ssh-auth, pcsc, cups.
|
ssh-auth, pcsc, cups, gpg-agent.
|
||||||
This option can be used multiple times.
|
This option can be used multiple times.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|||||||
@@ -299,7 +299,7 @@
|
|||||||
Expose a well known socket to the application. This overrides to
|
Expose a well known socket to the application. This overrides to
|
||||||
the Context section from the application metadata.
|
the Context section from the application metadata.
|
||||||
<arg choice="plain">SOCKET</arg> must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
<arg choice="plain">SOCKET</arg> must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
||||||
ssh-auth, pcsc, cups.
|
ssh-auth, pcsc, cups, gpg-agent.
|
||||||
This option can be used multiple times.
|
This option can be used multiple times.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@@ -311,7 +311,7 @@
|
|||||||
Don't expose a well known socket to the application. This overrides to
|
Don't expose a well known socket to the application. This overrides to
|
||||||
the Context section from the application metadata.
|
the Context section from the application metadata.
|
||||||
<arg choice="plain">SOCKET</arg> must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
<arg choice="plain">SOCKET</arg> must be one of: x11, wayland, fallback-x11, pulseaudio, system-bus, session-bus,
|
||||||
ssh-auth, pcsc, cups.
|
ssh-auth, pcsc, cups, gpg-agent.
|
||||||
This option can be used multiple times.
|
This option can be used multiple times.
|
||||||
</para></listitem>
|
</para></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|||||||
Reference in New Issue
Block a user