Skip to content

Commit

Permalink
Allow to specify a logfile in the sign.conf
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed May 27, 2020
1 parent eba2c56 commit a929f4d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sign.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ lines in the configuration.
Allow signd to accept connections from source ports >
1024.
Defaults to false.
.TP 4
.BR logfile: " filename"
Log requests to the specified filename instead of stdout.

.SH FILES
.I /etc/sign.conf
Expand Down
9 changes: 9 additions & 0 deletions signd
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ my $tmpdir = '/var/run/signd';
my $patchclasstime;
my $conf = '/etc/sign.conf';
my $allow_unprivileged_ports = 0;
my $logfile;
my @pinentrymode;

# request data
Expand Down Expand Up @@ -376,6 +377,10 @@ while(<F>) {
if ($s[0] eq 'allow-unprivileged-ports:') {
$allow_unprivileged_ports = ($s[1] =~ /^true$/i) ? 1 : 0;
}
if ($s[0] eq 'logfile:') {
$logfile = $s[1];
next;
}
}

my $myname = $phrases ? 'signd' : 'signproxy';
Expand Down Expand Up @@ -417,6 +422,10 @@ if (($ARGV[0] || '') eq '-f') {
POSIX::setsid();
$SIG{'PIPE'} = 'IGNORE';
$| = 1;
if ($logfile) {
open(STDOUT, '>>', $logfile) || die("Could not open $logfile: $!\n");
open(STDERR, ">&STDOUT");
}
printlog("$myname started");

socket(MS , PF_INET, SOCK_STREAM, IPPROTO_TCP) || die "socket: $!\n";
Expand Down

0 comments on commit a929f4d

Please sign in to comment.