<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Vertica Documentation – TLS authentication</title>
    <link>/en/security-and-authentication/client-authentication/tls-authentication/</link>
    <description>Recent content in TLS authentication on Vertica Documentation</description>
    <generator>Hugo -- gohugo.io</generator>
    
	  <atom:link href="/en/security-and-authentication/client-authentication/tls-authentication/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Security-and-Authentication: Client authentication with TLS</title>
      <link>/en/security-and-authentication/client-authentication/tls-authentication/client-authentication-with-tls/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      
      <guid>/en/security-and-authentication/client-authentication/tls-authentication/client-authentication-with-tls/</guid>
      <description>
        
        
        &lt;p&gt;Database users or roles &lt;a href=&#34;../../../../en/sql-reference/statements/grant-statements/grant-authentication/&#34;&gt;granted&lt;/a&gt; a &lt;code&gt;tls&lt;/code&gt; authentication record can authenticate to Vertica with a TLS certificate.&lt;/p&gt;
&lt;h2 id=&#34;prerequisites&#34;&gt;Prerequisites&lt;/h2&gt;
&lt;p&gt;You must configure Vertica for &lt;a href=&#34;../../../../en/security-and-authentication/tls-protocol/tls-overview/configuring-client-server-tls/&#34;&gt;mutual mode client-server TLS&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In mutual mode, the client and server must verify each other&#39;s identity before connecting. This mode allows Vertica to verify the identity of the client and allow them to authenticate the client through their certificate.&lt;/p&gt;
&lt;h2 id=&#34;configuring-tls-authentication&#34;&gt;Configuring TLS authentication&lt;/h2&gt;
&lt;p&gt;The following section &lt;a href=&#34;../../../../en/security-and-authentication/tls-protocol/tls-overview/generating-tls-certificates-and-keys/&#34;&gt;generates&lt;/a&gt; a private key and certificate for the client. For simplicity, the example signs the client certificate with the following self-signed CA certificate &lt;code&gt;SSCA_cert&lt;/code&gt; (which has also, in the context of the example, signed the Vertica database&#39;s server certificate).&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE KEY SSCA_key TYPE &amp;#39;RSA&amp;#39; LENGTH 2048;
=&amp;gt; CREATE CA CERTIFICATE SSCA_cert
SUBJECT &amp;#39;/C=US/ST=Massachusetts/L=Cambridge/O=Micro Focus/OU=Vertica/CN=Vertica Root CA&amp;#39;
VALID FOR 3650
EXTENSIONS &amp;#39;nsComment&amp;#39; = &amp;#39;Self-signed root CA cert&amp;#39;
KEY SSCA_key;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;In a production environment, you should instead use a CA certificate from a trusted certificate authority.&lt;/p&gt;
&lt;p&gt;The following example configures Vertica to use an authentication record with the method &lt;code&gt;tls&lt;/code&gt; to authenticate the database user &lt;code&gt;Bob&lt;/code&gt;:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Generate the client&#39;s private key:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE KEY client_key_bob TYPE &amp;#39;RSA&amp;#39; LENGTH 2048;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Generate the client&#39;s certificate, specifying a database user for the Common Name (CN) field. This example creates a certificate for the database user &lt;code&gt;Bob&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE CERTIFICATE client_cert_bob
SUBJECT &amp;#39;/C=US/ST=Massachusetts/L=Cambridge/O=Micro Focus/OU=Vertica/CN=&lt;span class=&#34;code-input&#34;&gt;Bob&lt;/span&gt;/emailAddress=bob@example.com&amp;#39;
SIGNED BY SSCA_cert
EXTENSIONS &amp;#39;nsComment&amp;#39; = &amp;#39;Vertica client cert&amp;#39;, &amp;#39;extendedKeyUsage&amp;#39; = &amp;#39;clientAuth&amp;#39;
KEY client_key_bob;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Export the client&#39;s private key and certificate:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ vsql -At -c &amp;#34;SELECT key FROM cryptographic_keys WHERE name = &amp;#39;client_key_bob&amp;#39;;&amp;#34; -o client_key_bob.key
$ vsql -At -c &amp;#34;SELECT certificate_text FROM certificates WHERE name = &amp;#39;client_cert_bob&amp;#39;;&amp;#34; -o client_cert_bob.crt
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Copy or move the certificates to a location recognized by your client. This example applies to &lt;code&gt;vsql&lt;/code&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;$ mkdir -p ~/.vsql
$ cp client_cert_bob.crt ~/.vsql/client.crt
$ cp client_key_bob.key ~/.vsql/client.key
$ chmod 600 ~/.vsql/client.key ~/.vsql/client.crt
$ chown -R bob ~/.vsql ~/.vsql/client.key ~/.vsql/client.crt
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../en/sql-reference/statements/create-statements/create-authentication/&#34;&gt;Create&lt;/a&gt; the &lt;code&gt;tls&lt;/code&gt; authentication record:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE AUTHENTICATION v_tls_auth METHOD &amp;#39;tls&amp;#39; HOST TLS &amp;#39;0.0.0.0/0&amp;#39;;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;../../../../en/sql-reference/statements/grant-statements/grant-authentication/&#34;&gt;Grant&lt;/a&gt; the authentication record to &lt;code&gt;Bob&lt;/code&gt; or one of his &lt;a href=&#34;../../../../en/admin/db-users-and-privileges/db-roles/enabling-roles-automatically/&#34;&gt;default roles&lt;/a&gt;:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; GRANT AUTHENTICATION v_tls_auth TO Bob;
&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&#34;reject-plaintext-connections&#34;&gt;Reject plaintext connections&lt;/h2&gt;
&lt;p&gt;You can create an authentication record that rejects remote connections from a specified IP range.&lt;/p&gt;
&lt;p&gt;For example, to reject all plaintext client connections, specify the &lt;code&gt;reject&lt;/code&gt; authentication method and the &lt;code&gt;HOST NO TLS&lt;/code&gt; access method as follows:&lt;/p&gt;
&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;=&amp;gt; CREATE AUTHENTICATION RejectNoSSL METHOD &amp;#39;reject&amp;#39; HOST NO TLS &amp;#39;0.0.0.0/0&amp;#39;;  --IPv4
=&amp;gt; CREATE AUTHENTICATION RejectNoSSL METHOD &amp;#39;reject&amp;#39; HOST NO TLS &amp;#39;::/0&amp;#39;;       --IPv6
&lt;/code&gt;&lt;/pre&gt;

      </description>
    </item>
    
  </channel>
</rss>
