Skip to content

Commit 9d06415

Browse files
Merge da525ed into 9545626
2 parents 9545626 + da525ed commit 9d06415

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

AcmeCaPlugin/AcmeCaPlugin.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,10 +321,14 @@ private static string ExtractDomainFromSubject(string subject)
321321
if (string.IsNullOrWhiteSpace(subject))
322322
throw new ArgumentException("Subject cannot be null or empty", nameof(subject));
323323

324-
return subject
325-
.Replace("CN=", "", StringComparison.OrdinalIgnoreCase)
326-
.Replace("cn=", "", StringComparison.OrdinalIgnoreCase)
327-
.Trim();
324+
// Match CN=value (capturing everything until comma or end of string)
325+
var match = Regex.Match(subject, @"CN=([^,]+)", RegexOptions.IgnoreCase);
326+
if (match.Success)
327+
{
328+
return match.Groups[1].Value.Trim();
329+
}
330+
331+
throw new ArgumentException($"Could not extract CN from subject: {subject}", nameof(subject));
328332
}
329333

330334
/// <summary>

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
# v1.0.1
1+
# v1.0.2
2+
* Fix DNS issue when fields outside domain are in the subject
3+
4+
# v1.0.1
25
* Added build for `.net8`
36

47
# v1.0.0

0 commit comments

Comments
 (0)