mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-23 06:35:13 +01:00
Do not expose internal IP on SSH connection settings
This commit is contained in:
parent
c0da81557b
commit
223213857f
2 changed files with 11 additions and 2 deletions
|
@ -2,7 +2,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||||
<Version>1.0.3.76</Version>
|
<Version>1.0.3.77</Version>
|
||||||
<NoWarn>NU1701,CA1816,CA1308,CA1810,CA2208</NoWarn>
|
<NoWarn>NU1701,CA1816,CA1308,CA1810,CA2208</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
|
@ -658,15 +658,24 @@ namespace BTCPayServer.Controllers
|
||||||
return NotFound();
|
return NotFound();
|
||||||
return File(System.IO.File.ReadAllBytes(settings.KeyFile), "application/octet-stream", "id_rsa");
|
return File(System.IO.File.ReadAllBytes(settings.KeyFile), "application/octet-stream", "id_rsa");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var server = IsLocalNetwork(settings.Server) ? this.Request.Host.Host: settings.Server;
|
||||||
SSHServiceViewModel vm = new SSHServiceViewModel();
|
SSHServiceViewModel vm = new SSHServiceViewModel();
|
||||||
string port = settings.Port == 22 ? "" : $" -p {settings.Port}";
|
string port = settings.Port == 22 ? "" : $" -p {settings.Port}";
|
||||||
vm.CommandLine = $"ssh {settings.Username}@{settings.Server}{port}";
|
vm.CommandLine = $"ssh {settings.Username}@{server}{port}";
|
||||||
vm.Password = settings.Password;
|
vm.Password = settings.Password;
|
||||||
vm.KeyFilePassword = settings.KeyFilePassword;
|
vm.KeyFilePassword = settings.KeyFilePassword;
|
||||||
vm.HasKeyFile = !string.IsNullOrEmpty(settings.KeyFile);
|
vm.HasKeyFile = !string.IsNullOrEmpty(settings.KeyFile);
|
||||||
return View(vm);
|
return View(vm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static bool IsLocalNetwork(string server)
|
||||||
|
{
|
||||||
|
return server.EndsWith(".internal", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
server.Equals("127.0.0.1", StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
server.Equals("localhost", StringComparison.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
[Route("server/theme")]
|
[Route("server/theme")]
|
||||||
public async Task<IActionResult> Theme()
|
public async Task<IActionResult> Theme()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue