From 5cf25633d48f79f39ab8c35883e1e437b3a058e4 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Thu, 18 Feb 2021 02:05:48 +0100 Subject: lacme: Preserve $GPG_TTY when spawning the accountd. This is needed for gpg-encrypted privkeys. --- lacme | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lacme b/lacme index 87a44be..d141b62 100755 --- a/lacme +++ b/lacme @@ -503,14 +503,16 @@ sub acme_client($@) { if (defined (my $accountd = $CONFIG->{accountd})) { warn "Setting 'privkey' in lacme.conf's [accountd] section is deprecated and will become an error in a future release! " ."Set it in lacme-accountd.conf instead.\n" if $accountd->{privkey} ne ''; + my $GPG_TTY = $ENV{GPG_TTY}; socketpair($client, my $s, AF_UNIX, SOCK_STREAM, PF_UNSPEC) or die "socketpair: $!"; my $pid = fork() // "fork: $!"; unless ($pid) { drop_privileges($accountd->{user}, $accountd->{group}, '/'); - set_FD_CLOEXEC($s, 1); $client->close() or die "close: $!"; open STDIN, '<&', $s or die "dup: $!"; open STDOUT, '>&', $s or die "dup: $!"; + set_FD_CLOEXEC($s, 1); + $ENV{GPG_TTY} = $GPG_TTY if defined $GPG_TTY; my ($cmd, @args) = split(/\s+/, $accountd->{command}) or die "Empty accountd command\n"; push @args, '--stdio'; push @args, '--config='.$accountd->{config} if $accountd->{config} ne ''; -- cgit v1.2.3