<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Rajesh Kothari</title>
    <description>The latest articles on DEV Community by Rajesh Kothari (@rjkothari).</description>
    <link>https://dev.to/rjkothari</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3141800%2F868702c3-7ada-4140-8782-df5f96db0a70.jpeg</url>
      <title>DEV Community: Rajesh Kothari</title>
      <link>https://dev.to/rjkothari</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rjkothari"/>
    <language>en</language>
    <item>
      <title>How to Discover SSL/TLS Certificates in Your Internal Network</title>
      <dc:creator>Rajesh Kothari</dc:creator>
      <pubDate>Wed, 21 May 2025 09:06:48 +0000</pubDate>
      <link>https://dev.to/rjkothari/how-to-discover-ssltls-certificates-in-your-internal-network-3op9</link>
      <guid>https://dev.to/rjkothari/how-to-discover-ssltls-certificates-in-your-internal-network-3op9</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg8bc1ggcag6j2dbbp2yz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fg8bc1ggcag6j2dbbp2yz.png" alt="Image description" width="800" height="800"&gt;&lt;/a&gt;&lt;strong&gt;Discovery is a crucial step&lt;/strong&gt; before implementing any SSL/TLS management solution, especially in complex or distributed IT environments.&lt;/p&gt;

&lt;p&gt;To identify how many &lt;strong&gt;SSL/TLS certificates&lt;/strong&gt; an organization has — &lt;strong&gt;without reaching out to the Certificate Authority (CA)&lt;/strong&gt; — you can follow a &lt;strong&gt;technical discovery approach&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;Here's how:&lt;/p&gt;

&lt;p&gt;🔍 1. &lt;strong&gt;Internal Network Scanning Tools&lt;/strong&gt; Use network scanning tools to &lt;strong&gt;discover certificates in use across internal systems&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recommended Tools&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Nmap&lt;/strong&gt; with the ssl-cert script: bash
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nmap -p 443 --script ssl-cert &amp;lt;IP-range&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This reveals certificate details (issuer, subject, expiry, etc.).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;SSLyze&lt;/strong&gt; – Fast scanning of SSL endpoints, retrieves cert data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;OpenVAS&lt;/strong&gt; or &lt;strong&gt;Nessus&lt;/strong&gt; – Enterprise-grade vulnerability scanners that can include cert discovery.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🗂 &lt;strong&gt;2. Asset Inventory Systems&lt;/strong&gt;&lt;br&gt;
Check existing asset or configuration management tools like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CMDB (Configuration Management Databases)&lt;/li&gt;
&lt;li&gt;Endpoint Management tools like Microsoft SCCM or Lansweeper
These may contain data on certificate installations or services like IIS, Apache, or NGINX.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🧰 &lt;strong&gt;3. Agent-Based Certificate Discovery&lt;/strong&gt; &lt;br&gt;
Deploy agents that search local machines for certificate stores:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Windows Certificate Stores (certlm.msc, certmgr.msc)&lt;/li&gt;
&lt;li&gt;Linux keystores or specific locations like /etc/ssl/, /etc/pki/, etc.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can automate this with:&lt;br&gt;
&lt;strong&gt;PowerShell scripts&lt;/strong&gt; for Windows environments&lt;br&gt;
&lt;strong&gt;Bash scripts&lt;/strong&gt; or &lt;strong&gt;Ansible&lt;/strong&gt; for Linux environments&lt;br&gt;
(See below code for the same)&lt;/p&gt;

&lt;p&gt;🌐 &lt;strong&gt;4. Passive Network Monitoring&lt;/strong&gt; &lt;br&gt;
Use tools that sniff traffic and identify SSL/TLS handshakes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Wireshark&lt;/strong&gt; (manual, good for spot-checks)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Zeek&lt;/strong&gt; (formerly Bro) – Advanced passive analysis, identifies certificates without scanning&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These tools detect certs as clients connect to services.&lt;/p&gt;

