Skip to content

Commit 27de6ea

Browse files
committed
Merge branch 'Dev'
2 parents 3e481ed + 1e41336 commit 27de6ea

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

Controllers/SCMController.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,15 @@ public string SSHGen()
235235

236236
return System.IO.File.ReadAllText(Path.Combine(Environment.GetEnvironmentVariable("HOME"), ".ssh", "id_rsa.pub"));
237237
}
238+
/// <summary>
239+
/// Get curret open ssh key
240+
/// </summary>
241+
/// <returns></returns>
242+
[HttpGet("SShGetCurrentKey")]
243+
public string SSHGetCurrentKey()
244+
{
245+
return System.IO.File.ReadAllText(Path.Combine(Environment.GetEnvironmentVariable("HOME"), ".ssh", "id_rsa.pub"));
246+
}
238247

239248
/// <summary>
240249
/// Load and copy id_rsa and id_rsa.pub from cfg directory to ./ssh/
@@ -252,8 +261,12 @@ public string LoadSSHKeys()
252261
System.IO.File.Copy(Path.Combine(AppContext.BaseDirectory, "cfg", "id_rsa"), Path.Combine(Environment.GetEnvironmentVariable("HOME"), ".ssh", "id_rsa"), true);
253262
System.IO.File.Copy(Path.Combine(AppContext.BaseDirectory, "cfg", "id_rsa.pub"), Path.Combine(Environment.GetEnvironmentVariable("HOME"), ".ssh", "id_rsa.pub"), true);
254263

255-
System.IO.File.Delete(Path.Combine(AppContext.BaseDirectory, "cfg", "id_rsa"));
256-
System.IO.File.Delete(Path.Combine(AppContext.BaseDirectory, "cfg", "id_rsa.pub"));
264+
var cmd = @"chmod 600 /root/.ssh/id_rsa";
265+
ShellHelper.Cmd(cmd, folder, _logger);
266+
cmd= @"chmod 600 /root/.ssh/id_rsa.pub";
267+
ShellHelper.Cmd(cmd, folder, _logger);
268+
//System.IO.File.Delete(Path.Combine(AppContext.BaseDirectory, "cfg", "id_rsa"));
269+
//System.IO.File.Delete(Path.Combine(AppContext.BaseDirectory, "cfg", "id_rsa.pub"));
257270
}
258271
catch (Exception ex)
259272
{

SqlSCM.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app.zip

61 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)