1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-10 13:04:23 +01:00

Stronger deprecate the --supervised option.

* agent/gpg-agent.c (opts): Rename option supervised.
* dirmngr/dirmngr.c (opts): Ditto.
--

The --supervised way to start gpg-agent has been deprecated for 2.5
years and will probably entirely removed with version 2.6.0.  To allow
its use until its removal the systemd service description need to be
adjusted to use this option.  The reason for the deprecation are
conflicts with the way systemd starts gpg-agent and gpg expects how
gpg-agent is started.  In particular gpg expects that the gpg-agent
matching its own version is started.  Further the systemd way is not
portable to other platforms and long term experience on Windows has
show that the standard way of starting gpg-agent is less error prone.

Note to those who want to re-introduse this option: Pretty please do
not use socket names conflicting with our standard socket names.  For
example use /run/user/1000/foo-gnupg/S.gpg-agent.
This commit is contained in:
Werner Koch 2025-01-08 17:10:07 +01:00
parent faa2d3a2e7
commit a019a0fcd8
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
4 changed files with 21 additions and 20 deletions

View File

@ -169,7 +169,7 @@ static gpgrt_opt_t opts[] = {
ARGPARSE_s_n (oDaemon, "daemon", N_("run in daemon mode (background)")), ARGPARSE_s_n (oDaemon, "daemon", N_("run in daemon mode (background)")),
ARGPARSE_s_n (oServer, "server", N_("run in server mode (foreground)")), ARGPARSE_s_n (oServer, "server", N_("run in server mode (foreground)")),
#ifndef HAVE_W32_SYSTEM #ifndef HAVE_W32_SYSTEM
ARGPARSE_s_n (oSupervised, "supervised", "@"), ARGPARSE_s_n (oSupervised, "deprecated-supervised", "@"),
#endif #endif
ARGPARSE_s_n (oNoDetach, "no-detach", N_("do not detach from the console")), ARGPARSE_s_n (oNoDetach, "no-detach", N_("do not detach from the console")),
ARGPARSE_s_n (oSh, "sh", N_("sh-style command output")), ARGPARSE_s_n (oSh, "sh", N_("sh-style command output")),
@ -714,10 +714,10 @@ map_supervised_sockets (gnupg_fd_t *r_fd,
envvar = getenv ("LISTEN_PID"); envvar = getenv ("LISTEN_PID");
if (!envvar) if (!envvar)
log_error ("no LISTEN_PID environment variable found in " log_error ("no LISTEN_PID environment variable found in "
"--supervised mode (ignoring)\n"); "--deprecated-supervised mode (ignoring)\n");
else if (strtoul (envvar, NULL, 10) != (unsigned long)getpid ()) else if (strtoul (envvar, NULL, 10) != (unsigned long)getpid ())
log_error ("environment variable LISTEN_PID (%lu) does not match" log_error ("environment variable LISTEN_PID (%lu) does not match"
" our pid (%lu) in --supervised mode (ignoring)\n", " our pid (%lu) in --deprecated-supervised mode (ignoring)\n",
(unsigned long)strtoul (envvar, NULL, 10), (unsigned long)strtoul (envvar, NULL, 10),
(unsigned long)getpid ()); (unsigned long)getpid ());
@ -747,21 +747,23 @@ map_supervised_sockets (gnupg_fd_t *r_fd,
fd_count = atoi (envvar); fd_count = atoi (envvar);
else if (fdnames) else if (fdnames)
{ {
log_error ("no LISTEN_FDS environment variable found in --supervised" log_error ("no LISTEN_FDS environment variable found in"
" --deprecated-supervised"
" mode (relying on LISTEN_FDNAMES instead)\n"); " mode (relying on LISTEN_FDNAMES instead)\n");
fd_count = nfdnames; fd_count = nfdnames;
} }
else else
{ {
log_error ("no LISTEN_FDS or LISTEN_FDNAMES environment variables " log_error ("no LISTEN_FDS or LISTEN_FDNAMES environment variables "
"found in --supervised mode" "found in --deprecated-supervised mode"
" (assuming 1 active descriptor)\n"); " (assuming 1 active descriptor)\n");
fd_count = 1; fd_count = 1;
} }
if (fd_count < 1) if (fd_count < 1)
{ {
log_error ("--supervised mode expects at least one file descriptor" log_error ("--deprecated-supervised mode expects at least"
" one file descriptor"
" (was told %d, carrying on as though it were 1)\n", " (was told %d, carrying on as though it were 1)\n",
fd_count); fd_count);
fd_count = 1; fd_count = 1;
@ -774,11 +776,12 @@ map_supervised_sockets (gnupg_fd_t *r_fd,
if (fd_count != 1) if (fd_count != 1)
log_error ("no LISTEN_FDNAMES and LISTEN_FDS (%d) != 1" log_error ("no LISTEN_FDNAMES and LISTEN_FDS (%d) != 1"
" in --supervised mode." " in --deprecated-supervised mode."
" (ignoring all sockets but the first one)\n", " (ignoring all sockets but the first one)\n",
fd_count); fd_count);
if (fstat (3, &statbuf) == -1 && errno ==EBADF) if (fstat (3, &statbuf) == -1 && errno ==EBADF)
log_fatal ("file descriptor 3 must be valid in --supervised mode" log_fatal ("file descriptor 3 must be valid in"
" --depreacted-supervised mode"
" if LISTEN_FDNAMES is not set\n"); " if LISTEN_FDNAMES is not set\n");
*r_fd = 3; *r_fd = 3;
socket_name = gnupg_get_socket_name (3); socket_name = gnupg_get_socket_name (3);
@ -786,7 +789,7 @@ map_supervised_sockets (gnupg_fd_t *r_fd,
else if (fd_count != nfdnames) else if (fd_count != nfdnames)
{ {
log_fatal ("number of items in LISTEN_FDNAMES (%d) does not match " log_fatal ("number of items in LISTEN_FDNAMES (%d) does not match "
"LISTEN_FDS (%d) in --supervised mode\n", "LISTEN_FDS (%d) in --deprecated-supervised mode\n",
nfdnames, fd_count); nfdnames, fd_count);
} }
else else

View File

@ -177,7 +177,7 @@ static gpgrt_opt_t opts[] = {
ARGPARSE_c (aServer, "server", N_("run in server mode (foreground)") ), ARGPARSE_c (aServer, "server", N_("run in server mode (foreground)") ),
ARGPARSE_c (aDaemon, "daemon", N_("run in daemon mode (background)") ), ARGPARSE_c (aDaemon, "daemon", N_("run in daemon mode (background)") ),
#ifndef HAVE_W32_SYSTEM #ifndef HAVE_W32_SYSTEM
ARGPARSE_c (aSupervised, "supervised", "@"), ARGPARSE_c (aSupervised, "deprecated-supervised", "@"),
#endif #endif
ARGPARSE_c (aListCRLs, "list-crls", N_("list the contents of the CRL cache")), ARGPARSE_c (aListCRLs, "list-crls", N_("list the contents of the CRL cache")),
ARGPARSE_c (aLoadCRL, "load-crl", N_("|FILE|load CRL from FILE into cache")), ARGPARSE_c (aLoadCRL, "load-crl", N_("|FILE|load CRL from FILE into cache")),

View File

@ -86,11 +86,13 @@ This is the way @command{dirmngr} is started on demand by the other
GnuPG components. To force starting @command{dirmngr} it is in GnuPG components. To force starting @command{dirmngr} it is in
general best to use @code{gpgconf --launch dirmngr}. general best to use @code{gpgconf --launch dirmngr}.
@item --supervised @item --deprecated-supervised
@opindex supervised @opindex supervised
Run in the foreground, sending logs to stderr, and listening on file Run in the foreground, sending logs to stderr, and listening on file
descriptor 3, which must already be bound to a listening socket. This descriptor 3, which must already be bound to a listening socket. This
option is deprecated and not supported on Windows. option is not supported on Windows and deprecated since version 2.3.6.
To clarify its deprecation the option has been renamed with version
2.5.3.
@item --list-crls @item --list-crls
@opindex list-crls @opindex list-crls

View File

@ -167,21 +167,17 @@ gpg-agent: @code{gpg-agent --daemon /bin/sh}. This way you get a new
shell with the environment setup properly; after you exit from this shell with the environment setup properly; after you exit from this
shell, gpg-agent terminates within a few seconds. shell, gpg-agent terminates within a few seconds.
@item --supervised @item --deprecated-supervised
@opindex supervised @opindex supervised
Run in the foreground, sending logs by default to stderr, and Run in the foreground, sending logs by default to stderr, and
listening on provided file descriptors, which must already be bound to listening on provided file descriptors, which must already be bound to
listening sockets. This option is deprecated and not supported on listening sockets. This option is not supported on Windows and
Windows. deprecated since version 2.3.6. To clarify its deprecation the option
has been renamed with version 2.5.3.
If in @file{common.conf} the option @option{no-autostart} is set, any If in @file{common.conf} the option @option{no-autostart} is set, any
start attempts will be ignored. start attempts will be ignored.
In @option{--supervised} mode, different file descriptors can be provided for
use as different socket types (e.g., ssh, extra) as long as they are
identified in the environment variable @code{LISTEN_FDNAMES} (see
sd_listen_fds(3) on some Linux distributions for more information on
this convention).
@end table @end table
@mansect options @mansect options