Skip to main content

Posts

C# Check Expiry Date of SSL Certifcate

  Check Certificate Expiry Date in .NET Core | Steve Fenton DateTime notAfter = DateTime . UtcNow ; var httpClientHandler = new HttpClientHandler { ServerCertificateCustomValidationCallback = ( request , cert , chain , policyErrors ) => { notAfter = cert . NotAfter ; return true ; } }; using HttpClient httpClient = new HttpClient ( httpClientHandler ); await httpClient . SendAsync ( new HttpRequestMessage ( HttpMethod . Head , url )); Assert . IsTrue ( notAfter > DateTime . UtcNow . AddDays ( 60 ));

NimbleText template to create Exchange Dist Groups

Incoming Text Example: Group1@domain.com MgtGroup Group1@domain.com MgtGroup Template - Sets Name, SamAccountName, ManagedBy New-DistributionGroup           -Name '<% $0.split('@')[0] %>'           -SamAccountName '<% $0.split('@')[0] %>'           -ManagedBy '$1'           -OrganizationalUnit 'OU=Distribution Groups DLs),OU=Managed,DC=XXXX,DC=XXX,DC=XXX,DC=au'      -Type 'Security' Update Email Address (when the target address is in col 2  of input )  Set-DistributionGroup '$2'  -EmailAddresses @{Add='$2@XXX.com.au'}

The web.config no extension mime problem Lets Encrypt on IIS/Windows

  Tip when using LetsEncrypt in Windows - Feature Requests - Let's Encrypt Community Support In a paragraph, just use the web.config file to set the mime type, eg...  After trying to figure out why my Lets Encrypt failed to generate in Windows, and discovering that it's the no extension mime type problem, I wondered whether certbot could fill in the missing gap. All that is needed is the following web.config file to be placed in the same directory as the challenge <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <staticContent> <mimeMap fileExtension="." mimeType="text/xml" /> </staticContent> </system.webServer> </configuration> Because there's no mime type for files without an extension on IIS, IIS sends back a 404 when verification happens. The web.config file above sets the mime type. After I created the .well-known ...

Fixing a https Cert in Windows

 I renewed a https cert today in Windows and had problems with the new Cert sticking in Windows It would add fine, without error, but would disappear when the IIS Server Certificates screen would refresh.  Open the Certificates in MMC (Local Machine) and inspecting the Web Hosting gave a clue, the new certificate was there, but with a key - the private key was missing.  Could be because the original certificate was created on a completely different machine and imported to this new server.  At any rate, a simple certutil command fixed it .  A tip I received from  SSL disappears from the certificate list on Windows server - SSL Certificates - Namecheap.com Key steps are:  Double-click the certificate and go to  Details  tab. In certificate details locate the  Serial Number  field, click on it and copy its value. Open Command Prompt, pressing  Win+R  and typing  cmd , then click  OK In the command prompt type: ...