&lt;p&gt;📦 &lt;strong&gt;5. Web Application &amp;amp; Server Logs&lt;/strong&gt; &lt;br&gt;
Check reverse proxies, load balancers (like F5, NGINX, HAProxy), and WAFs.&lt;/p&gt;

&lt;p&gt;These often terminate SSL and may log cert details or point to where they're stored.&lt;/p&gt;

&lt;p&gt;📊 &lt;strong&gt;6. Commercial Certificate Management Solutions&lt;/strong&gt; &lt;br&gt;
Some solutions offer discovery via:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Network sweepers&lt;/li&gt;
&lt;li&gt;Agentless scanning&lt;/li&gt;
&lt;li&gt;Integration with APIs or DevOps pipelines&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Examples: Venafi, AppViewX, Keyfactor, Sectigo Certificate Manager.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; These tools often don’t need the CA's help. They just look at the systems that are using the certificates.&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Summary&lt;/strong&gt; &lt;br&gt;
To discover how many SSL certificates an organization has &lt;strong&gt;without contacting the CA&lt;/strong&gt;, you should:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use network scans and agent-based discovery&lt;/li&gt;
&lt;li&gt;Query certificate stores and configuration files&lt;/li&gt;
&lt;li&gt;Leverage logs and monitoring tools&lt;/li&gt;
&lt;li&gt;Combine multiple methods for complete visibility&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;PowerShell Script: Discover Issued Certificates in Windows Personal Store&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🔍 &lt;strong&gt;Targets&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;LocalMachine\My (Personal Certificates for System)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;CurrentUser\My (Personal Certificates for Logged-in User)&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$stores = @(
    "LocalMachine\My",
    "CurrentUser\My"
)

$results = @()

foreach ($store in $stores) {
    $storeScope, $storeName = $store -split "\\"
    $location = if ($storeScope -eq "LocalMachine") {
        [System.Security.Cryptography.X509Certificates.StoreLocation]::LocalMachine
    } else {
        [System.Security.Cryptography.X509Certificates.StoreLocation]::CurrentUser
    }

    $x509Store = New-Object System.Security.Cryptography.X509Certificates.X509Store($storeName, $location)
    $x509Store.Open("ReadOnly")

    foreach ($cert in $x509Store.Certificates) {
        if ($cert.HasPrivateKey -and $cert.Subject -ne $null) {
            $results += [PSCustomObject]@{
                Subject      = $cert.Subject
                Issuer       = $cert.Issuer
                Thumbprint   = $cert.Thumbprint
                Expires      = $cert.NotAfter
                FriendlyName = $cert.FriendlyName
                Store        = $store
            }
        }
    }

    $x509Store.Close()
}

$results | Sort-Object Expires | Format-Table –AutoSize
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Notes&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run PowerShell as Administrator to access LocalMachine stores.&lt;/li&gt;
&lt;li&gt;Modify the $stores array to add more stores if needed (TrustedPeople, AuthRoot, etc.).&lt;/li&gt;
&lt;li&gt;You can export results to CSV:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$results | Export-Csv -Path "certificates_report.csv" -NoTypeInformation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Bash Script: Discover Installed SSL/TLS Certificates on Linux&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🔍 &lt;strong&gt;What it Does:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Scans common system paths where SSL certificates are stored: /etc/ssl/certs, /etc/pki/tls/certs, Apache, NGINX, and custom cert folders&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Extracts certificate metadata using openssl&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Outputs Subject, Issuer, Expiry Date, and File Path&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

# Common locations to scan
CERT_DIRS=(
    "/etc/ssl/certs"
    "/etc/pki/tls/certs"
    "/etc/nginx"
    "/etc/apache2"
    "/usr/local/share/ca-certificates"
    "/opt"
)

echo -e "Found certificates:\n"
echo -e "File Path\t\t\tSubject\t\t\tIssuer\t\t\tExpires"

