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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
using PKISharp.WACS.Plugins.Base;
using PKISharp.WACS.Plugins.Base.Options;
using PKISharp.WACS.Services;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
namespace PKISharp.WACS.Plugins.TargetPlugins
{
[Plugin("54deb3ee-b5df-4381-8485-fe386054055b")]
internal class IISOptions : TargetPluginOptions<IIS>
{
public override string Name => "IIS";
public override string Description => "Read site bindings from IIS";
/// <summary>
/// Common name for the certificate
/// </summary>
public string? CommonName { get; set; }
/// <summary>
/// Search string to select hosts
/// </summary>
public string? IncludePattern { get; set; }
/// <summary>
/// Regular expression to select hosts
/// </summary>
public Regex? IncludeRegex { get; set; }
/// <summary>
/// Filter by hostname
/// </summary>
public List<string>? IncludeHosts { get; set; }
/// <summary>
/// Excluded bindings (additional filter)
/// </summary>
public List<string>? ExcludeHosts { get; set; }
/// <summary>
/// Site ids to include in the selection
/// </summary>
public List<long>? IncludeSiteIds { get; set; }
public override void Show(IInputService input)
{
base.Show(input);
if (!string.IsNullOrEmpty(CommonName))
{
input.Show("Common name", CommonName, level: 1);
}
// Site filter
if (IncludeSiteIds != null && IncludeSiteIds.Any())
{
input.Show("Sites", string.Join(",", IncludeSiteIds), level: 1);
}
else
{
input.Show("Sites", "All", level: 1);
}
// Binding filter
if (IncludeRegex != default)
{
input.Show("Regex", IncludeRegex.ToString(), level: 1);
}
else if (!string.IsNullOrWhiteSpace(IncludePattern))
{
input.Show("Pattern", IncludePattern, level: 1);
}
else if (IncludeHosts != null && IncludeHosts.Any())
{
input.Show("Hosts", string.Join(',', IncludeHosts), level: 1);
}
else
{
input.Show("Hosts", "All", level: 1);
}
// Last-minute exclude
if (ExcludeHosts != null && ExcludeHosts.Any())
{
input.Show("Exclude", string.Join(',', ExcludeHosts), level: 1);
}
}
}
}
|