I'm trying to define different login shells for different users of an AD domain, as described here. The aim is to deny members of a particular group from logging in while allowing them to do SSH tunneling.
Here below is the file /etc/sssd/sssd.conf. MYDOMAIN.GLOBAL is the default domain provided by the AD. The config below defines a test domain MYDOMAIN_TEST.GLOBAL, which is not in the AD, as the domain for these limited users. (This is just a configuration for testing: later, in the MYDOMAIN_TEST.GLOBAL domain section, override_shell = /bin/zsh will be replaced by override_shell = /sbin/nologin.)
[sssd]
domains = MYDOMAIN.GLOBAL,MYDOMAIN_TEST.GLOBAL
config_file_version = 2
services = nss, pam
[nss]
default_shell = /bin/bash
[domain/MYDOMAIN.GLOBAL]
ad_server = ad.mydomain.global
ad_domain = MYDOMAIN.GLOBAL
ldap_user_search_filter = (memberOf=CN=AdminsGroup,OU=Groups,DC=MYDOMAIN,DC=GLOBAL)
id_provider = ad
simple_allow_groups = AdminsGroup@MYDOMAIN.GLOBAL
override_shell = /bin/bash
[domain/MYDOMAIN_TEST.GLOBAL]
ad_server = ad.mydomain.global
ad_domain = MYDOMAIN.GLOBAL
ldap_user_search_filter = (memberOf=CN=LimitedGroup,OU=Groups,DC=MYDOMAIN,DC=GLOBAL)
id_provider = ad
simple_allow_groups = LimitedGroup@MYDOMAIN.GLOBAL
override_shell = /bin/zsh
A member of MYDOMAIN.GLOBAL is able to login via SSH, while a member of MYDOMAIN_TEST.GLOBAL can't and gets a "Permission denied, please try again" or a "Authentication failed" error.
The sssd logfiles don't show any error.
Why is that?
Does MYDOMAIN_TEST.GLOBAL need to be present in the AD? If yes, is it possible to somehow bypass this and configure sss with different "local categories" of users to do what I want?
(Note: Apparently this can be done with nlscd, as per this question and this other question, but it requires a LDAP server, and configuring it to use an AD is another can of worms.)
MYDOMAIN_TEST.GLOBALdefinition block do you really intend to compare against groups withinMYDOMAIN.GLOBALrather thanMYDOMAIN_TEST.GLOBAL? Similarly, does thead.mydomain.globalAD server really serve theMYDOMAIN_TEST.GLOBALdomain? – Chris Davies Aug 27 '18 at 17:57MYDOMAIN_TEST.GLOBALdoes not exist in the AD, is only defined here in the SSS config. I'd like to know if this would work. – dr_ Aug 28 '18 at 07:02ldap_user_search_baseinstead? – Christophe Drevet Aug 31 '18 at 07:06-Noption (no shell) and the-Loption (tunneling), see https://serverfault.com/questions/56566/ssh-tunneling-only-access and https://unix.stackexchange.com/questions/100859/ssh-tunnel-without-shell-on-ssh-server – dr_ Aug 31 '18 at 08:33