# Scan for certificate files
for DIR in "${CERT_DIRS[@]}"; do
    if [ -d "$DIR" ]; then
        find "$DIR" -type f \( -name "*.crt" -o -name "*.pem" -o -name "*.cer" \) 2&amp;gt;/dev/null | while read -r CERTFILE; do
            if openssl x509 -in "$CERTFILE" -noout &amp;amp;&amp;gt;/dev/null; then
                SUBJECT=$(openssl x509 -in "$CERTFILE" -noout -subject | cut -d'=' -f2-)
                ISSUER=$(openssl x509 -in "$CERTFILE" -noout -issuer | cut -d'=' -f2-)
                EXPIRES=$(openssl x509 -in "$CERTFILE" -noout -enddate | cut -d'=' -f2)
                echo -e "$CERTFILE\t$SUBJECT\t$ISSUER\t$EXPIRES"
            fi
        done
    fi
done
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>sslcertificate</category>
      <category>certificatelifecyclemanagement</category>
      <category>sslcertificatediscovery</category>
      <category>sslinventorytools</category>
    </item>
    <item>
      <title>How to Secure Your Intranet with SSL: A Developer’s Guide</title>
      <dc:creator>Rajesh Kothari</dc:creator>
      <pubDate>Fri, 09 May 2025 15:05:13 +0000</pubDate>
      <link>https://dev.to/rjkothari/how-to-secure-your-intranet-with-ssl-a-developers-guide-oh9</link>
      <guid>https://dev.to/rjkothari/how-to-secure-your-intranet-with-ssl-a-developers-guide-oh9</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fudaul9rhnlb8puodwog2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fudaul9rhnlb8puodwog2.png" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;strong&gt;Introduction&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Intranet applications are often the backbone of an organization’s internal operations—HR systems, project management tools, databases, and more. Yet, many companies overlook securing these internal portals, assuming they are safe behind firewalls. This leaves critical data vulnerable to interception and unauthorized access.&lt;/p&gt;

