Bug 1694471 - Restrict SSH access access to specific remote subnets
Summary: Restrict SSH access access to specific remote subnets
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-tripleo-heat-templates
Version: 13.0 (Queens)
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: zstream
: 13.0 (Queens)
Assignee: Cédric Jeanneret
QA Contact: Sasha Smolyak
URL:
Whiteboard:
Depends On:
Blocks: 1704589
TreeView+ depends on / blocked
 
Reported: 2019-03-31 16:58 UTC by Punit Kundal
Modified: 2023-09-14 05:26 UTC (History)
6 users (show)

Fixed In Version: openstack-tripleo-heat-templates-8.3.1-48.el7ost
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-09-03 16:55:32 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Launchpad 1826829 0 None None None 2019-04-29 05:32:43 UTC
OpenStack gerrit 656242 0 None MERGED implement default ssh-from-ctlplane rule via hiera 2021-02-13 17:02:17 UTC
OpenStack gerrit 656243 0 None MERGED Allow ssh from all for undercloud 2021-02-13 17:02:17 UTC
OpenStack gerrit 656244 0 None MERGED remove ssh from tripleo::firewall::pre 2021-02-13 17:02:17 UTC
OpenStack gerrit 656442 0 None MERGED implement default ssh-from-ctlplane rule via hiera 2021-02-13 17:02:17 UTC
OpenStack gerrit 656450 0 None MERGED Allow ssh from all for undercloud 2021-02-13 17:02:17 UTC
Red Hat Product Errata RHBA-2019:2624 0 None None None 2019-09-03 16:55:51 UTC

Internal Links: 1704589 1704594

Description Punit Kundal 2019-03-31 16:58:58 UTC
Description of problem:

The current default configuration set by director for SSH access opens SSH for all the remote subnets:

+++
[root@overcloud-controller-0 ~]# iptables -S | grep -i ssh
-A INPUT -p tcp -m multiport --dports 22 -m state --state NEW -m comment --comment "003 accept ssh ipv4" -j ACCEPT
[root@overcloud-controller-0 ~]# iptables -t filter -vnL | grep -i ssh
    1    60 ACCEPT     tcp  --  *      *       0.0.0.0/0            0.0.0.0/0            multiport dports 22 state NEW /* 003 accept ssh ipv4 */
[root@overcloud-controller-0 ~]# netstat -tnpl | grep -i ssh
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      5268/sshd           
tcp6       0      0 :::22                   :::*                    LISTEN      5268/sshd           
+++

This leaves the nodes vulnerable to brute force attacks. The allowed remote subnets should be restricted to required subnets only like provisioning and internal_api subnets. 

Do we currently have a way to achieve this in a already running environment ?

It is a known fact that iptable rules can be modified with tripleo templates; however we are unsure as to which subnets should be left open for ssh access. 

Some guidance is required here for restrict the SSH access without breaking the current functionality.

Version-Release number of selected component (if applicable):
[root@undercloud13 ~]# rpm -qa | grep -i tripleo-heat
openstack-tripleo-heat-templates-8.0.7-21.el7ost.noarch
[root@undercloud13 ~]# rpm -qa | grep -i puppet-tripleo
puppet-tripleo-8.3.6-7.el7ost.noarch
[root@undercloud13 ~]# 


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:
SSH is open to all remote subnets

Expected results:
SSH access on the overcloud nodes should be open only to the required subnets 

Additional info:

Comment 2 Cédric Jeanneret 2019-04-08 05:42:29 UTC
Hello,

sooo.. we did some changes in Master/OSP-15 about that open SSH a while back: https://review.openstack.org/#/c/631784/
It adds a new parameter allowing to open SSH to the world or not.
Please note it might cut legitimate accesses, and would probably need some custom rules. This an be done by injecting rules in hiera:

tripleo::sshd::firewall_rules:
  'Accept sshd from XXX subnet':
    proto: tcp
    dport: 22
    source: 'XXX'

Just a small remark: iirc, there isn't any password for the users created by tripleo, meaning a brute force is nearly impossible (ppl have to generate the right SSH private key instead of password).

Would the change I pointed be sufficient for your case? If so, we will investigate the backporting of that new patch, since it was made against master.

Cheers,

C.

Comment 3 Punit Kundal 2019-04-15 09:49:04 UTC
Hello Cedric,

Thanks for getting back.

Our request is that we should have the ability to limit the SSH access to specific required subnets only.

If adding the above parameter addresses that requirement; then with the right set of supporting documentation to provide the correct advice on the subject matter should be enough.

Regards,
Punit

Comment 9 Cédric Jeanneret 2019-04-29 05:28:41 UTC
Hello,

I'm starting the LP creation as well as upstream backports. External trackers will be updated accordingly.

Cheers,

C.

Comment 11 Lon Hohberger 2019-07-11 10:41:21 UTC
According to our records, this should be resolved by openstack-tripleo-heat-templates-8.3.1-54.el7ost.  This build is available now.

Comment 14 errata-xmlrpc 2019-09-03 16:55:32 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2624

Comment 15 Red Hat Bugzilla 2023-09-14 05:26:15 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days


Note You need to log in before you can comment on or make changes to this bug.