bin/161893: sshd DenyUsers user@!*.dom doesn't work

Petr Lampa lampa at fit.vutbr.cz
Sat Oct 22 08:50:08 UTC 2011


>Number:         161893
>Category:       bin
>Synopsis:       sshd DenyUsers user@!*.dom doesn't work
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 22 08:50:07 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Petr Lampa
>Release:        8.2-STABLE
>Organization:
FIT VUT
>Environment:
FreeBSD xxxx z 8.2-STABLE FreeBSD 8.2-STABLE #20: Mon May  9 11:39:59 CEST 2011 
>Description:
This is long standing bug in openssh - negative pattern in DenyUsers doesn't work: 

/etc/ssh/sshd_config
..
DenyUsers user@!*local.dom

The reason is missing peace of code in crypto/openssh/match.c:

                /* Try to match the subpattern against the string. */
                if (match_pattern(string, sub)) {
..
+               } else {
+                       if (negated)
+                               got_positive = 1;
                }

After this change (and reinstall of libssh), user connecting from non-local domain is matched:

xxx sshd[11991]: User user from dns2.pavianetwork.com not allowed because listed in DenyUsers

>How-To-Repeat:
Use DenyUsers with negative domain pattern, it will not match.
>Fix:
*** crypto/openssh/match.c.orig 2009-04-08 19:39:43.000000000 +0200
--- crypto/openssh/match.c      2009-04-08 19:39:46.000000000 +0200
***************
*** 159,164 ****
--- 159,167 ----
                                return -1;              /* Negative */
                        else
                                got_positive = 1;       /* Positive */
+               } else {
+                       if (negated)
+                               got_positive = 1;
                }
        }



>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list