Security group rules: Difference between revisions

From MediaWiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
= Overview =
= Overview =
This page describes the handling of Security Group Rules via the CLI.
This page describes the handling of security groups within OpenStack.


= OpenStack RC file =
<tabber>
Source the <code>sst-domain</code> openrc file specific to this project:
|-|OpenStack CLI=
= Managed security groups using the CLI =
This chapter shows guides you through the daily operations regarding security groups in stepping stone AG's OpenStack based cloud.
 
 
'''Note:''' This guide assumes that you already have access to the OpenStack CLI and are authenticated. If you are not, follow the [[Quickstart|OpenStack quick start guide]].
== Managed security groups using the CLI - Create group ==
A new security group may be created as follows:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
source ~/openrc/project\ name-openrc.sh
project_id=''              # Provide a OpenStack project id (such as 'ecd2fbce789f4e70bb31613e4e189a43')
secgroup_name=''          # Give it a descriptive name (such as 'HTTPS World')
secgroup_description=''    # Describe the security group further.
 
openstack security group create \
      --project "${project_id}" \
      --format value \
      --column id \
      --description "${secgroup_description}" \
      "${secgroup_name}"
</syntaxhighlight>
</syntaxhighlight>


After you sourced the file, you need to enter a password:
Upon successful creation the OpenStack CLI will simply return the id of the newly created security group:
<syntaxhighlight lang="text">
<syntaxhighlight lang="text">
Please enter your OpenStack Password for project stepping stone AG - Internal Systems Temporary as user sst-domain:
5008898e-6307-499a-9d32-470e551d387a
</syntaxhighlight>
</syntaxhighlight>


= Security groups =
== Managed security groups using the CLI - Create rules ==
== Security groups - List all security group rules within a project ==
Upon creation, a new security group is empty and does not contain any rules.
 
To create a rule and assign it to the security group, continue as follows:
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
project_id=6fd0ccd8b5ae44d292c67f0d3e75ca20    # stepping stone AG - Internal Systems Temporary
project_id=''              # Provide a OpenStack project id (such as 'ecd2fbce789f4e70bb31613e4e189a43')
secgroup_id=''            # Provide the UUID of the newly created security group (such as '5008898e-6307-499a-9d32-470e551d387a')


security_group_ids=$(
openstack security group rule create \
    openstack security group list \
    --project ${project_id} \
        --project "${project_id}" \
    --ingress \
        --column ID \
    --ethertype IPv4 \
        --format value
    --protocol tcp \
)
    --dst-port 443 \
    --remote-ip "0.0.0.0/0" \
    ${secgroup_id}
</syntaxhighlight>


for seucrity_group_id in ${security_group_ids}; do
The following paramters may be modified to further suit your situation:
    openstack security group rule list \
* '''ingress:''' The rule may be either a <code>ingress</code> or an <code>egress</code> rule.
        ${seucrity_group_id} \
* '''ethertype:''' May be either <code>IPv4</code> or <code>IPv6</code>.
        --format value
* '''protocol:''' May be either <code>tcp</code> or <code>udp</code>.
done
* '''dst-port:''' May be any port between <code>0</code> and <code>65535</code>.
</syntaxhighlight>
* '''remote-ip:''' May be an ip range such as <code>192.168.1.0/24</code> or a single ip such as <code>192.168.1.100/32</code>. To allow traffic from anywhere,  use <code>0.0.0.0/0</code>.
<syntaxhighlight lang="bash">
 
58252b2e-ccde-4326-9542-c9c47fddceff tcp IPv4 85.195.192.69/32 22:22 None
Upon successful creation, the OpenStack CLI should return an output similar to this:
d34a81a0-df8b-46b4-a28d-d3a66041856a tcp IPv4 194.176.109.13/32 22:22 None
<syntaxhighlight lang="text">
c14231d1-d92a-475e-ade3-202751b9be2b tcp IPv4 0.0.0.0/0 22:22 bb0b7079-cbe0-410c-8855-510cab69921a
+-------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
0f3423db-b36f-4ff4-8c3a-4566f2a82a0d tcp IPv4 0.0.0.0/0  None
| Field            | Value                                                                                                                                                                                        |
88cf4321-f1fd-4069-bb69-6ea19062e3cb udp IPv4 0.0.0.0/0  None
+-------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
bfab8562-a672-4db3-b427-54a13353c05b icmp IPv4 0.0.0.0/0 type=8 None
| created_at        | 2026-10-28T14:15:12Z                                                                                                                                                                        |
fe38a26b-cc3e-4f68-ad79-afd4d02c97f7 icmp IPv4 0.0.0.0/0 type=8 None
| description      |                                                                                                                                                                                              |
a5b22c86-e03c-4d36-9e9f-6b41f2725083 tcp IPv4 0.0.0.0/0 3389:3389 None
| direction        | ingress                                                                                                                                                                                      |
...
| ether_type        | IPv4                                                                                                                                                                                         |
...
| id                | 2b2c8a6b-6110-4eee-9802-480f1ec12e20                                                                                                                                                        |
| location          | Munch({'cloud': '', 'region_name': 'duedingen-test', 'zone': None, 'project': Munch({'id': 'c2ebdf6ceea9464ea07922ebf8d2f857', 'name': None, 'domain_id': 'default', 'domain_name': None})}) |
| name              | None                                                                                                                                                                                        |
| port_range_max    | 443                                                                                                                                                                                          |
| port_range_min    | 443                                                                                                                                                                                          |
| project_id        | ecd2fbce789f4e70bb31613e4e189a43                                                                                                                                                            |
| protocol          | tcp                                                                                                                                                                                          |
| remote_group_id  | None                                                                                                                                                                                        |
| remote_ip_prefix  | 0.0.0.0/0                                                                                                                                                                                   |
| revision_number  | 0                                                                                                                                                                                            |
| security_group_id | 5008898e-6307-499a-9d32-470e551d387a                                                                                                                                                        |
| tags              | []                                                                                                                                                                                          |
| updated_at        | 2026-10-28T14:15:12Z                                                                                                                                                                        |
+-------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
</syntaxhighlight>
</syntaxhighlight>
== Managed security groups using the CLI - Assign to server ==
== Managed security groups using the CLI - List ==
== Managed security groups using the CLI - Show ==
== Managed security groups using the CLI - Delete ==
|-|OpenStack Dashboard=
= Managed security groups using the Dashboard =
This chapter shows guides you through the daily operations regarding security groups in stepping stone AG's OpenStack based cloud.
'''Note:''' This guide assumes that you already have access to the OpenStack dashboard and are authenticated. If you are not, follow the [[Quickstart|OpenStack quick start guide]].
== Managed security groups using the Dashboard - Create ==
== Managed security groups using the Dashboard - Assign to server ==
== Managed security groups using the Dashboard - List ==
== Managed security groups using the Dashboard - Show ==
== Managed security groups using the Dashboard - Delete ==
</tabber>


[[Category: CLI]]
[[Category: CLI]]
[[Category: Network]]
[[Category: Network]]

Revision as of 15:16, 28 October 2026

Overview

This page describes the handling of security groups within OpenStack.

Managed security groups using the CLI

This chapter shows guides you through the daily operations regarding security groups in stepping stone AG's OpenStack based cloud.


Note: This guide assumes that you already have access to the OpenStack CLI and are authenticated. If you are not, follow the OpenStack quick start guide.

Managed security groups using the CLI - Create group

A new security group may be created as follows:

project_id=''              # Provide a OpenStack project id (such as 'ecd2fbce789f4e70bb31613e4e189a43')
secgroup_name=''           # Give it a descriptive name (such as 'HTTPS World')
secgroup_description=''    # Describe the security group further.

openstack security group create \
      --project "${project_id}" \
      --format value \
      --column id \
      --description "${secgroup_description}" \
      "${secgroup_name}"

Upon successful creation the OpenStack CLI will simply return the id of the newly created security group:

5008898e-6307-499a-9d32-470e551d387a

Managed security groups using the CLI - Create rules

Upon creation, a new security group is empty and does not contain any rules.

To create a rule and assign it to the security group, continue as follows:

project_id=''              # Provide a OpenStack project id (such as 'ecd2fbce789f4e70bb31613e4e189a43')
secgroup_id=''             # Provide the UUID of the newly created security group (such as '5008898e-6307-499a-9d32-470e551d387a')

openstack security group rule create \
    --project ${project_id} \
    --ingress \
    --ethertype IPv4 \
    --protocol tcp \
    --dst-port 443 \
    --remote-ip "0.0.0.0/0" \
    ${secgroup_id}

The following paramters may be modified to further suit your situation:

  • ingress: The rule may be either a ingress or an egress rule.
  • ethertype: May be either IPv4 or IPv6.
  • protocol: May be either tcp or udp.
  • dst-port: May be any port between 0 and 65535.
  • remote-ip: May be an ip range such as 192.168.1.0/24 or a single ip such as 192.168.1.100/32. To allow traffic from anywhere, use 0.0.0.0/0.

Upon successful creation, the OpenStack CLI should return an output similar to this:

+-------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field             | Value                                                                                                                                                                                        |
+-------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| created_at        | 2026-10-28T14:15:12Z                                                                                                                                                                         |
| description       |                                                                                                                                                                                              |
| direction         | ingress                                                                                                                                                                                      |
| ether_type        | IPv4                                                                                                                                                                                         |
| id                | 2b2c8a6b-6110-4eee-9802-480f1ec12e20                                                                                                                                                         |
| location          | Munch({'cloud': '', 'region_name': 'duedingen-test', 'zone': None, 'project': Munch({'id': 'c2ebdf6ceea9464ea07922ebf8d2f857', 'name': None, 'domain_id': 'default', 'domain_name': None})}) |
| name              | None                                                                                                                                                                                         |
| port_range_max    | 443                                                                                                                                                                                          |
| port_range_min    | 443                                                                                                                                                                                          |
| project_id        | ecd2fbce789f4e70bb31613e4e189a43                                                                                                                                                             |
| protocol          | tcp                                                                                                                                                                                          |
| remote_group_id   | None                                                                                                                                                                                         |
| remote_ip_prefix  | 0.0.0.0/0                                                                                                                                                                                    |
| revision_number   | 0                                                                                                                                                                                            |
| security_group_id | 5008898e-6307-499a-9d32-470e551d387a                                                                                                                                                         |
| tags              | []                                                                                                                                                                                           |
| updated_at        | 2026-10-28T14:15:12Z                                                                                                                                                                         |
+-------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Managed security groups using the CLI - Assign to server

Managed security groups using the CLI - List

Managed security groups using the CLI - Show

Managed security groups using the CLI - Delete

Managed security groups using the Dashboard

This chapter shows guides you through the daily operations regarding security groups in stepping stone AG's OpenStack based cloud.


Note: This guide assumes that you already have access to the OpenStack dashboard and are authenticated. If you are not, follow the OpenStack quick start guide.

Managed security groups using the Dashboard - Create

Managed security groups using the Dashboard - Assign to server

Managed security groups using the Dashboard - List

Managed security groups using the Dashboard - Show

Managed security groups using the Dashboard - Delete