<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Passing Curiosity: Posts tagged curl</title>
    <link href="https://passingcuriosity.com/tags/curl/curl.xml" rel="self" />
    <link href="https://passingcuriosity.com" />
    <id>https://passingcuriosity.com/tags/curl/curl.xml</id>
    <author>
        <name>Thomas Sutton</name>
        
        <email>me@thomas-sutton.id.au</email>
        
    </author>
    <updated>2024-01-20T00:00:00Z</updated>
    <entry>
    <title>Extract a CA certificate bundle from macOS Keychain</title>
    <link href="https://passingcuriosity.com/2024/export-keychain-certificates-to-pem/" />
    <id>https://passingcuriosity.com/2024/export-keychain-certificates-to-pem/</id>
    <published>2024-01-20T00:00:00Z</published>
    <updated>2024-01-20T00:00:00Z</updated>
    <summary type="html"><![CDATA[<p>How to generate a PEM file containing the trusted CA certificates in your macOS
Keychain. As described in <a href="https://stackoverflow.com/a/41853880">this answer on Stack Exchange</a> you can use the
<a href="https://ss64.com/mac/security.html"><code>security</code></a> tool added in Mac OS X 10.3:</p>
<pre><code>security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain &gt; cacerts.pem

security find-certificate -a -p /Library/Keychains/System.keychain &gt;&gt; cacerts.pem</code></pre>
<p>If there are missing CA certificates you need to trust, just append them to the
end of the file:</p>
<pre><code>cat MyTlsStrippingCorporateProxyCA.pem &gt;&gt; cacerts.pem</code></pre>
<p>You can store the <code>cacerts.pem</code> file somewhere convenient – maybe somewhere
under <code>~/Library/</code> would be sensible on macOS – and then export the many and
varied environment variables that will configure various tools to use the file:</p>
<pre><code>export AWS_CA_BUNDLE=&quot;$HOME/Library/cacerts.pem&quot;
export CURL_CA_BUNDLE=&quot;$HOME/Library/cacerts.pem&quot;
export HTTPLIB2_CA_CERTS=&quot;$HOME/Library/cacerts.pem&quot;
export REQUESTS_CA_BUNDLE=&quot;$HOME/Library/cacerts.pem&quot;
export SSL_CERT_FILE=&quot;$HOME/Library/cacerts.pem&quot;
export NODE_EXTRA_CA_CERTS=&quot;$HOME/Library/cacerts.pem&quot;</code></pre>]]></summary>
</entry>

</feed>
