now setting rights for stored keys

This commit is contained in:
2016-06-26 04:23:45 +02:00
parent 742bf694e4
commit ecd0fd8fad
6 changed files with 18 additions and 6 deletions

View File

@ -81,10 +81,14 @@ export class SshKey {
plugins.fs.ensureDirSync(dirPathArg);
let fileNameBase = this.host;
if(this._privKey){
plugins.smartfile.memory.toFsSync(this._privKey,plugins.path.join(dirPathArg,fileNameBase));
let filePath = plugins.path.join(dirPathArg,fileNameBase);
plugins.smartfile.memory.toFsSync(this._privKey,filePath);
plugins.shelljs.chmod(600,filePath);
};
if (this._pubKey){
plugins.smartfile.memory.toFsSync(this._pubKey,plugins.path.join(dirPathArg,fileNameBase + ".pub"));
let filePath = plugins.path.join(dirPathArg,fileNameBase + ".pub");
plugins.smartfile.memory.toFsSync(this._pubKey,filePath);
plugins.shelljs.chmod(600,filePath);
}
}
}

View File

@ -5,5 +5,6 @@ export let fs = require("fs-extra");
export let minimatch = require("minimatch");
export import path = require("path");
export let q = require("q");
export let shelljs = require("shelljs");
export import smartfile = require("smartfile");
export import smartpath = require("smartpath");