Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Commit

Permalink
security(core): rsa keys no more world readable (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
garnier-quentin committed Nov 23, 2021
1 parent 4b18112 commit cb6e2ad
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions gorgone/class/core.pm
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,15 @@ sub init_server_keys {
$self->{logger}->writeLogInfo("[core] Public key file '$self->{config}->{configuration}->{gorgone}->{gorgonecore}->{pubkey}' written");
}

my $rv = chmod(0600, $self->{config}->{configuration}->{gorgone}->{gorgonecore}->{privkey});
if ($rv == 0) {
$self->{logger}->writeLogInfo("[core] chmod private key file '$self->{config}->{configuration}->{gorgone}->{gorgonecore}->{privkey}': $!");
}
$rv = chmod(0640, $self->{config}->{configuration}->{gorgone}->{gorgonecore}->{pubkey});
if ($rv == 0) {
$self->{logger}->writeLogInfo("[core] chmod public key file '$self->{config}->{configuration}->{gorgone}->{gorgonecore}->{pubkey}': $!");
}

($code, $self->{server_privkey}) = gorgone::standard::library::loadprivkey(
logger => $self->{logger},
privkey => $self->{config}->{configuration}->{gorgone}->{gorgonecore}->{privkey},
Expand Down

0 comments on commit cb6e2ad

Please sign in to comment.