mirror of
https://github.com/webfactory/ssh-agent.git
synced 2024-12-25 00:09:37 +00:00
Use an askpass wrapper
This commit is contained in:
parent
3702096734
commit
1676d1f2a9
2 changed files with 6 additions and 2 deletions
4
dist/index.js
vendored
4
dist/index.js
vendored
|
@ -179,6 +179,8 @@ try {
|
|||
console.log(`Write file ${keyFile}`);
|
||||
fs.writeFileSync(keyFile, key.replace("\r\n", "\n").trim() + "\n", { mode: '600' });
|
||||
|
||||
fs.writeFileSync(`${homeSsh}/askpass`, `echo ${token}`, { mode: '700' });
|
||||
|
||||
// Set private key passphrase
|
||||
let output = '';
|
||||
try {
|
||||
|
@ -193,7 +195,7 @@ try {
|
|||
// Load key into agent
|
||||
console.log('Load key');
|
||||
//let sshAdd = child_process.execSync(`echo "${token}" | ssh-add "${keyFile}"`, { stdio: 'inherit' });
|
||||
let sshAdd = child_process.execFileSync('ssh-add', [keyFile], { stdio: 'inherit' });
|
||||
let sshAdd = child_process.execFileSync('ssh-add', [keyFile], { stdio: 'inherit', env: { 'SSH_ASKPASS': `${homeSsh}/askpass` } });
|
||||
// input: token + "\n", stdio: ['pipe', 'inherit', 'inherit'] });
|
||||
//sshAdd.stdin.write(token + "\n");
|
||||
//sshAdd.stdin.end();
|
||||
|
|
4
index.js
4
index.js
|
@ -62,6 +62,8 @@ try {
|
|||
console.log(`Write file ${keyFile}`);
|
||||
fs.writeFileSync(keyFile, key.replace("\r\n", "\n").trim() + "\n", { mode: '600' });
|
||||
|
||||
fs.writeFileSync(`${homeSsh}/askpass`, `echo ${token}`, { mode: '700' });
|
||||
|
||||
// Set private key passphrase
|
||||
let output = '';
|
||||
try {
|
||||
|
@ -76,7 +78,7 @@ try {
|
|||
// Load key into agent
|
||||
console.log('Load key');
|
||||
//let sshAdd = child_process.execSync(`echo "${token}" | ssh-add "${keyFile}"`, { stdio: 'inherit' });
|
||||
let sshAdd = child_process.execFileSync('ssh-add', [keyFile], { stdio: 'inherit' });
|
||||
let sshAdd = child_process.execFileSync('ssh-add', [keyFile], { stdio: 'inherit', env: { 'SSH_ASKPASS': `${homeSsh}/askpass` } });
|
||||
// input: token + "\n", stdio: ['pipe', 'inherit', 'inherit'] });
|
||||
//sshAdd.stdin.write(token + "\n");
|
||||
//sshAdd.stdin.end();
|
||||
|
|
Loading…
Reference in a new issue