Add HTTP(S) web enrollment as alternative to RPC/DCOM - #58
Open
dazzyddos wants to merge 1 commit into
Open
Conversation
In segmented environments where the CA's RPC/DCOM ports (135, 49xxx) are firewalled but HTTP(S) remains accessible, certificate enrollment fails. This adds a --web flag that routes the existing CSR through the AD CS web enrollment endpoint (certsrv/certfnsh.asp) instead. New flags for 'request' and 'request-download' verbs: --web Submit/download via HTTP web enrollment --web-host Target host when web endpoint differs from --ca --https Use HTTPS instead of HTTP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In segmented environments where the CA's RPC/DCOM ports (135, 49xxx) are firewalled but HTTP(S) remains accessible, certificate enrollment fails. This adds a --web flag that routes the existing CSR through the AD CS web enrollment endpoint (certsrv/certfnsh.asp) instead.
New flags for 'request' and 'request-download' verbs:
--web Submit/download via HTTP web enrollment
--web-host Target host when web endpoint differs from --ca
--https Use HTTPS instead of HTTP
Summary
Adds an alternative certificate enrollment transport via the AD CS web enrollment endpoint (
certsrv/certfnsh.asp), for environments where the CA's RPC/DCOM ports are unreachable but HTTP(S) is accessible.Lib/WebEnrollment.cs(new) - Submits CSRs via HTTP POST tocertfnsh.aspand retrieves issued certificates fromcertnew.cer. UsesUseDefaultCredentials(NTLM/Kerberos), consistent with the existing auth model.Commands/CertRequest.cs(modified) - Added--web,--web-host, and--httpsoptions. When--webis set, enrollment routes throughWebEnrollment.SubmitRequest()instead ofICertRequest2. CSR generation, key export, SAN injection, SID extension, and all existing flags remain unchanged.Commands/CertRequestDownload.cs(modified) - Same three options for downloading previously issued or pending certificates via web enrollment.Usage
Web enrollment (HTTP)
Certify.exe request --ca CA01\CA-NAME --template VulnTemplate --upn [email protected] --web
Web enrollment (HTTPS) with explicit web host
Certify.exe request --ca CA01\CA-NAME --template VulnTemplate --upn [email protected] --web --web-host ca-web.corp.local --https
Download a pending certificate via web
Certify.exe request-download --ca CA01\CA-NAME --id 42 --web --web-host ca-web.corp.local --private-key
Why
The default enrollment path uses
CCertRequest.Submit()which requires RPC connectivity to the CA (TCP 135 + dynamic high ports). Network segmentation, host-based firewalls, or proxy-only access commonly block these ports while permitting HTTP(S). The CA web enrollment role service (certsrv) accepts the same CSR and template parameters over HTTP, making it a viable alternative transport that requires no additional CA-side configuration.Notes
System.Net.HttpWebRequest#if !DISARMEDconsistent with existing enrollment code--webonly changes the submission transport; all request-building logic (CertEnrollment.CreateCertRequestMessage) is shared