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 authored and chgautier committed Dec 10, 2021
1 parent a3ed6a0 commit b0ac91b
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 @@ -108,6 +108,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 b0ac91b

Please sign in to comment.