Commit a1f263c0 authored by Girish Ramakrishnan's avatar Girish Ramakrishnan

stash the backup password in filesystem for safety

we will add a release note asking the user to nuke it
parent 346eac38
'use strict';
const backups = require('../src/backups.js');
const backups = require('../src/backups.js'),
fs = require('fs');
exports.up = function(db, callback) {
db.all('SELECT value FROM settings WHERE name="backup_config"', function (error, results) {
......@@ -10,6 +11,15 @@ exports.up = function(db, callback) {
if (backupConfig.key) {
backupConfig.encryption = backups.generateEncryptionKeysSync(backupConfig.key);
backups.cleanupCacheFilesSync();
fs.writeFileSync('/home/yellowtent/platformdata/BACKUP_PASSWORD',
'This file contains your Cloudron backup password.\nBefore Cloudron v5.2, this was saved in the database.' +
'From Cloudron 5.2, this password is not required anymore. We generate strong keys based off this password and use those keys to encrypt the backups.\n' +
'This means that the password is only required at decryption/restore time.\n\n' +
'This file can be safely removed and only exists for the off-chance that you do not remember your backup password.\n\n' +
`Password: ${backupConfig.key}`,
'utf8');
} else {
backupConfig.encryption = null;
}
......@@ -21,5 +31,5 @@ exports.up = function(db, callback) {
};
exports.down = function(db, callback) {
callback();
callback();
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment