blob: 67c9d3dab71b5ae14c22ff8a7882a6cde5888de4 [file] [log] [blame]
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<section id="chap-Messaging_User_Guide-Security">
<title>Security</title>
<para>
This chapter describes how authentication, rule-based authorization, encryption, and digital signing can be accomplished using Qpid. Authentication is the process of verifying the identity of a user; in Qpid, this is done using the SASL framework. Rule-based authorization is a mechanism for specifying the actions that each user is allowed to perform; in Qpid, this is done using an Access Control List (ACL) that is part of the Qpid broker. Encryption is used to ensure that data is not transferred in a plain-text format that could be intercepted and read. Digital signatures provide proof that a given message was sent by a known sender. Encryption and signing are done using SSL (they can also be done using SASL, but SSL provides stronger encryption).
</para>
<section id="sect-Messaging_User_Guide-Security-User_Authentication">
<title>User Authentication</title>
<para>
AMQP uses Simple Authentication and Security Layer (SASL) to authenticate client connections to the broker. SASL is a framework that supports a variety of authentication methods. For secure applications, we suggest <command>CRAM-MD5</command>, <command>DIGEST-MD5</command>, or <command>GSSAPI</command>. The <command>ANONYMOUS</command> method is not secure. The <command>PLAIN</command> method is secure only when used together with SSL.
</para>
<para>
Both the Qpid broker and Qpid clients use the <ulink url="http://cyrusimap.web.cmu.edu/">Cyrus SASL library</ulink>, a full-featured authentication framework, which offers many configuration options. This section shows how to configure users for authentication with SASL, which is sufficient when using <command>SASL PLAIN</command>. If you are not using SSL, you should configure SASL to use <command>CRAM-MD5</command>, <command>DIGEST-MD5</command>, or <command>GSSAPI</command> (which provides Kerberos authentication). For information on configuring these and other options in SASL, see the Cyrus SASL documentation<!-- at <filename>/usr/share/doc/cyrus-sasl-lib-2.1.22/index.html</filename> for &RHEL5; or <filename>/usr/share/doc/cyrus-sasl-2.1.19/index.html</filename> for &RHEL4;-->.
</para>
<important>
<title>Important</title>
<para>
The <command>SASL PLAIN</command> method sends passwords in cleartext, and is vulnerable to man-in-the-middle attacks unless SSL (Secure Socket Layer) is also used (see <xref linkend="sect-Messaging_User_Guide-Security-Encryption_using_SSL" />).
</para>
<para>
If you are not using SSL, we recommend that you disable <command>PLAIN</command> authentication in the broker.
</para>
</important>
<para>
The Qpid broker uses the <command>auth yes|no</command> option to determine whether to use SASL authentication. Turn on authentication by setting <command>auth</command> to <command>yes</command> in <filename>/etc/qpidd.conf</filename>:
</para>
<programlisting>
# /etc/qpidd.conf
#
# Set auth to &#39;yes&#39; or &#39;no&#39;
auth=yes
</programlisting>
<section id="sect-Messaging_User_Guide-User_Authentication-Configuring_SASL">
<title>Configuring SASL</title>
<para>
On Linux systems, the SASL configuration file is generally found in <filename>/etc/sasl2/qpidd.conf</filename> <!-- for &RHEL5; and-->or <filename>/usr/lib/sasl2/qpidd.conf</filename><!-- for &RHEL4;-->.
</para>
<para>
The SASL database contains user names and passwords for SASL. In SASL, a user may be associated with a <firstterm>realm</firstterm>. The Qpid broker authenticates users in the <command>QPID</command> realm by default, but it can be set to a different realm using the <command>realm</command> option:
</para>
<programlisting>
# /etc/qpidd.conf
#
# Set the SASL realm using &#39;realm=&#39;
auth=yes
realm=QPID
</programlisting>
<para>
The SASL database is installed at <filename>/var/lib/qpidd/qpidd.sasldb</filename>; initially, it has one user named <command>guest</command> in the <command>QPID</command> realm, and the password for this user is <command>guest</command>.
</para>
<note>
<title>Note</title>
<para>
The user database is readable only by the <systemitem class="username">qpidd</systemitem> user. When run as a daemon, Qpid always runs as the <systemitem class="username">qpidd</systemitem> user. If you start the broker from a user other than the <systemitem class="username">qpidd</systemitem> user, you will need to either reconfigure SASL or turn authentication off.
</para>
</note>
<important>
<title>Important</title>
<para>
The SASL database stores user names and passwords in plain text. If it is compromised so are all of the passwords that it stores. This is the reason that the <systemitem class="username">qpidd</systemitem> user is the only user that can read the database. If you modify permissions, be careful not to expose the SASL database.
</para>
</important>
<para>
Add new users to the database by using the <command>saslpasswd2</command> command, which specifies a realm and a user ID. A user ID takes the form <command><replaceable>user-id</replaceable>@<replaceable>domain</replaceable>.</command>.
</para>
<screen># saslpasswd2 -f /var/lib/qpidd/qpidd.sasldb -u <replaceable>realm</replaceable> <replaceable>new_user_name</replaceable></screen>
<para>
To list the users in the SASL database, use <command>sasldblistusers2</command>:
</para>
<screen># sasldblistusers2 -f /var/lib/qpidd/qpidd.sasldb
</screen>
<para>
If you are using <command>PLAIN</command> authentication, users who are in the database can now connect with their user name and password. This is secure only if you are using SSL. If you are using a more secure form of authentication, please consult your SASL documentation for information on configuring the options you need.
</para>
</section>
<section id="sect-Messaging_User_Guide-User_Authentication-Kerberos">
<title>Kerberos</title>
<para>
Both the Qpid broker and Qpid users are &#39;principals&#39; of the Kerberos server, which means that they are both clients of the Kerberos authentication services.
</para>
<para>
To use Kerberos, both the Qpid broker and each Qpid user must be authenticated on the Kerberos server:
</para>
<procedure>
<step>
<para>
Install the Kerberos workstation software and Cyrus SASL GSSAPI on each machine that runs a qpidd broker or a qpidd messaging client:
</para>
<screen>$ sudo yum install cyrus-sasl-gssapi krb5-workstation</screen>
</step>
<step>
<para>
Make sure that the Qpid broker is registered in the Kerberos database.
</para>
<para>
Traditionally, a Kerberos principal is divided into three parts: the primary, the instance, and the realm. A typical Kerberos V5 has the format <literal>primary/instance@REALM</literal>. For a Qpid broker, the primary is <literal>qpidd</literal>, the instance is the fully qualified domain name, which you can obtain using <command>hostname --fqdn</command>, and the REALM is the Kerberos domain realm. By default, this realm is <literal>QPID</literal>, but a different realm can be specified in qpid.conf, e.g.:
<screen>realm=EXAMPLE.COM</screen>
</para>
<para>
For instance, if the fully qualified domain name is <literal>dublduck.example.com</literal> and the Kerberos domain realm is <literal>EXAMPLE.COM</literal>, then the principal name is <literal>qpidd/dublduck.example.com@EXAMPLE.COM</literal>.
</para>
<para>
The following script creates a principal for qpidd:
</para>
<programlisting>
FDQN=`hostname --fqdn`
REALM=&#34;EXAMPLE.COM&#34;
kadmin -r $REALM -q &#34;addprinc -randkey -clearpolicy qpidd/$FQDN&#34;
</programlisting>
<para>
Now create a Kerberos keytab file for the Qpid broker. The Qpid broker must have read access to the keytab file. The following script creates a keytab file and allows the broker read access:
</para>
<programlisting>
QPIDD_GROUP=&#34;qpidd&#34;
kadmin -r $REALM -q &#34;ktadd -k /etc/qpidd.keytab qpidd/$FQDN@$REALM&#34;
chmod g+r /etc/qpidd.keytab
chgrp $QPIDD_GROUP /etc/qpidd.keytab
</programlisting>
<para>
The default location for the keytab file is <filename>/etc/krb5.keytab</filename>. If a different keytab file is used, the KRB5_KTNAME environment variable must contain the name of the file, e.g.:
</para>
<programlisting>
export KRB5_KTNAME=/etc/qpidd.keytab
</programlisting>
<para>
If this is correctly configured, you can now enable kerberos support on the Qpid broker by setting the <varname>auth</varname> and <varname>realm</varname> options in <filename>/etc/qpidd.conf</filename>:
</para>
<programlisting>
# /etc/qpidd.conf
auth=yes
realm=EXAMPLE.COM
</programlisting>
<para>
Restart the broker to activate these settings.
</para>
</step>
<step>
<para>
Make sure that each Qpid user is registered in the Kerberos database, and that Kerberos is correctly configured on the client machine. The Qpid user is the account from which a Qpid messaging client is run. If it is correctly configured, the following command should succeed:
</para>
<screen>$ kinit user@REALM.COM</screen>
</step>
</procedure>
<para>
Java JMS clients require a few additional steps.
</para>
<procedure>
<step>
<para>
The Java JVM must be run with the following arguments:
</para>
<variablelist>
<varlistentry>
<term>-Djavax.security.auth.useSubjectCredsOnly=false</term>
<listitem>
<para>
Forces the SASL GASSPI client to obtain the kerberos credentials explicitly instead of obtaining from the &#34;subject&#34; that owns the current thread.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>-Djava.security.auth.login.config=myjas.conf</term>
<listitem>
<para>
Specifies the jass configuration file. Here is a sample JASS configuration file:
</para>
<programlisting>
com.sun.security.jgss.initiate {
com.sun.security.auth.module.Krb5LoginModule required useTicketCache=true;
};
</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term>-Dsun.security.krb5.debug=true</term>
<listitem>
<para>
Enables detailed debug info for troubleshooting
</para>
</listitem>
</varlistentry>
</variablelist>
</step>
<step>
<para>
The client&#39;s Connection URL must specify the following Kerberos-specific broker properties:
</para>
<itemizedlist>
<listitem>
<para>
<varname>sasl_mechs</varname> must be set to <literal>GSSAPI</literal>.
</para>
</listitem>
<listitem>
<para>
<varname>sasl_protocol</varname> must be set to the principal for the qpidd broker, e.g. <literal>qpidd</literal>/
</para>
</listitem>
<listitem>
<para>
<varname>sasl_server</varname> must be set to the host for the SASL server, e.g. <literal>sasl.com</literal>.
</para>
</listitem>
</itemizedlist>
<para>
Here is a sample connection URL for a Kerberos connection:
</para>
<screen>amqp://guest@clientid/testpath?brokerlist=&#39;tcp://localhost:5672?sasl_mechs=&#39;GSSAPI&#39;&amp;sasl_protocol=&#39;qpidd&#39;&amp;sasl_server=&#39;&#60;server-host-name&#62;&#39;&#39;</screen>
</step>
</procedure>
<!--
<para>
Please refer to the following documentation for more detail on using Kerberos:
</para>
<variablelist>
<varlistentry>
<term>RHEL5</term>
<listitem>
<para>
<ulink url="http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Deployment_Guide-en-US/ch-kerberos.html"> Red Hat Enterprise Linux 5: Deployment Guide </ulink>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>RHEL4</term>
<listitem>
<para>
<ulink url="http://www.redhat.com/docs/manuals/enterprise/RHEL-4-Manual/ref-guide/ch-kerberos.html"> Red Hat Enterprise Linux 4: Reference Guide </ulink>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Java</term>
<listitem>
<para>
<ulink url="http://java.sun.com/j2se/1.5.0/docs/guide/security/jgss/tutorials/index.html"> Introduction to JAAS and Java GSS-API Tutorials </ulink>
</para>
</listitem>
</varlistentry>
</variablelist>
-->
</section>
</section>
<!-- ################################################### --> <section id="sect-Messaging_User_Guide-Security-Authorization">
<title>Authorization</title>
<para>
In Qpid, Authorization specifies which actions can be performed by each authenticated user using an Access Control List (ACL).
</para>
<para>
Use the <command>--acl-file</command> command to load the access control list. The filename should have a <filename>.acl</filename> extension:
</para>
<screen>
$ qpidd --acl-file <replaceable>./aclfilename.acl</replaceable></screen>
<para>
Each line in an ACL file grants or denies specific rights to a user. If the last line in an ACL file is <literal>acl deny all all</literal>, the ACL uses <firstterm>deny mode</firstterm>, and only those rights that are explicitly allowed are granted:
</para>
<programlisting>
acl allow rajith@QPID all all
acl deny all all
</programlisting>
<para>
On this server, <literal>rajith@QPID</literal> can perform any action, but nobody else can. Deny mode is the default, so the previous example is equivalent to the following ACL file:
</para>
<programlisting>
acl allow rajith@QPID all all
</programlisting>
<para>
Alternatively the ACL file may use <firstterm>allow mode</firstterm> by placing:
</para>
<programlisting>
acl allow all all
</programlisting>
<para>
as the final line in the ACL file. In <emphasis>allow mode</emphasis> all actions by all users are allowed unless otherwise denied by specific ACL rules.
The ACL rule which selects <emphasis>deny mode</emphasis> or <emphasis>allow mode</emphasis> must be the last line in the ACL rule file.
</para>
<para>
ACL syntax allows fine-grained access rights for specific actions:
</para>
<programlisting>
acl allow carlt@QPID create exchange name=carl.*
acl allow fred@QPID create all
acl allow all consume queue
acl allow all bind exchange
acl deny all all
</programlisting>
<para>
An ACL file can define user groups, and assign permissions to them:
</para>
<programlisting>
group admin ted@QPID martin@QPID
acl allow admin create all
acl deny all all
</programlisting>
<para>
Performance Note: Most ACL queries are performed infrequently. The overhead associated with
ACL passing an allow or deny decision on the creation of a queue is negligible
compared to actually creating and using the queue. One notable exception is the <command>publish exchange</command>
query. ACL files with no <emphasis>publish exchange</emphasis> rules are noted and the broker short circuits the logic
associated with the per-messsage <emphasis>publish exchange</emphasis> ACL query.
However, if an ACL file has any <emphasis>publish exchange</emphasis> rules
then the broker is required to perform a <emphasis>publish exchange</emphasis> query for each message published.
Users with performance critical applications are encouraged to structure exchanges, queues, and bindings so that
the <emphasis>publish exchange</emphasis> ACL rules are unnecessary.
</para>
<!-- ######## --> <section id="sect-Messaging_User_Guide-Authorization-ACL_Syntax">
<title>ACL Syntax</title>
<para>
ACL rules must be on a single line and follow this syntax:
<programlisting><![CDATA[
user = username[/domain[@realm]]
user-list = user1 user2 user3 ...
group-name-list = group1 group2 group3 ...
group <group-name> = [user-list] [group-name-list]
permission = [allow | allow-log | deny | deny-log]
action = [consume | publish | create | access |
bind | unbind | delete | purge | update]
object = [queue | exchange | broker | link | method]
property = [name | durable | owner | routingkey |
autodelete | exclusive |type |
alternate | queuename |
schemapackage | schemaclass |
queuemaxsizelowerlimit |
queuemaxsizeupperlimit |
queuemaxcountlowerlimit |
queuemaxcountupperlimit |
filemaxsizelowerlimit |
filemaxsizeupperlimit |
filemaxcountlowerlimit |
filemaxcountupperlimit ]
acl permission {<group-name>|<user-name>|"all"} {action|"all"} [object|"all"
[property=<property-value> ...]]
]]></programlisting>
ACL rules can also include a single object name (or the keyword <parameter>all</parameter>) and one or more property name value pairs in the form <command>property=value</command>
</para>
<para>
The following tables show the possible values for <command>permission</command>, <command>action</command>, <command>object</command>, and <command>property</command> in an ACL rules file.
</para>
<table id="tabl-Messaging_User_Guide-ACL_Syntax-ACL_Rules_permission">
<title>ACL Rules: permission</title>
<tgroup cols="2">
<tbody>
<row>
<entry>
<command>allow</command>
</entry>
<entry>
<para>
Allow the action <!-- ### rule => the action -->
</para>
</entry>
</row>
<row>
<entry>
<command>allow-log</command>
</entry>
<entry>
<para>
Allow the action and log the action in the event log
</para>
</entry>
</row>
<row>
<entry>
<command>deny</command>
</entry>
<entry>
<para>
Deny the action
</para>
</entry>
</row>
<row>
<entry>
<command>deny-log</command>
</entry>
<entry>
<para>
Deny the action and log the action in the event log
</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
<!-- Actions --> <table id="tabl-Messaging_User_Guide-ACL_Syntax-ACL_Rulesaction">
<title>ACL Rules:action</title>
<tgroup cols="2">
<tbody>
<row>
<entry>
<command>consume</command>
</entry>
<entry>
<para>
Applied when subscriptions are created
</para>
</entry>
</row>
<row>
<entry>
<command>publish</command>
</entry>
<entry>
<para>
Applied on a per message basis
to verify that the user has rights to publish to the given
exchange with the given routingkey.
</para>
</entry>
</row>
<row>
<entry>
<command>create</command>
</entry>
<entry>
<para>
Applied when an object is created, such as bindings, queues, exchanges, links
</para>
</entry>
</row>
<row>
<entry>
<command>access</command>
</entry>
<entry>
<para>
Applied when an object is read or accessed
</para>
</entry>
</row>
<row>
<entry>
<command>bind</command>
</entry>
<entry>
<para>
Applied when objects are bound together
</para>
</entry>
</row>
<row>
<entry>
<command>unbind</command>
</entry>
<entry>
<para>
Applied when objects are unbound
</para>
</entry>
</row>
<row>
<entry>
<command>delete</command>
</entry>
<entry>
<para>
Applied when objects are deleted
</para>
</entry>
</row>
<row>
<entry>
<command>purge</command>
</entry>
<entry>
<para>
Similar to delete but the action is performed on more than one object
</para>
</entry>
</row>
<row>
<entry>
<command>update</command>
</entry>
<entry>
<para>
Applied when an object is updated
</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
<!-- object types --> <table id="tabl-Messaging_User_Guide-ACL_Syntax-ACL_Rulesobject">
<title>ACL Rules:object</title>
<tgroup cols="2">
<tbody>
<row>
<entry>
<command>queue</command>
</entry>
<entry>
<para>
A queue
</para>
</entry>
</row>
<row>
<entry>
<command>exchange</command>
</entry>
<entry>
<para>
An exchange
</para>
</entry>
</row>
<row>
<entry>
<command>broker</command>
</entry>
<entry>
<para>
The broker
</para>
</entry>
</row>
<row>
<entry>
<command>link</command>
</entry>
<entry>
<para>
A federation or inter-broker link
</para>
</entry>
</row>
<row>
<entry>
<command>method</command>
</entry>
<entry>
<para>
Management or agent or broker method
</para>
</entry>
</row>
</tbody>
</tgroup>
</table>
<!--
<para>
Wild cards can be used on properties that are a string. The following properties are supported: --> <table id="tabl-Messaging_User_Guide-ACL_Syntax-ACL_Rulesproperty">
<title>ACL Rules:property</title>
<tgroup cols="4">
<thead>
<row>
<entry>Property</entry>
<entry>Type</entry>
<entry>Description</entry>
<entry>Usage</entry>
</row>
</thead>
<tbody>
<row>
<entry> <command>name</command> </entry>
<entry>String</entry>
<entry>Object name, such as a queue name or exchange name.</entry>
<entry></entry>
</row>
<row>
<entry> <command>durable</command> </entry>
<entry>Boolean</entry>
<entry>Indicates the object is durable</entry>
<entry>CREATE QUEUE, CREATE EXCHANGE, ACCESS QUEUE, ACCESS EXCHANGE</entry>
</row>
<row>
<entry> <command>routingkey</command> </entry>
<entry>String</entry>
<entry>Specifies routing key</entry>
<entry>BIND EXCHANGE, UNBIND EXCHANGE, ACCESS EXCHANGE, PUBLISH EXCHANGE</entry>
</row>
<row>
<entry> <command>autodelete</command> </entry>
<entry>Boolean</entry>
<entry>Indicates whether or not the object gets deleted when the connection is closed</entry>
<entry>CREATE QUEUE, ACCESS QUEUE</entry>
</row>
<row>
<entry> <command>exclusive</command> </entry>
<entry>Boolean</entry>
<entry>Indicates the presence of an <parameter>exclusive</parameter> flag</entry>
<entry>CREATE QUEUE, ACCESS QUEUE</entry>
</row>
<row>
<entry> <command>type</command> </entry>
<entry>String</entry>
<entry>Type of exchange, such as topic, fanout, or xml</entry>
<entry>CREATE EXCHANGE, ACCESS EXCHANGE</entry>
</row>
<row>
<entry> <command>alternate</command> </entry>
<entry>String</entry>
<entry>Name of the alternate exchange</entry>
<entry>CREATE EXCHANGE, CREATE QUEUE, ACCESS EXCHANGE, ACCESS QUEUE</entry>
</row>
<row>
<entry> <command>queuename</command> </entry>
<entry>String</entry>
<entry>Name of the queue</entry>
<entry>ACCESS EXCHANGE, BIND EXCHANGE, UNBIND EXCHANGE</entry>
</row>
<row>
<entry> <command>schemapackage</command> </entry>
<entry>String</entry>
<entry>QMF schema package name</entry>
<entry>ACCESS METHOD</entry>
</row>
<row>
<entry> <command>schemaclass</command> </entry>
<entry>String</entry>
<entry>QMF schema class name</entry>
<entry>ACCESS METHOD</entry>
</row>
<row>
<entry> <command>queuemaxsizelowerlimit</command> </entry>
<entry>Integer</entry>
<entry>Minimum value for queue.max_size (memory bytes)</entry>
<entry>CREATE QUEUE, ACCESS QUEUE</entry>
</row>
<row>
<entry> <command>queuemaxsizeupperlimit</command> </entry>
<entry>Integer</entry>
<entry>Maximum value for queue.max_size (memory bytes)</entry>
<entry>CREATE QUEUE, ACCESS QUEUE</entry>
</row>
<row>
<entry> <command>queuemaxcountlowerlimit</command> </entry>
<entry>Integer</entry>
<entry>Minimum value for queue.max_count (messages)</entry>
<entry>CREATE QUEUE, ACCESS QUEUE</entry>
</row>
<row>
<entry> <command>queuemaxcountupperlimit</command> </entry>
<entry>Integer</entry>
<entry>Maximum value for queue.max_count (messages)</entry>
<entry>CREATE QUEUE, ACCESS QUEUE</entry>
</row>
<row>
<entry> <command>filemaxsizelowerlimit</command> </entry>
<entry>Integer</entry>
<entry>Minimum value for file.max_size (64kb pages)</entry>
<entry>CREATE QUEUE, ACCESS QUEUE</entry>
</row>
<row>
<entry> <command>filemaxsizeupperlimit</command> </entry>
<entry>Integer</entry>
<entry>Maximum value for file.max_size (64kb pages)</entry>
<entry>CREATE QUEUE, ACCESS QUEUE</entry>
</row>
<row>
<entry> <command>filemaxcountlowerlimit</command> </entry>
<entry>Integer</entry>
<entry>Minimum value for file.max_count (files)</entry>
<entry>CREATE QUEUE, ACCESS QUEUE</entry>
</row>
<row>
<entry> <command>filemaxcountupperlimit</command> </entry>
<entry>Integer</entry>
<entry>Maximum value for file.max_count (files)</entry>
<entry>CREATE QUEUE, ACCESS QUEUE</entry>
</row>
</tbody>
</tgroup>
</table>
<section id="sect-Messaging_User_Guide-Authorization-ACL_ActionObjectPropertyTuples">
<title>ACL Action-Object-Property Tuples</title>
<para>
Not every ACL action is applicable to every ACL object. Furthermore, not every property may be
specified for every action-object pair.
The following table enumerates which action and object pairs are allowed.
The table also lists which optional ACL properties are allowed to qualify
action-object pairs.
</para>
<para>
The <emphasis>access</emphasis> action is called with different argument
lists for the <emphasis>exchange</emphasis> and <emphasis>queue</emphasis> objects.
A separate column shows the AMQP 0.10 method that the Access ACL rule is satisfying.
Write separate rules with the additional arguments for the <emphasis>declare</emphasis>
and <emphasis>bind</emphasis> methods and include these rules in the ACL file
before the rules for the <emphasis>query</emphasis> method.
<!-- The exact sequence of calling these methods is a product of the client
library. The user might not know anything about a 'declare' or a 'query' or
a passive declaration. -->
</para>
<table id="tabl-Messaging_User_Guide-ACL_Syntax-ACL_ActionObject_properties">
<title>ACL Properties Allowed for each Action and Object</title>
<tgroup cols="4">
<thead>
<row>
<entry>Action</entry>
<entry>Object</entry>
<entry>Properties</entry>
<entry>Method</entry>
</row>
</thead>
<tbody>
<row>
<entry>access</entry>
<entry>broker</entry>
<entry></entry>
</row>
<row>
<entry>access</entry>
<entry>exchange</entry>
<entry>name type alternate durable</entry>
<entry>declare</entry>
</row>
<row>
<entry>access</entry>
<entry>exchange</entry>
<entry>name queuename routingkey</entry>
<entry>bound</entry>
</row>
<row>
<entry>access</entry>
<entry>exchange</entry>
<entry>name</entry>
<entry>query</entry>
</row>
<row>
<entry>access</entry>
<entry>method</entry>
<entry>name schemapackage schemaclass</entry>
<entry></entry>
</row>
<row>
<entry>access</entry>
<entry>queue</entry>
<entry>name alternate durable exclusive autodelete policy queuemaxsizelowerlimit queuemaxsizeupperlimit queuemaxcountlowerlimit queuemaxcountupperlimit filemaxsizelowerlimit filemaxsizeupperlimit filemaxcountlowerlimit filemaxcountupperlimit</entry>
<entry>declare</entry>
</row>
<row>
<entry>access</entry>
<entry>queue</entry>
<entry>name</entry>
<entry>query</entry>
</row>
<row>
<entry>bind</entry>
<entry>exchange</entry>
<entry>name queuename routingkey</entry>
<entry></entry>
</row>
<row>
<entry>consume</entry>
<entry>queue</entry>
<entry>name</entry>
<entry></entry>
</row>
<row>
<entry>create</entry>
<entry>exchange</entry>
<entry>name type alternate durable</entry>
<entry></entry>
</row>
<row>
<entry>create</entry>
<entry>link</entry>
<entry>name</entry>
<entry></entry>
</row>
<row>
<entry>create</entry>
<entry>queue</entry>
<entry>name alternate durable exclusive autodelete policy queuemaxsizelowerlimit queuemaxsizeupperlimit queuemaxcountlowerlimit queuemaxcountupperlimit filemaxsizelowerlimit filemaxsizeupperlimit filemaxcountlowerlimit filemaxcountupperlimit</entry>
<entry></entry>
</row>
<row>
<entry>delete</entry>
<entry>exchange</entry>
<entry>name</entry>
<entry></entry>
</row>
<row>
<entry>delete</entry>
<entry>queue</entry>
<entry>name</entry>
<entry></entry>
</row>
<row>
<entry>publish</entry>
<entry>exchange</entry>
<entry>name routingkey</entry>
<entry></entry>
</row>
<row>
<entry>purge</entry>
<entry>queue</entry>
<entry>name</entry>
<entry></entry>
</row>
<row>
<entry>unbind</entry>
<entry>exchange</entry>
<entry>name queuename routingkey</entry>
<entry></entry>
</row>
<row>
<entry>update</entry>
<entry>broker</entry>
<entry></entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>
<para>
</para>
</section>
</section>
<section id="sect-Messaging_User_Guide-Authorization-ACL_Syntactic_Conventions">
<title>ACL Syntactic Conventions</title>
<section id="sect-Messaging_User_Guide-Authorization-ACL_Syntactic_Conventions-comments">
<title>Comments</title>
<para>
<itemizedlist>
<listitem>
<para>
A line starting with the <command>#</command> character is considered a comment and is ignored.
</para>
</listitem>
<listitem>
<para>
Embedded comments and trailing comments are not allowed. The <command>#</command> is commonly found in routing keys and other AMQP literals which occur naturally in ACL rule specifications.
</para>
</listitem>
</itemizedlist>
</para>
</section>
<section id="sect-Messaging_User_Guide-Authorization-ACL_Syntactic_Conventions-whitespace">
<title>White Space</title>
<itemizedlist>
<listitem>
<para>
Empty lines and lines that contain only whitespace (' ', '\f', '\n', '\r', '\t', '\v') are ignored.
</para>
</listitem>
<listitem>
<para>
Additional whitespace between and after tokens is allowed.
</para>
</listitem>
<listitem>
<para>
Group and Acl definitions must start with <command>group</command> and <command>acl</command> respectively and with no preceding whitespace.
</para>
</listitem>
</itemizedlist>
</section>
<section id="sect-Messaging_User_Guide-Authorization-ACL_Syntactic_Conventions-characterset">
<title>Character Set</title>
<itemizedlist>
<listitem>
<para>
ACL files use 7-bit ASCII characters only
</para>
</listitem>
<listitem>
<para>
Group names may contain only
<itemizedlist>
<listitem><command>[a-z]</command></listitem>
<listitem><command>[A-Z]</command></listitem>
<listitem><command>[0-9]</command></listitem>
<listitem><command>'-'</command> hyphen</listitem>
<listitem><command>'_'</command> underscore</listitem>
</itemizedlist>
</para>
</listitem>
<listitem>
<para>
Individual user names may contain only
<itemizedlist>
<listitem><command>[a-z]</command></listitem>
<listitem><command>[A-Z]</command></listitem>
<listitem><command>[0-9]</command></listitem>
<listitem><command>'-'</command> hyphen</listitem>
<listitem><command>'_'</command> underscore</listitem>
<listitem><command>'.'</command> period</listitem>
<listitem><command>'@'</command> ampersand</listitem>
<listitem><command>'/'</command> slash</listitem>
</itemizedlist>
</para>
</listitem>
</itemizedlist>
</section>
<section id="sect-Messaging_User_Guide-Authorization-ACL_Syntactic_Conventions-casesensitivity">
<title>Case Sensitivity</title>
<itemizedlist>
<listitem>
<para>
All tokens are case sensitive. <parameter>name1</parameter> is not the same as <parameter>Name1</parameter> and <parameter>create</parameter> is not the same as <parameter>CREATE</parameter>.
</para>
</listitem>
</itemizedlist>
</section>
<section id="sect-Messaging_User_Guide-Authorization-ACL_Syntactic_Conventions-linecontinuation">
<title>Line Continuation</title>
<itemizedlist>
<listitem>
<para>
Group lists can be extended to the following line by terminating the line with the <command>'\'</command> character. No other ACL file lines may be continued.
</para>
</listitem>
<listitem>
<para>
Group specification lines may be continued only after the group name or any of the user names included in the group. See example below.
</para>
</listitem>
<listitem>
<para>
Lines consisting solely of a <command>'\'</command> character are not permitted.
</para>
</listitem>
<listitem>
<para>
The <command>'\'</command> continuation character is recognized only if it is the last character in the line. Any characters after the <command>'\'</command> are not permitted.
</para>
</listitem>
</itemizedlist>
<programlisting><![CDATA[
#
# Examples of extending group lists using a trailing '\' character
#
group group1 name1 name2 \
name3 name4 \
name5
group group2 \
group1 \
name6
#
# The following are illegal:
#
# '\' must be after group name
#
group \
group3 name7 name8
#
# No empty extension line
#
group group4 name9 \
\
name10
]]></programlisting>
</section>
<section id="sect-Messaging_User_Guide-Authorization-ACL_Syntactic_Conventions-linelength">
<title>Line Length</title>
<itemizedlist>
<listitem>
<para>
ACL file lines are limited to 1024 characters.
</para>
</listitem>
</itemizedlist>
</section>
<section id="sect-Messaging_User_Guide-Authorization-ACL_Syntactic_Conventions-keywords">
<title>ACL File Keywords</title>
ACL reserves several words for convenience and for context sensitive substitution.
<section id="sect-Messaging_User_Guide-Authorization-ACL_Syntactic_Conventions-keywords-all">
<title>The <command>all</command> Keyword</title>
The keyword <command>all</command> is reserved. It may be used in ACL rules to match all individuals and groups, all actions, or all objects.
<itemizedlist>
<listitem>acl allow all create queue</listitem>
<listitem>acl allow bob@QPID all queue</listitem>
<listitem>acl allow bob@QPID create all</listitem>
</itemizedlist>
</section>
<section id="sect-Messaging_User_Guide-Authorization-ACL_Syntactic_Conventions-keywords-userdomain">
<title>User Name and Domain Name Keywords</title>
<para>
In the C++ Broker 0.20 a simple set of user name and domain name substitution variable keyword tokens is defined. This provides administrators with an easy way to describe private or shared resources.
</para>
<para>
Symbol substitution is allowed in the ACL file anywhere that text is supplied for a property value.
</para>
<para>
In the following table an authenticated user named bob.user@QPID.COM has his substitution keywords expanded.
<table id="tabl-Messaging_User_Guide-ACL_Syntax-ACL_UsernameSubstitution">
<title>ACL User Name and Domain Name Substitution Keywords</title>
<tgroup cols="2">
<thead>
<row>
<entry>Keyword</entry>
<entry>Expansion</entry>
</row>
</thead>
<tbody>
<row>
<entry> <command>${userdomain}</command> </entry>
<entry>bob_user_QPID_COM</entry>
</row>
<row>
<entry> <command>${user}</command> </entry>
<entry>bob_user</entry>
</row>
<row>
<entry> <command>${domain}</command> </entry>
<entry>QPID_COM</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<itemizedlist>
<listitem>
The original user name has the period “.” and ampersand “@” characters translated into underscore “_”. This allows substitution to work when the substitution keyword is used in a routingkey in the Acl file.
</listitem>
<listitem>
The Acl processing matches ${userdomain} before matching either ${user} or ${domain}. Rules that specify the combination ${user}_${domain} will never match.
</listitem>
</itemizedlist>
</para>
<programlisting><![CDATA[
# Example:
#
# Administrators can set up Acl rule files that allow every user to create a
# private exchange, a private queue, and a private binding between them.
# In this example the users are also allowed to create private backup exchanges,
# queues and bindings. This effectively provides limits to user's exchange,
# queue, and binding creation and guarantees that each user gets exclusive
# access to these resources.
#
#
# Create primary queue and exchange:
#
acl allow all create queue name=$\{user}-work alternate=$\{user}-work2
acl deny all create queue name=$\{user}-work alternate=*
acl allow all create queue name=$\{user}-work
acl allow all create exchange name=$\{user}-work alternate=$\{user}-work2
acl deny all create exchange name=$\{user}-work alternate=*
acl allow all create exchange name=$\{user}-work
#
# Create backup queue and exchange
#
acl deny all create queue name=$\{user}-work2 alternate=*
acl allow all create queue name=$\{user}-work2
acl deny all create exchange name=$\{user}-work2 alternate=*
acl allow all create exchange name=$\{user}-work2
#
# Bind/unbind primary exchange
#
acl allow all bind exchange name=$\{user}-work routingkey=$\{user} queuename=$\{user}-work
acl allow all unbind exchange name=$\{user}-work routingkey=$\{user} queuename=$\{user}-work
#
# Bind/unbind backup exchange
#
acl allow all bind exchange name=$\{user}-work2 routingkey=$\{user} queuename=$\{user}-work2
acl allow all unbind exchange name=$\{user}-work2 routingkey=$\{user} queuename=$\{user}-work2
#
# Access primary exchange
#
acl allow all access exchange name=$\{user}-work routingkey=$\{user} queuename=$\{user}-work
#
# Access backup exchange
#
acl allow all access exchange name=$\{user}-work2 routingkey=$\{user} queuename=$\{user}-work2
#
# Publish primary exchange
#
acl allow all publish exchange name=$\{user}-work routingkey=$\{user}
#
# Publish backup exchange
#
acl allow all publish exchange name=$\{user}-work2 routingkey=$\{user}
#
# deny mode
#
acl deny all all
]]></programlisting>
</section>
</section>
<section id="sect-Messaging_User_Guide-Authorization-ACL_Syntatic_Conventions-wildcards">
<title>Wildcards</title>
ACL privides two types of wildcard matching to provide flexibility in writing rules.
<section id="sect-Messaging_User_Guide-Authorization-ACL_Syntatic_Conventions-wildcards-asterisk">
<title>Property Value Wildcard</title>
<para>
Text specifying a property value may end with a single trailing <command>*</command> character.
This is a simple wildcard match indicating that strings which match up to that point are matches for the ACL property rule.
An ACL rule such as
</para>
<para>
<programlisting> acl allow bob@QPID create queue name=bob*</programlisting>
</para>
<para>
allow user bob@QPID to create queues named bob1, bob2, bobQueue3, and so on.
</para>
</section>
<section id="sect-Messaging_User_Guide-Authorization-ACL_Syntatic_Conventions-wildcards-topickey">
<title>Topic Routing Key Wildcard</title>
<para>
In the C++ Broker 0.20 the logic governing the ACL Match has changed for each ACL rule that contains a routingkey property.
The routingkey property is matched according to Topic Exchange match logic the broker uses when it distributes messages published to a topic exchange.
</para>
<para>
Routing keys are hierarchical where each level is separated by a period:
<itemizedlist>
<listitem>weather.usa</listitem>
<listitem>weather.europe.germany</listitem>
<listitem>weather.europe.germany.berlin</listitem>
<listitem>company.engineering.repository</listitem>
</itemizedlist>
</para>
<para>
Within the routing key hierarchy two wildcard characters are defined.
<itemizedlist>
<listitem><command>*</command> matches one field</listitem>
<listitem><command>#</command> matches zero or more fields</listitem>
</itemizedlist>
</para>
<para>
Suppose an ACL rule file is:
</para>
<para>
<programlisting>
acl allow-log uHash1@COMPANY publish exchange name=X routingkey=a.#.b
acl deny all all
</programlisting>
</para>
<para>
When user uHash1@COMPANY attempts to publish to exchange X the ACL will return these results:
<table id="tabl-Messaging_User_Guide-ACL_Syntax-ACL_TopicExchangeMatch">
<title>Topic Exchange Wildcard Match Examples</title>
<tgroup cols="2">
<thead>
<row>
<entry>routingkey in publish to exchange X</entry>
<entry>result</entry>
</row>
</thead>
<tbody>
<row>
<entry> <command>a.b</command> </entry>
<entry>allow-log</entry>
</row>
<row>
<entry> <command>a.x.b</command> </entry>
<entry>allow-log</entry>
</row>
<row>
<entry> <command>a.x.y.zz.b</command> </entry>
<entry>allow-log</entry>
</row>
<row>
<entry> <command>a.b.</command> </entry>
<entry>deny</entry>
</row>
<row>
<entry> <command>q.x.b</command> </entry>
<entry>deny</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
</section>
</section>
</section>
<section id="sect-Messaging_User_Guide-Authorization-ACL_Rule_Matching">
<title>ACL Rule Matching</title>
<para>
The minimum matching criteria for ACL rules are:
<itemizedlist>
<listitem>An actor (individually named or group member)</listitem>
<listitem>An action</listitem>
<listitem>An object</listitem>
</itemizedlist>
</para>
<para>
If a rule does not match the minimum criteria then that rule does not control the ACL allow or deny decision.
</para>
<para>
ACL rules optionally specify object names and property name=value pairs. If an ACL rule specifies an object name or property values than all of them must match to cause the rule to match.
</para>
<para>
The following illustration shows how ACL rules are processed to find matching rules.
<programlisting><![CDATA[
# Example of rule matching
#
# Using this ACL file content:
(1) acl deny bob create exchange name=test durable=true passive=true
(2) acl deny bob create exchange name=myEx type=direct
(3) acl allow all all
#
# Lookup 1. id:bob action:create objectType:exchange name=test
# {durable=false passive=false type=direct alternate=}
#
# ACL Match Processing:
# 1. Rule 1 passes minimum criteria with user bob, action create,
# and object exchange.
# 2. Rule 1 matches name=test.
# 3. Rule 1 does not match the rule's durable=true with the requested
# lookup of durable=false.
# 4. Rule 1 does not control the decision and processing continues
# to Rule 2.
# 5. Rule 2 passes minimum criteria with user bob, action create,
# and object exchange.
# 6. Rule 2 does not match the rule's name=myEx with the requested
# lookup of name=test.
# 7. Rule 2 does not control the decision and processing continues
# to Rule 3.
# 8. Rule 3 matches everything and the decision is 'allow'.
#
# Lookup 2. id:bob action:create objectType:exchange name=myEx
# {durable=true passive=true type=direct alternate=}
#
# ACL Match Processing:
# 1. Rule 1 passes minimum criteria with user bob, action create,
# and object exchange.
# 2. Rule 1 does not match the rule's name=test with the requested
# lookup of name=myEx.
# 3. Rule 1 does not control the decision and processing continues
# to Rule 2.
# 4. Rule 2 passes minimum criteria with user bob, action create,
# and object exchange.
# 5. Rule 2 matches name=myEx.
# 6. Rule 2 matches the rule's type=direct with the requested
# lookup of type=direct.
# 7. Rule 2 is the matching rule and the decision is 'deny'.
#
]]></programlisting>
</para>
</section>
<section id="sect-Messaging_User_Guide-Authorization-Specifying_ACL_Permissions">
<title>Specifying ACL Permissions</title>
<para>
Now that we have seen the ACL syntax, we will provide representative examples and guidelines for ACL files.
</para>
<para>
Most ACL files begin by defining groups:
</para>
<programlisting>
group admin ted@QPID martin@QPID
group user-consume martin@QPID ted@QPID
group group2 kim@QPID user-consume rob@QPID
group publisher group2 \
tom@QPID andrew@QPID debbie@QPID
</programlisting>
<para>
Rules in an ACL file grant or deny specific permissions to users or groups:
</para>
<programlisting>
acl allow carlt@QPID create exchange name=carl.*
acl allow rob@QPID create queue
acl allow guest@QPID bind exchange name=amq.topic routingkey=stocks.rht.#
acl allow user-consume create queue name=tmp.*
acl allow publisher publish all durable=false
acl allow publisher create queue name=RequestQueue
acl allow consumer consume queue durable=true
acl allow fred@QPID create all
acl allow bob@QPID all queue
acl allow admin all
acl allow all consume queue
acl allow all bind exchange
acl deny all all
</programlisting>
<para>
In the previous example, the last line, <literal>acl deny all all</literal>, denies all authorizations that have not been specifically granted. This is the default, but it is useful to include it explicitly on the last line for the sake of clarity. If you want to grant all rights by default, you can specify <literal>acl allow all all</literal> in the last line.
</para>
<para>
ACL allows specification of conflicting rules. Be sure to specify the most specific rules first followed by more general rules. Here is an example:
</para>
<para>
<programlisting>
group users alice@QPID bob@QPID charlie@QPID
acl deny charlie@QPID create queue
acl allow users create queue
acl deny all all
</programlisting>
</para>
<para>
In this example users alice and bob would be able to create queues due to their membership in the users group. However, user charlie is denied from creating a queue despite his membership in the users group because a deny rule for him is stated before the allow rule for the users group.
</para>
<para>
Do not allow <parameter>guest</parameter> to access and log QMF management methods that could cause security breaches:
</para>
<programlisting>
group allUsers guest@QPID
...
acl deny-log allUsers create link
acl deny-log allUsers access method name=connect
acl deny-log allUsers access method name=echo
acl allow all all
</programlisting>
</section>
</section>
<section id="sect-Messaging_User_Guide-Authorization-Specifying_ACL_Quotas">
<title>User Connection and Queue Quotas</title>
The ACL module enforces various quotas and thereby limits user activity.
<section id="sect-Messaging_User_Guide-Authorization-Specifying_ACL_Connection_Limits">
<title>Connection Limits</title>
<para>
The ACL module creates broker command line switches that set limits on the number of concurrent connections allowed per user or per client host address. These settings are not specified in the ACL file.
</para>
<para>
<programlisting>
--max-connections N
--max-connections-per-user N
--max-connections-per-ip N
</programlisting>
</para>
<para>
If a switch is not specified or the value specified is zero then the corresponding connection limit is not enforced.
</para>
<para>
<command>max-connections</command> specifies an upper limit for all user connections.
</para>
<para>
<command>max-connections-per-user</command> specifies an upper limit for each user based on the authenticated user name. This limit is enforced regardless of the client IP address from which the connection originates.
</para>
<para>
<command>max-connections-per-ip</command> specifies an upper limit for connections for all users based on the originating client IP address. This limit is enforced regardless of the user credentials presented with the connection.
<itemizedlist>
<listitem>
Note that addresses using different transports are counted separately even though the originating host is actually the same physical machine. In the setting illustrated above a host would allow N_IP connections from [::1] IPv6 transport localhost and another N_IP connections from [127.0.0.1] IPv4 transport localhost.
</listitem>
<listitem>
The max-connections-per-ip and max-connections-per-user counts are active simultaneously. From a given client system users may be denied access to the broker by either connection limit.
</listitem>
</itemizedlist>
</para>
</section>
<section id="sect-Messaging_User_Guide-Authorization-Specifying_ACL_Queue_Limits">
<title>Queue Limits</title>
<para>
The ACL module creates a broker command line switch that set limits on the number of queues each user is allowed to create. This settings is not specified in the ACL file.
</para>
<para>
<programlisting>
--max-queues-per-user N
</programlisting>
</para>
<para>
If this switch is not specified or the value specified is zero then the queue limit is not enforced.
</para>
<para>
The queue limit is set for all users on the broker based on the authenticated user name.
</para>
</section>
</section>
<!-- ########################### --> <section id="sect-Messaging_User_Guide-Security-Encryption_using_SSL">
<title>Encryption using SSL</title>
<para>
Encryption and certificate management for <command>qpidd</command> is provided by Mozilla&#39;s Network Security Services Library (NSS).
</para>
<orderedlist id="orde-Messaging_User_Guide-Encryption_using_SSL-Enabling_SSL_for_the_RHM_broker">
<title>Enabling SSL for the Qpid broker</title>
<listitem>
<para>
You will need a certificate that has been signed by a Certification Authority (CA). This certificate will also need to be trusted by your client. If you require client authentication in addition to server authentication, the client&#39;s certificate will also need to be signed by a CA and trusted by the broker.
</para>
<para>
In the broker, SSL is provided through the <command>ssl.so</command> module. This module is installed and loaded by default in Qpid. To enable the module, you need to specify the location of the database containing the certificate and key to use. This is done using the <command>ssl-cert-db</command> option.
</para>
<para>
The certificate database is created and managed by the Mozilla Network Security Services (NSS) <command>certutil</command> tool. Information on this utility can be found on the <ulink url="http://www.mozilla.org/projects/security/pki/nss/tools/certutil.html">Mozilla website</ulink>, including tutorials on setting up and testing SSL connections. The certificate database will generally be password protected. The safest way to specify the password is to place it in a protected file, use the password file when creating the database, and specify the password file with the <command>ssl-cert-password-file</command> option when starting the broker.
</para>
<para>
The following script shows how to create a certificate database using certutil:
</para>
<!-- TODO: improve description -->
<programlisting>
mkdir ${CERT_DIR}
certutil -N -d ${CERT_DIR} -f ${CERT_PW_FILE}
certutil -S -d ${CERT_DIR} -n ${NICKNAME} -s &#34;CN=${NICKNAME}&#34; -t &#34;CT,,&#34; -x -f ${CERT_PW_FILE} -z /usr/bin/certutil
</programlisting>
<para>
When starting the broker, set <command>ssl-cert-password-file</command> to the value of <command>${CERT_PW_FILE}</command>, set <command>ssl-cert-db</command> to the value of <command>${CERT_DIR}</command>, and set <command>ssl-cert-name</command> to the value of <command>${NICKNAME}</command>.
</para>
</listitem>
<!-- SSL options --> <listitem>
<para>
The following SSL options can be used when starting the broker:
<variablelist>
<varlistentry>
<term><command>--ssl-use-export-policy</command></term>
<listitem>
<para>
Use NSS export policy
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>--ssl-cert-password-file <replaceable>PATH</replaceable></command></term>
<listitem>
<para>
Required. Plain-text file containing password to use for accessing certificate database.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>--ssl-cert-db <replaceable>PATH</replaceable></command></term>
<listitem>
<para>
Required. Path to directory containing certificate database.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>--ssl-cert-name <replaceable>NAME</replaceable></command></term>
<listitem>
<para>
Name of the certificate to use. Default is <literal>localhost.localdomain</literal>.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>--ssl-port <replaceable>NUMBER</replaceable></command></term>
<listitem>
<para>
Port on which to listen for SSL connections. If no port is specified, port 5671 is used.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>--ssl-require-client-authentication</command></term>
<listitem>
<para>
Require SSL client authentication (i.e. verification of a client certificate) during the SSL handshake. This occurs before SASL authentication, and is independent of SASL.
</para>
<para>
This option enables the <literal>EXTERNAL</literal> SASL mechanism for SSL connections. If the client chooses the <literal>EXTERNAL</literal> mechanism, the client&#39;s identity is taken from the validated SSL certificate, using the <literal>CN</literal>literal&#62;, and appending any <literal>DC</literal>literal&#62;s to create the domain. For instance, if the certificate contains the properties <literal>CN=bob</literal>, <literal>DC=acme</literal>, <literal>DC=com</literal>, the client&#39;s identity is <literal>bob@acme.com</literal>.
</para>
<para>
If the client chooses a different SASL mechanism, the identity take from the client certificate will be replaced by that negotiated during the SASL handshake.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><command>--ssl-sasl-no-dict</command></term>
<listitem>
<para>
Do not accept SASL mechanisms that can be compromised by dictionary attacks. This prevents a weaker mechanism being selected instead of <literal>EXTERNAL</literal>, which is not vulnerable to dictionary attacks.
</para>
</listitem>
</varlistentry>
</variablelist>
Also relevant is the <command>--require-encryption</command> broker option. This will cause <command>qpidd</command> to only accept encrypted connections.
</para>
</listitem>
</orderedlist>
<!-- --> <variablelist id="vari-Messaging_User_Guide-Encryption_using_SSL-Enabling_SSL_in_Clients">
<title>Enabling SSL in Clients</title>
<varlistentry>
<term>C++ clients:</term>
<listitem>
<para>
<orderedlist>
<listitem>
<para>
In C++ clients, SSL is implemented in the <command>sslconnector.so</command> module. This module is installed and loaded by default in Qpid.
</para>
<para>
The following options can be specified for C++ clients using environment variables:
</para>
<table frame="all" id="tabl-Messaging_User_Guide-Enabling_SSL_in_Clients-SSL_Client_Environment_Variables_for_C_clients">
<title>SSL Client Environment Variables for C++ clients</title>
<tgroup align="left" cols="2" colsep="1" rowsep="1">
<colspec colname="c1"></colspec>
<colspec colname="c2"></colspec>
<thead>
<row>
<entry align="center" nameend="c2" namest="c1">
SSL Client Options for C++ clients
</entry>
</row>
</thead>
<tbody>
<row>
<entry>
<command>QPID_SSL_USE_EXPORT_POLICY</command>
</entry>
<entry>
Use NSS export policy
</entry>
</row>
<row>
<entry>
<command>QPID_SSL_CERT_PASSWORD_FILE <replaceable>PATH</replaceable></command>
</entry>
<entry>
File containing password to use for accessing certificate database
</entry>
</row>
<row>
<entry>
<command>QPID_SSL_CERT_DB <replaceable>PATH</replaceable></command>
</entry>
<entry>
Path to directory containing certificate database
</entry>
</row>
<row>
<entry>
<command>QPID_SSL_CERT_NAME <replaceable>NAME</replaceable></command>
</entry>
<entry>
Name of the certificate to use. When SSL client authentication is enabled, a certificate name should normally be provided.
</entry>
</row>
</tbody>
</tgroup>
</table>
<!-- ######## -->
</listitem>
<listitem>
<para>
When using SSL connections, clients must specify the location of the certificate database, a directory that contains the client&#39;s certificate and the public key of the Certificate Authority. This can be done by setting the environment variable <command>QPID_SSL_CERT_DB</command> to the full pathname of the directory. If a connection uses SSL client authentication, the client&#39;s password is also needed&mdash;the password should be placed in a protected file, and the <command>QPID_SSL_CERT_PASSWORD_FILE</command> variable should be set to the location of the file containing this password.
</para>
</listitem>
<listitem>
<para>
To open an SSL enabled connection in the Qpid Messaging API, set the <parameter>protocol</parameter> connection option to <parameter>ssl</parameter>.
</para>
</listitem>
</orderedlist>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Java clients:</term>
<listitem>
<para>
<orderedlist>
<listitem>
<para>
For both server and client authentication, import the trusted CA to your trust store and keystore and generate keys for them. Create a certificate request using the generated keys and then create a certificate using the request. You can then import the signed certificate into your keystore. Pass the following arguments to the Java JVM when starting your client:
<programlisting>
-Djavax.net.ssl.keyStore=/home/bob/ssl_test/keystore.jks
-Djavax.net.ssl.keyStorePassword=password
-Djavax.net.ssl.trustStore=/home/bob/ssl_test/certstore.jks
-Djavax.net.ssl.trustStorePassword=password
</programlisting>
</para>
</listitem>
<listitem>
<para>
For server side authentication only, import the trusted CA to your trust store and pass the following arguments to the Java JVM when starting your client:
<programlisting>
-Djavax.net.ssl.trustStore=/home/bob/ssl_test/certstore.jks
-Djavax.net.ssl.trustStorePassword=password
</programlisting>
</para>
</listitem>
<listitem>
<para>
Java clients must use the SSL option in the connection URL to enable SSL encryption, e.g.
</para>
<programlisting>amqp://username:password@clientid/test?brokerlist=&#39;tcp://localhost:5672?ssl=&#39;true&#39;&#39;
</programlisting>
</listitem>
<listitem>
<para>
If you need to debug problems in an SSL connection, enable Java&#39;s SSL debugging by passing the argument <literal>-Djavax.net.debug=ssl</literal> to the Java JVM when starting your client.
</para>
</listitem>
</orderedlist>
</para>
</listitem>
</varlistentry>
</variablelist>
</section>
</section>