Recently, I resync'ed the Match conditional block option from OpenSSH to SunSSH. This feature was integrated to Solaris Nevada build 129 last week and it will be available in the next OpenSolaris release.
The Match conditional block option enables users to configure SSH daemon options based on user, group, hostname, or address. It is documented in the sshd_config(4) man page, starting from Solaris Nevada build 129.
Note that there is no limitation on the number of match blocks specified in the sshd_config file; however, all the Match blocks must be placed at the end of the sshd_config file, after all the global settings.
Also note that, only a subset of keywords can be used in a Match block. These keywords are:
- AllowTcpForwarding
- Banner
- ChrootDirectory
- GatewayPorts
- GSSAPIAuthentication
- HostbasedAuthentication
- PasswordAuthentication
- PermitEmptyPasswords
- PermitRootLogin
- PubkeyAuthentication
- RhostsRSAAuthentication
- RSAAuthentication
- X11DisplayOffset
- X11Forwarding
- X11UseLocalhost
Some usage examples:
Example 1: Disallow user "testuser" to use TCP forwarding
Match User testuser
AllowTcpForwarding no
Example 2: Display a special banner for users not in the "staff" group
Match Group *,!staff
Banner /etc/banner.text
Example 3: Allow root login from host "rootallowed.example.com"
Match Host rootallowed.example.com
PermitRootLogin yes
Example 4: Allow anyone to use GatewayPorts from the local net
Match Address 192.168.0.0/24
GatewayPorts yes
