Skip to content

Commit

Permalink
Use chmod() to set permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
doktornotor authored Jan 30, 2017
1 parent a4737dc commit bb9b1ba
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions net/pfSense-pkg-freeradius2/files/usr/local/pkg/freeradius.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2574,7 +2574,10 @@ function freeradius_allcertcnf_resync() {
mwexec("/usr/bin/tar -C " . FREERADIUS_ETC . "/raddb/certs -cf " . FREERADIUS_ETC . "/raddb/certs/client.tar client.crt client.csr client.key ca.der client.pem");

// Make all files in certs folder read/write only for root
mwexec("/bin/chmod -R 0600 " . FREERADIUS_ETC . "/raddb/certs/");
$certs = glob(FREERADIUS_ETC . "/raddb/certs/*");
array_walk($certs, function($cert_file) {
chmod($cert_file, 0600);
});
log_error("freeRADIUS: Created new client.csr .crt .key .pem and added them together with ca.der in " . FREERADIUS_ETC . "/raddb/certs/client.tar");
}
} else {
Expand Down Expand Up @@ -2619,7 +2622,10 @@ function freeradius_allcertcnf_resync() {

// tar client-cert files
mwexec("/usr/bin/tar -C " . FREERADIUS_ETC . "/raddb/certs -cf " . FREERADIUS_ETC . "/raddb/certs/client.tar client.crt client.csr client.key ca.der client.pem");
mwexec("/bin/chmod -R 0600 " . FREERADIUS_ETC . "/raddb/certs/");
$certs = glob(FREERADIUS_ETC . "/raddb/certs/*");
array_walk($certs, function($cert_file) {
chmod($cert_file, 0600);
});
log_error("freeRADIUS: Added client.csr .crt .key .pem together with ca.der in " . FREERADIUS_ETC . "/raddb/certs/client.tar");

// If there were changes on the certificates we need to restart freeradius
Expand Down

0 comments on commit bb9b1ba

Please sign in to comment.