Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 756861

Summary: sshd_config Match parameter doesn't seem to work with negated address patterns
Product: Red Hat Enterprise Linux 6 Reporter: Gerardo Arceri <gea>
Component: opensshAssignee: Petr Lautrbach <plautrba>
Status: CLOSED NOTABUG QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.1CC: pvrabec
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-12-08 15:14:42 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Gerardo Arceri 2011-11-24 21:49:12 UTC
Description of problem:
While trying to setup chrooted ssh for certain users i found out that (at least) the Address Match parameter will ignore negated patterns (!192.168.0.0/32)
If you use:

Match User sshtest Address 192.168.0.1/32
ForceCommand /sbin/nologin

It will work (only users logging in from 192.168.0.1 will get kicked off

but if you attempt to negate the address pattern

Match User sshtest Address !192.168.0.1/32
ForceCommand /sbin/nologin


It will not work




Version-Release number of selected component (if applicable):
openssh-server-5.3p1-52.el6_1.2.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Setup ssh with the configuration shown above using a negated address pattern
2. Attempt to connect
3. Check results.
  
Actual results:
Rule should match as described in the sshd_config manpage.
" The match patterns may consist of single entries or comma-separated lists and may use the wildcard and negation operators described in the PATTERNS section of ssh_config(5)."



Expected results:
The negated pattern takes effect

Additional info:

Comment 2 Petr Lautrbach 2011-12-08 15:14:42 UTC
"A pattern-list is a comma-separated list of patterns.  Patterns within  pattern-lists may be negated by preceding them with an exclamation mark(‘!’)."

So you can negate only listed patterns, correct setting is:

Match User sshtest Address !192.168.0.1/32,*
  ForceCommand /sbin/nologin