Repository navigation
Closed
Description
A quite new API (from 2023.2) allows the default security group rules to be edited instead of being hardcoded.
This means, that the rules that are automatically added to each new security group (may it be a default or a custom group) can vary between CSPs and may result in security issues for customers, that expect a certain behavior for a default security group. E.g. only allowing outgoing traffic.
Example of adding new rules:
stack@devstack:~/devstack$ openstack default security group rule create --ingress --protocol tcp --dst-port 22 --for-default-sg --for-custom-sg
+-------------------------+--------------------------------------+
| Field | Value |
+-------------------------+--------------------------------------+
| description | |
| direction | ingress |
| ether_type | IPv4 |
| id | b0bfe643-7d17-4f85-96f3-fc6aab75748d |
| port_range_max | 22 |
| port_range_min | 22 |
| protocol | tcp |
| remote_address_group_id | None |
| remote_group_id | None |
| remote_ip_prefix | 0.0.0.0/0 |
| used_in_default_sg | True |
| used_in_non_default_sg | True |
+-------------------------+--------------------------------------+
stack@devstack:~/devstack$ openstack default security group rule create --ingress --protocol tcp --dst-port 80 --description http
+-------------------------+--------------------------------------+
| Field | Value |
+-------------------------+--------------------------------------+
| description | http |
| direction | ingress |
| ether_type | IPv4 |
| id | 25391f6c-2521-4878-a046-e71c42040f2e |
| port_range_max | 80 |
| port_range_min | 80 |
| protocol | tcp |
| remote_address_group_id | None |
| remote_group_id | None |
| remote_ip_prefix | 0.0.0.0/0 |
| used_in_default_sg | False |
| used_in_non_default_sg | True |
+-------------------------+--------------------------------------+
stack@devstack:~/devstack$ openstack security group create new-test-group
+-----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| created_at | 2024-03-14T13:19:14Z |
| description | new-test-group |
| id | ae30070e-bcbd-4e5b-9ef2-27a569af2490 |
| name | new-test-group |
| project_id | 15f2ab0eaa5b4372b759bde609e86224 |
| revision_number | 1 |
| rules | created_at='2024-03-14T13:19:14Z', direction='egress', ethertype='IPv6', id='25e5f5fb-3baa-4489-891d-e13c94af3b04', standard_attr_id='145', updated_at='2024-03-14T13:19:14Z' |
| | created_at='2024-03-14T13:19:14Z', direction='ingress', ethertype='IPv4', id='26ae7373-8b67-46f0-a578-7421faf34430', normalized_cidr='0.0.0.0/0', port_range_max='22', |
| | port_range_min='22', protocol='tcp', remote_ip_prefix='0.0.0.0/0', standard_attr_id='147', updated_at='2024-03-14T13:19:14Z' |
| | created_at='2024-03-14T13:19:14Z', direction='ingress', ethertype='IPv4', id='5f1c8147-7a0f-4de3-b46e-43746f877933', normalized_cidr='0.0.0.0/0', port_range_max='80', |
| | port_range_min='80', protocol='tcp', remote_ip_prefix='0.0.0.0/0', standard_attr_id='144', updated_at='2024-03-14T13:19:14Z' |
| | created_at='2024-03-14T13:19:14Z', direction='egress', ethertype='IPv4', id='ad770fa2-682b-409b-9cbb-138dfb5e7b31', standard_attr_id='146', updated_at='2024-03-14T13:19:14Z' |
| shared | False |
| stateful | True |
| tags | [] |
| updated_at | 2024-03-14T13:19:14Z |
+-----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
We should find a consensus about the default rules, that should be applied to SGs and write a corresponding standard.
This issue is also based on the Decision Record created here: #495
Definition of Done:
Please refer to scs-0001-v1 for details.
- Proposal has been written with name of the form
scs-xxxx-v1-slug.md(only substituteslug) - Proposal has the fields
status,type,trackset - Proposal has been voted upon in the corresponding team
- Status has been changed into
Draft, file renamed:xxxxreplaced by document number - If applicable: test script has been written (this item may be moved into a separate issue so long as the state is
Draft)
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
josephineSei commentedon Mar 14, 2024
Policy check:
Listing all the default rules is allowed, but they cannot be edited by users with the role member.
josephineSei commentedon Mar 15, 2024
One problem that occured is, that Security Groups work as whitlists only.
So it is not possible, to e.g. allow all outgoing traffic and just disallow 1 or 2 ports to be used.
A better way would be to divide by protocol what is allowed: E.g. allow all outgoing TCP traffic.
We should just consider that the default rules MUST NOT get overwhelming. So too many rules will confuse users and they will not change or disable them, even though in their use case they can and should do this.
josephineSei commentedon Mar 15, 2024
an interesting behavior is also, that when creating default rules, the rules for the default SG are also used for the custom SGs:
That means the parameters
--for-default-sgand--for-custom-sgwork differently.But at least OpenStak checks for duplicates:
josephineSei commentedon Mar 21, 2024
Transfering the discussion to this issue:
What should the default Security Rules look like?
There are different things described in the OpenStack documentation.
The most actual default is this:
https://github.com/openstack/neutron/blob/master/neutron/db/migration/alembic_migrations/versions/2023.2/expand/c33da356b165_security_group_default_rules.py
For default SGs:
For custom SG:
For stable/zed it is the same without the default security group endpoint: https://github.com/openstack/neutron/blob/stable/zed/neutron/db/securitygroups_db.py#L119
@garloff @fkr @artificial-intelligence @bitkeks @horazont @berendt a disussion with CSPs should help us define a good default here. Would it be possible to gather a lot of people in such a discussion?
Edit: I wonder, why by default the ingress default SG rules only apply to the default Security Groups, but not to the custom Security Groups?
This would be these lines in the table:
The remote Security Group there is stated as "PARENT", but at least the database column says it should be and ID:
josephineSei commentedon Mar 21, 2024
After looking through the code and trying some things I found out, that the naming "remote_group_id" is misleading for the default security group rules. If "PARENT" is stated there it automatically creates a rule for the SG that automatically puts the SGs ID as remote_group_id.
That only leaves the question why in the rolled out defaults (default SG rules in an untouched new OpenStack deployment) do only apply to the default SGs but not the custom ones.
berendt commentedon Mar 27, 2024
As mentioned in the SCS IAAS call I would prefer to not touch the existing default groups/rules provided by Nova/Neutron upstream. Hope that was the right place for this comment.
josephineSei commentedon Apr 9, 2024
Looking into the topic of the ingress rules again I would like to discuss this in the IaaS meeting:
Additionally all security groups (default and custom) can be edited - so the default rules are just the first set of rules, which are present, when the group is created.
Questions:
A different behavior between the custom groups and the default security group may lead to confusion.
josephineSei commentedon Apr 22, 2024
As discussed in the IaaS meeting I adjusted the Standard for the default security group rules:
They SHOULD be present as in OpenStack defaultly set.
For the ingress rules I adjusted the MUST NOT to only apply to any other rules than the 2 rules allowing traffic between the default security groups.