Skip to content
This repository has been archived by the owner on Oct 12, 2020. It is now read-only.

Commit

Permalink
Set permissions on backup files so only owner can read and update the…
Browse files Browse the repository at this point in the history
… backup (nanocurrency#929)
  • Loading branch information
cryptocode authored and devinus committed Jun 28, 2018
1 parent 8690fbb commit 5520187
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rai/node/wallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include <argon2.h>

#include <boost/filesystem.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/property_tree/ptree.hpp>

Expand Down Expand Up @@ -554,6 +555,10 @@ void rai::wallet_store::write_backup (MDB_txn * transaction_a, boost::filesystem
backup_file.open (path_a.string ());
if (!backup_file.fail ())
{
// Set permissions to 600
boost::system::error_code ec;
boost::filesystem::permissions (path_a, boost::filesystem::perms::owner_read | boost::filesystem::perms::owner_write, ec);

std::string json;
serialize_json (transaction_a, json);
backup_file << json;
Expand Down

0 comments on commit 5520187

Please sign in to comment.