Skip to content

Commit

Permalink
cred.json with 0640 permissions
Browse files Browse the repository at this point in the history
Fixes #70
  • Loading branch information
christianTF committed Mar 3, 2021
1 parent 8709771 commit 83ed395
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions bin/updateconfig.pl
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ sub update_config
$Credentials{brokerpass} = $cfg->{Main}{brokerpass};
$cred->{Credentials} = \%Credentials;
$credobj->write();
chmod 0640, $credobj->filename();
delete $cfg->{Main}{brokeruser};
delete $cfg->{Main}{brokerpass};
LOGWARN "Migrated MQTT credentials.";
Expand Down Expand Up @@ -193,6 +194,7 @@ sub update_config

$cred->{Credentials} = \%Credentials;
$credobj->write();
chmod 0640, $credobj->filename();

print STDERR "COMMAND: $lbphtmlauthdir/ajax_brokercred.cgi action=setcred brokeruser=$Credentials{brokeruser} brokerpass=$Credentials{brokerpass} brokerpsk=$Credentials{brokerpsk} enable_mosquitto=$cfg->{Main}{enable_mosquitto}\n";

Expand Down
4 changes: 3 additions & 1 deletion postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,17 @@ PBIN=$LBPBIN/$PDIR
# echo "<INFO> Plugin Log folder (on RAMDISK!) is: $PLOG"
# echo "<INFO> Plugin CONFIG folder is: $PCONFIG"


echo "<INFO> Copy back existing config files"
cp -f -r /tmp/$PTEMPDIR\_upgrade/config/$PDIR/* $LBHOMEDIR/config/plugins/$PDIR/
chmod 0640 $LBHOMEDIR/config/plugins/$PDIR/cred.json
chmod 0640 $LBHOMEDIR/config/plugins/$PDIR/cred.json.*
echo "<INFO> Copy back existing data files"
cp -f -r /tmp/$PTEMPDIR\_upgrade/data/transform/custom/ $PDATA/transform/custom/
chmod -R 0774 $LBHOMEDIR/data/plugins/$PDIR/transform/custom/
cp -f -r /tmp/$PTEMPDIR\_upgrade/data/transform/datastore/ $PDATA/transform/datastore/
chmod -R 0774 $LBHOMEDIR/data/plugins/$PDIR/transform/datastore/


# echo "<INFO> Remove temporary folders"
# rm -f -r /tmp/$PTEMPDIR\_upgrade

Expand Down
1 change: 1 addition & 0 deletions webfrontend/htmlauth/ajax_brokercred.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ sub setcred

$cred->{Credentials} = \%Credentials;
$credobj->write();
chmod 0640, $credobj->filename();

if($cred) {
%response = (%response, %$cred);
Expand Down

0 comments on commit 83ed395

Please sign in to comment.