2012-09-06 23:46:47 +00:00
|
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
2013-08-06 10:32:54 +00:00
|
|
|
<section
|
2012-09-06 23:46:47 +00:00
|
|
|
xmlns="http://docbook.org/ns/docbook"
|
|
|
|
xmlns:xi="http://www.w3.org/2001/XInclude"
|
2013-08-06 10:32:54 +00:00
|
|
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
2012-09-06 23:46:47 +00:00
|
|
|
version="5.0"
|
|
|
|
xml:id="nova_cli_security_groups">
|
2013-07-16 21:10:17 +00:00
|
|
|
<title>Add security group and rules</title>
|
|
|
|
<para>The following procedure shows you how to add security
|
|
|
|
groups and add rules to the default security group.</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
<section xml:id="secgroup_add-delete">
|
|
|
|
<title>Add or delete a security group</title>
|
|
|
|
<para>Security groups can be added with <command>nova
|
2013-08-02 16:00:26 +00:00
|
|
|
secgroup-create</command>.</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
<para>The following example shows the creation of the
|
|
|
|
security group <literal>secure1</literal>. After the
|
|
|
|
group is created, it can be viewed in the security
|
|
|
|
group list.</para>
|
|
|
|
<para>
|
|
|
|
<screen>
|
|
|
|
<prompt>$</prompt> <userinput>nova secgroup-create secure1 "Test security group"</userinput>
|
|
|
|
+---------+---------------------+
|
|
|
|
| Name | Description |
|
|
|
|
+---------+---------------------+
|
|
|
|
| secure1 | Test security group |
|
|
|
|
+---------+---------------------+
|
|
|
|
|
|
|
|
<prompt>$</prompt> <userinput>nova secgroup-list</userinput>
|
|
|
|
+---------+---------------------+
|
|
|
|
| Name | Description |
|
|
|
|
+---------+---------------------+
|
|
|
|
| default | default |
|
|
|
|
| secure1 | Test security group |
|
|
|
|
+---------+---------------------+
|
|
|
|
</screen></para>
|
|
|
|
<para>Security groups can be deleted with <command>nova secgroup-delete</command>. The default
|
|
|
|
security group cannot be deleted. The default security group contains these initial
|
|
|
|
settings:<itemizedlist>
|
|
|
|
<listitem>
|
|
|
|
<para>All the traffic originated by the instances (outbound traffic) is
|
|
|
|
allowed</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>All the traffic destined to instances
|
|
|
|
(inbound traffic) is denied</para>
|
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para>All the instances inside the group are allowed to talk to each
|
|
|
|
other</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
<note>
|
|
|
|
<para>You can add extra rules into the default security group for handling the egress
|
2013-08-02 16:00:26 +00:00
|
|
|
traffic. Rules are ingress only at this time.</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
</note>
|
|
|
|
</para>
|
|
|
|
<para>In the following example, the group
|
|
|
|
<literal>secure1</literal> is deleted. When you
|
|
|
|
view the security group list, it no longer
|
|
|
|
appears.</para>
|
|
|
|
<para>
|
|
|
|
<screen>
|
|
|
|
<prompt>$</prompt> <userinput>nova secgroup-delete secure1</userinput>
|
|
|
|
<prompt>$</prompt> <userinput>nova secgroup-list</userinput>
|
|
|
|
+---------+-------------+
|
|
|
|
| Name | Description |
|
|
|
|
+---------+-------------+
|
|
|
|
| default | default |
|
|
|
|
+---------+-------------+
|
|
|
|
</screen>
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
<section xml:id="secgroup_rules">
|
|
|
|
<title>Modify security group rules</title>
|
|
|
|
<para>The security group rules control the incoming traffic that is allowed to the instances
|
|
|
|
in the group, while all outbound traffic is automatically allowed. <note>
|
|
|
|
<para>It is not possible to change the default outbound behaviour.</para>
|
|
|
|
</note>Every security group rule is a policy which allows you to specify inbound
|
|
|
|
connections that are allowed to access the instance, by source address, destination
|
|
|
|
port and IP protocol,(TCP, UDP or ICMP). Currently, ipv6 and other protocols cannot
|
|
|
|
be managed with the security rules, making them permitted by default. To manage
|
|
|
|
such, you can deploy a firewall in front of your OpenStack cloud to control other
|
|
|
|
types of traffic. The command requires the following arguments for both TCP and UDP
|
|
|
|
rules : <itemizedlist>
|
|
|
|
<listitem>
|
2013-08-02 16:00:26 +00:00
|
|
|
<para><secgroup> ID of security group.</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
2013-08-02 16:00:26 +00:00
|
|
|
<para><ip_proto> IP protocol (icmp, tcp, udp).</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
2013-08-02 16:00:26 +00:00
|
|
|
<para><from_port> Port at start of range.</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
2013-08-02 16:00:26 +00:00
|
|
|
<para><to_port> Port at end of range.</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para><cidr> CIDR for address range.</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist></para>
|
|
|
|
<para>For ICMP rules, instead of specifying a begin and end port, you specify the
|
|
|
|
allowed ICMP code and ICMP type: <itemizedlist>
|
|
|
|
<listitem>
|
2013-08-02 16:00:26 +00:00
|
|
|
<para><secgroup> ID of security group.</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
2013-08-02 16:00:26 +00:00
|
|
|
<para><ip_proto> IP protocol (with icmp specified).</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
2013-08-02 16:00:26 +00:00
|
|
|
<para><ICMP_code> The ICMP code.</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
2013-08-02 16:00:26 +00:00
|
|
|
<para><ICMP_type> The ICMP type.</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
|
|
|
<para><cidr> CIDR for the source address range.</para>
|
|
|
|
</listitem>
|
|
|
|
</itemizedlist>
|
|
|
|
<note>
|
2013-08-02 16:00:26 +00:00
|
|
|
<para>Entering "-1" for both code and type
|
2012-09-06 23:46:47 +00:00
|
|
|
indicates that all ICMP codes and types should
|
|
|
|
be allowed.</para>
|
|
|
|
</note>
|
|
|
|
</para>
|
|
|
|
<para>
|
|
|
|
<note>
|
|
|
|
<title>The CIDR notation</title>
|
|
|
|
<para>That notation allows you to specify a base IP address and a suffix that
|
|
|
|
designates the number of significant bits in the IP address used to identify
|
|
|
|
the network. For example, by specifying a 88.170.60.32/27, you specify
|
|
|
|
88.170.60.32 as the <emphasis role="bold">base IP</emphasis> and 27 as the
|
|
|
|
<emphasis role="bold">suffix</emphasis>. Since you use an IPV4 format,
|
|
|
|
there are only 5 bits available for the host part (32 minus 27). The
|
|
|
|
0.0.0.0/0 notation means you allow the entire IPV4 range, meaning allowing
|
|
|
|
all addresses.</para>
|
|
|
|
</note></para>
|
2013-08-06 10:32:54 +00:00
|
|
|
|
2012-09-06 23:46:47 +00:00
|
|
|
<para>For example, in order to allow any IP address to
|
|
|
|
access to a web server running on one of your instance
|
|
|
|
inside the default security
|
|
|
|
group:<screen>
|
|
|
|
<prompt>$</prompt> <userinput>nova secgroup-add-rule default tcp 80 80 0.0.0.0/0</userinput>
|
|
|
|
+-------------+-----------+---------+-----------+--------------+
|
|
|
|
| IP Protocol | From Port | To Port | IP Range | Source Group |
|
|
|
|
+-------------+-----------+---------+-----------+--------------+
|
|
|
|
| tcp | 80 | 80 | 0.0.0.0/0 | |
|
|
|
|
+-------------+-----------+---------+-----------+--------------+
|
|
|
|
</screen></para>
|
|
|
|
<para>In order to allow any IP address to ping an instance
|
|
|
|
inside the default security group (Code 0, Type 8 for
|
|
|
|
the ECHO
|
|
|
|
request.):<screen>
|
|
|
|
<prompt>$</prompt> <userinput>nova secgroup-add-rule default icmp 0 8 0.0.0.0/0</userinput>
|
|
|
|
+-------------+-----------+---------+-----------+--------------+
|
|
|
|
| IP Protocol | From Port | To Port | IP Range | Source Group |
|
|
|
|
+-------------+-----------+---------+-----------+--------------+
|
|
|
|
| icmp | 0 | 8 | 0.0.0.0/0 | |
|
|
|
|
+-------------+-----------+---------+-----------+--------------+
|
|
|
|
</screen></para>
|
|
|
|
<para>
|
|
|
|
<screen>
|
|
|
|
<prompt>$</prompt> <userinput>nova secgroup-list-rules default</userinput>
|
|
|
|
+-------------+-----------+---------+-----------+--------------+
|
|
|
|
| IP Protocol | From Port | To Port | IP Range | Source Group |
|
|
|
|
+-------------+-----------+---------+-----------+--------------+
|
|
|
|
| tcp | 80 | 80 | 0.0.0.0/0 | |
|
|
|
|
| icmp | 0 | 8 | 0.0.0.0/0 | |
|
|
|
|
+-------------+-----------+---------+-----------+--------------+
|
|
|
|
</screen></para>
|
|
|
|
<para>In order to delete a rule, you need to specify the exact same arguments you used
|
|
|
|
to create it:<itemizedlist>
|
|
|
|
<listitem>
|
2013-08-02 16:00:26 +00:00
|
|
|
<para><secgroup> ID of security group.</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
2013-08-02 16:00:26 +00:00
|
|
|
<para><ip_proto> IP protocol (icmp, tcp, udp).</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
2013-08-02 16:00:26 +00:00
|
|
|
<para><from_port> Port at start of range.</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
2013-08-02 16:00:26 +00:00
|
|
|
<para><to_port> Port at end of range.</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
</listitem>
|
|
|
|
<listitem>
|
2013-08-02 16:00:26 +00:00
|
|
|
<para><cidr> CIDR for address range.</para>
|
2012-09-06 23:46:47 +00:00
|
|
|
</listitem>
|
|
|
|
</itemizedlist><screen>
|
|
|
|
<prompt>$</prompt> <userinput>nova secgroup-delete-rule default tcp 80 80 0.0.0.0/0</userinput>
|
|
|
|
</screen>
|
|
|
|
</para>
|
|
|
|
</section>
|
|
|
|
|
|
|
|
</section>
|
|
|
|
|