blob: 8b00da377e06a01b7e6b40906e02cafb60a44f74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
using Fclp;
using PKISharp.WACS.Clients.IIS;
using PKISharp.WACS.Configuration;
using PKISharp.WACS.Services;
using System.Net;
namespace PKISharp.WACS.Plugins.InstallationPlugins
{
internal class IISWebArgumentsProvider : BaseArgumentsProvider<IISWebArguments>
{
private const string SslPortParameterName = "sslport";
private const string SslIpParameterName = "sslipaddress";
public override string Name => "IIS Web plugin";
public override string Group => "Installation";
public override string Condition => "--installation iis";
public override bool Validate(IISWebArguments current, MainArguments main)
{
if (!base.Validate(current, main))
{
return false;
}
if (!string.IsNullOrEmpty(current.SSLPort))
{
if (int.TryParse(current.SSLPort, out var port))
{
if (port < 1 || port > 65535)
{
Log?.Error("Invalid --{param}, value should be between 1 and 65535", SslPortParameterName);
return false;
}
}
else
{
Log?.Error("Invalid --{param}, value should be a number", SslPortParameterName);
return false;
}
}
if (!string.IsNullOrEmpty(current.SSLIPAddress))
{
if (!IPAddress.TryParse(current.SSLIPAddress, out _))
{
Log?.Error("Invalid --{sslipaddress}", SslIpParameterName);
return false;
}
}
return true;
}
public override void Configure(FluentCommandLineParser<IISWebArguments> parser)
{
parser.Setup(o => o.InstallationSiteId)
.As("installationsiteid")
.WithDescription("Specify site to install new bindings to. Defaults to the target if that is an IIS site.");
parser.Setup(o => o.SSLPort)
.As(SslPortParameterName)
.WithDescription($"Port number to use for newly created HTTPS bindings. Defaults to {IISClient.DefaultBindingPort}.");
parser.Setup(o => o.SSLIPAddress)
.As(SslIpParameterName)
.WithDescription($"IP address to use for newly created HTTPS bindings. Defaults to {IISClient.DefaultBindingIp}.");
}
}
}
|