&lt;p&gt;In this guide, we’ll explore the &lt;strong&gt;best practices for deploying SSL certificates&lt;/strong&gt; in intranet environments, with step-by-step explanations on implementation, automation, and regular security audits. Plus, we’ll explain why &lt;strong&gt;SecureNT SSL Certificates&lt;/strong&gt; are a smarter choice over OpenSSL for internal applications.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Why Intranet Applications Need SSL&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Many IT teams prioritize SSL for public-facing websites but neglect internal applications. This is a critical oversight. Even within internal networks, &lt;strong&gt;man-in-the-middle attacks&lt;/strong&gt;, packet sniffing, and insider threats are real dangers. SSL encryption ensures that all data transferred within your intranet is secure, even from internal risks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Benefits:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data encryption across internal apps&lt;/li&gt;
&lt;li&gt;Secure authentication for users&lt;/li&gt;
&lt;li&gt;Protection against data interception&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Step-by-Step SSL Deployment for Internal Applications&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here’s a streamlined approach to deploying SSL certificates across your internal network:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt;: Generate a CSR (Certificate Signing Request)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;openssl req -new -newkey rsa:2048 -nodes -keyout intranet.key -out intranet.csr&lt;br&gt;
&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Step 2&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 1: Get a Trusted SSL Certificate from a CA - Recommended.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Submit the CSR (intranet.csr) to a Private Certificate Authority (Pvt CA) like SecureNT. You will receive the following files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;intranet.crt → The signed SSL certificate&lt;/li&gt;
&lt;li&gt;ca_bundle.crt → CA intermediate certificates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Install the issued SSL certificate:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo cp intranet.crt /etc/ssl/certs/&lt;br&gt;
sudo cp intranet.key /etc/ssl/private/&lt;br&gt;
sudo cp ca_bundle.crt /etc/ssl/certs/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Option 2: Generate a Self-Signed SSL Certificate (For Internal Use)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you want to generate a self-signed certificate for testing or private networks, use this command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout intranet.key -out intranet.crt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Optional&lt;/strong&gt;: If you want to create a PFX (PKCS#12) file for Windows Servers or Azure, run:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;openssl pkcs12 -export -out intranet.pfx -inkey intranet.key -in intranet.crt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt;: Update your web server configuration (e.g., Apache or Nginx)&lt;/p&gt;

&lt;p&gt;For Apache:&lt;br&gt;
&lt;code&gt;&amp;lt;VirtualHost *:443&amp;gt;&lt;br&gt;
    ServerName intranet.example.com&lt;br&gt;
    SSLEngine on&lt;br&gt;
    SSLCertificateFile /etc/ssl/certs/intranet.crt&lt;br&gt;
    SSLCertificateKeyFile /etc/ssl/private/intranet.key&lt;br&gt;
&amp;lt;/VirtualHost&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;For Nginx:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;server {&lt;br&gt;
    listen 443 ssl;&lt;br&gt;
    server_name intranet.example.com;&lt;br&gt;
    ssl_certificate /etc/ssl/certs/intranet.crt;&lt;br&gt;
    ssl_certificate_key /etc/ssl/private/intranet.key;&lt;br&gt;
    ssl_trusted_certificate /etc/ssl/certs/ca_bundle.crt;&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt;: Restart your server&lt;br&gt;
&lt;code&gt;sudo systemctl restart apache2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. OpenSSL vs. SecureNT Intranet SSL: Which Is Better?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While OpenSSL is a powerful open-source tool for generating SSL certificates, it’s not ideal for intranet use in corporate settings. &lt;/p&gt;

&lt;p&gt;Here’s why:&lt;br&gt;
In the case of Self-Signed Certificates, there is &lt;strong&gt;no Trust Chain&lt;/strong&gt;. The Private Key of the Root CA is stored within the PFX file. And these PFX files are stored on local PC or on Servers. They have no or weak passwords. If anyone with ill intentions gets to access these PFX files, he can manage to get the Private Key. He can use the Private Key to monitor the network traffic in unencrypted form on the internal network using sniffer tools. So, usage of Self-Signed SSL is fraught with severe data security risks.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Automate SSL Certificate Renewal&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Manual SSL renewals are error-prone and can lead to expired certificates, causing service disruptions. Automated tools like Certbot can handle OpenSSL certificates, but they still require additional configuration.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo certbot renew --quiet&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;With SecureNT, renewal is handled by prior reminders, ensuring there’s no downtime and no last-minute rush to avoid expiration.&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Perform Regular Security Audits&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Regular audits are crucial to maintaining secure intranet environments. Tools like Qualys SSL Labs and OpenVAS help you scan for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Weak ciphers&lt;/li&gt;
&lt;li&gt;Expired certificates&lt;/li&gt;
&lt;li&gt;Misconfigurations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example Command:&lt;br&gt;
&lt;code&gt;nmap --script ssl-enum-ciphers -p 443 intranet.example.com&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Monitor and Log SSL Activity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Real-time monitoring ensures any suspicious activity is detected early. Use tools like Splunk or Graylog to track:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Failed handshakes&lt;/li&gt;
&lt;li&gt;Certificate expiry alerts&lt;/li&gt;
&lt;li&gt;Unauthorized access attempts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⸻&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Securing your intranet is not just about ticking a compliance checkbox—it’s about actively protecting your internal data from breaches and unauthorized access. While &lt;strong&gt;OpenSSL&lt;/strong&gt; might be suitable for basic testing and development, &lt;strong&gt;SecureNT SSL Certificates&lt;/strong&gt; provide the reliability, automation, and browser-trusted security needed for real-world intranet environments.&lt;/p&gt;

</description>
      <category>ssl</category>
      <category>webdev</category>
      <category>encryption</category>
      <category>ipaddress</category>
    </item>
  </channel>
</rss>
