Skip to content

Commit

Permalink
[backend] add support for $BSConfig::certfile to configure a default …
Browse files Browse the repository at this point in the history
…cert file

We already have BSConfig::keyfile if forceprojectkeys is false.
We also need a default cert to build things like kernel packages.
  • Loading branch information
mlschroe committed Jul 1, 2020
1 parent c007741 commit 1f6bdc7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/backend/BSConfig.pm.template
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,10 @@ our $relsync_pool = {
#our $sign = '/usr/bin/sign';
#Extend sign call with project name as argument "--project $NAME"
#our $sign_project = 1;
#Global sign key
#Global sign key / cert
#our $keyfile = '/srv/obs/openSUSE-Build-Service.asc';
#our $gpg_standard_key = "/etc/obs-default-gpg.asc";
#our $certfile = '/srv/obs/openSUSE-Build-Service.cert'

# Use a special local arch for product building
# our $localarch = "x86_64";
Expand Down
10 changes: 7 additions & 3 deletions src/backend/bs_srcserver
Original file line number Diff line number Diff line change
Expand Up @@ -5500,11 +5500,13 @@ sub getsslcert {
my $cert = projid2sslcert($skprojid, $sk, $projid, 0, $signtype);
return ($cert, 'Content-Type: text/plain');
}
my $cert;
if ($BSConfig::sign_project && $BSConfig::sign) {
my $cert = BSSrcServer::Signkey::getdefaultcert($projid, $signtype);
return ($cert, 'Content-Type: text/plain') if $cert;
$cert = BSSrcServer::Signkey::getdefaultcert($projid, $signtype);
} elsif ($BSConfig::certfile) {
$cert = readstr($BSConfig::certfile, 1);
}
return ('', 'Content-Type: text/plain');
return ($cert || '', 'Content-Type: text/plain');
}

sub getkeyinfo {
Expand All @@ -5527,6 +5529,8 @@ sub getkeyinfo {
} else {
$cert = BSSrcServer::Signkey::getdefaultcert($projid, $signtype);
}
} elsif ($cgi->{'withsslcert'} && !$skprojid && $BSConfig::certfile) {
$cert = readstr($BSConfig::certfile, 1);
}
if (!$pk && $BSConfig::sign_project && $BSConfig::sign) {
$pk = BSSrcServer::Signkey::getdefaultpubkey($projid);
Expand Down

0 comments on commit 1f6bdc7

Please sign in to comment.