Bug 1038757

Summary: authconfig should not touch services whose configuration is not changed
Product: Red Hat Enterprise Linux 7 Reporter: Scott Poore <spoore>
Component: authconfigAssignee: Tomas Mraz <tmraz>
Status: CLOSED CURRENTRELEASE QA Contact: David Spurek <dspurek>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: abokovoy, dspurek, ebenes, mvadkert, omoris, rcritten, spoore, tmraz
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: authconfig-6.2.8-5.el7 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 12:43:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Scott Poore 2013-12-05 18:39:44 UTC
Description of problem:

When the following is run, winbind is stopped but, not restarted:

authconfig --enablemkhomedir --updateall

EXAMPLE:

[root@qe-blade-05 log]# service winbind start
Redirecting to /bin/systemctl start  winbind.service

[root@qe-blade-05 log]# ps -ef|grep winbind
root     19295     1  0 13:20 ?        00:00:00 /usr/sbin/winbindd
root     19296 19295  0 13:20 ?        00:00:00 /usr/sbin/winbindd
root     19346  7542  0 13:20 pts/0    00:00:00 grep --color=auto winbind

[root@qe-blade-05 log]# authconfig --enablemkhomedir --updateall

[root@qe-blade-05 log]# ps -ef|grep winbind
root     19649  7542  0 13:20 pts/0    00:00:00 grep --color=auto winbind



Version-Release number of selected component (if applicable):
authconfig-6.2.8-1.el7.x86_64
samba-winbind-4.1.0-3.el7.x86_64

How reproducible:
always


Steps to Reproduce:
1.  yum -y install samba-winbind
2.  service winbind start
3.  authconfig --enablemkhomedir --updateall

Actual results:
winbind not running after authconfig

Expected results:
winbind should be started by authconfig

Additional info:

log.winbindd:

[2013/12/05 13:30:15.183267,  0, pid=24037, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/winbindd.c:234(winbindd_sig_term_handler)
  Got sig[15] terminate (is_parent=1)
[2013/12/05 13:30:15.183734,  5, pid=24037, effective(0, 0), real(0, 0), class=tdb] ../source3/lib/gencache.c:67(gencache_init)
  Opening cache file at /var/lib/samba/gencache.tdb
[2013/12/05 13:30:15.184299,  5, pid=24037, effective(0, 0), real(0, 0), class=tdb] ../source3/lib/gencache.c:110(gencache_init)
  Opening cache file at /var/lib/samba/gencache_notrans.tdb
[2013/12/05 13:30:15.184471,  5, pid=24037, effective(0, 0), real(0, 0)] ../lib/dbwrap/dbwrap.c:187(dbwrap_check_lock_order)
  check lock order 2 for /var/lib/samba/serverid.tdb
[2013/12/05 13:30:15.184519, 10, pid=24037, effective(0, 0), real(0, 0)] ../lib/dbwrap/dbwrap.c:133(debug_lock_order)
  lock order:  1:<none> 2:/var/lib/samba/serverid.tdb 3:<none>
[2013/12/05 13:30:15.184589, 10, pid=24037, effective(0, 0), real(0, 0)] ../lib/dbwrap/dbwrap_tdb.c:59(db_tdb_log_key)
  Locking key E55D000000000000FFFF
[2013/12/05 13:30:15.184639, 10, pid=24037, effective(0, 0), real(0, 0)] ../lib/dbwrap/dbwrap_tdb.c:143(db_tdb_fetch_locked_internal)
  Allocated locked data 0x0x7ff934483510
[2013/12/05 13:30:15.184703, 10, pid=24037, effective(0, 0), real(0, 0)] ../lib/dbwrap/dbwrap_tdb.c:59(db_tdb_log_key)
  Unlocking key E55D000000000000FFFF
[2013/12/05 13:30:15.184747,  5, pid=24037, effective(0, 0), real(0, 0)] ../lib/dbwrap/dbwrap.c:146(dbwrap_lock_order_state_destructor)
  release lock order 2 for /var/lib/samba/serverid.tdb
[2013/12/05 13:30:15.184784, 10, pid=24037, effective(0, 0), real(0, 0)] ../lib/dbwrap/dbwrap.c:133(debug_lock_order)
  lock order:  1:<none> 2:<none> 3:<none>

log.wb-SPOORE12050914:

[2013/12/05 13:30:07.136760, 10, pid=24038, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/winbindd_dual.c:1564(fork_domain_child)
  fork_domain_child: domain SPOORE12050914 no longer in 'startup' mode.
[2013/12/05 13:30:15.183333,  0, pid=24038, effective(0, 0), real(0, 0), class=winbind] ../source3/winbindd/winbindd.c:234(winbindd_sig_term_handler)
  Got sig[15] terminate (is_parent=0)
[2013/12/05 13:30:15.183719,  5, pid=24038, effective(0, 0), real(0, 0), class=tdb] ../source3/lib/gencache.c:67(gencache_init)
  Opening cache file at /var/lib/samba/gencache.tdb
[2013/12/05 13:30:15.183861,  5, pid=24038, effective(0, 0), real(0, 0), class=tdb] ../source3/lib/gencache.c:110(gencache_init)
  Opening cache file at /var/lib/samba/gencache_notrans.tdb


In case it's relevant here's the winbind systemd config:

[root@qe-blade-05 log]# rpm -ql samba-winbind|grep systemd
/usr/lib/systemd/system/winbind.service

[root@qe-blade-05 log]# cat /usr/lib/systemd/system/winbind.service
[Unit]
Description=Samba Winbind Daemon
After=syslog.target network.target nmb.service

[Service]
Type=forking
Environment=KRB5CCNAME=/run/samba/krb5cc_samba
PIDFile=/run/winbindd.pid
EnvironmentFile=-/etc/sysconfig/samba
ExecStart=/usr/sbin/winbindd "$WINBINDOPTIONS"
ExecReload=/usr/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

Comment 2 Tomas Mraz 2014-01-13 11:53:22 UTC
Can you attach the output of authconfig --test ?

You have to have winbind authentication enabled in authconfig otherwise it will try to stop it.

Comment 3 Scott Poore 2014-01-13 15:48:18 UTC
Interesting.  So, my example of how to reproduce the problem might not be the best example then.  I was trying to come up with a simple way that didn't include all the setup of an IPA server.

Where I'm seeing the problem in practice is on an IPA server after ipa-adtrust-install and trust-add to setup a cross domain trust to AD.  Then I run authconfig to enable mkhomedir for users.  That's where I found winbindd not starting back up.

[root@rhel7-1 ~]# authconfig --test
caching is disabled
nss_files is always enabled
nss_compat is disabled
nss_db is disabled
nss_hesiod is disabled
 hesiod LHS = ""
 hesiod RHS = ""
nss_ldap is disabled
 LDAP+TLS is disabled
 LDAP server = "ldap://rhel7-1.ipa1.example.test"
 LDAP base DN = ""
nss_nis is disabled
 NIS server = ""
 NIS domain = ""
nss_nisplus is disabled
nss_winbind is disabled
 SMB workgroup = ""
 SMB servers = ""
 SMB security = "user"
 SMB realm = ""
 Winbind template shell = "/bin/false"
 SMB idmap range = "16777216-33554431"
nss_sss is enabled by default
nss_wins is disabled
nss_mdns4_minimal is disabled
DNS preference over NSS or WINS is disabled
pam_unix is always enabled
 shadow passwords are enabled
 password hashing algorithm is sha512
pam_krb5 is disabled
 krb5 realm = "IPA1.EXAMPLE.TEST"
 krb5 realm via dns is disabled
 krb5 kdc = "rhel7-1.ipa1.example.test:88"
 krb5 kdc via dns is enabled
 krb5 admin server = "rhel7-1.ipa1.example.test:749"
pam_ldap is disabled
 LDAP+TLS is disabled
 LDAP server = "ldap://rhel7-1.ipa1.example.test"
 LDAP base DN = ""
 LDAP schema = "rfc2307"
pam_pkcs11 is disabled
 use only smartcard for login is disabled
 smartcard module = ""
 smartcard removal action = ""
pam_fprintd is disabled
pam_ecryptfs is disabled
pam_winbind is disabled
 SMB workgroup = ""
 SMB servers = ""
 SMB security = "user"
 SMB realm = ""
pam_sss is enabled by default
 credential caching in SSSD is enabled
 SSSD use instead of legacy services if possible is enabled
IPAv2 is disabled
IPAv2 domain was not joined
 IPAv2 server = ""
 IPAv2 realm = ""
 IPAv2 domain = ""
pam_pwquality is enabled (try_first_pass local_users_only retry=3 authtok_type=)
pam_passwdqc is disabled ()
pam_access is disabled ()
pam_mkhomedir or pam_oddjob_mkhomedir is enabled (umask=0077)
Always authorize local users is enabled ()
Authenticate system accounts against network services is disabled


So is this a problem where IPA setup should be handling authconfig settings for winbind differently?

Thanks,
Scott

Comment 4 Tomas Mraz 2014-01-13 17:33:12 UTC
Apparently it does not use either of --enablewinbind --enablewinbindauth when calling authconfig. Then this is expected.

Comment 5 Alexander Bokovoy 2014-01-13 17:49:36 UTC
If authconfig was not asked to configure winbind, it should not disable it afterwards.

Comment 6 Tomas Mraz 2014-01-13 17:59:44 UTC
Authconfig is a tool that configures all the services that relate to user identity and authentication on the system - it owns the configuration. It should not be run unless you know what you're doing.

Comment 7 Scott Poore 2014-01-13 18:11:15 UTC
Tomas,

Then what would the best way be to enable mkhomedir functionality on an IPA server where we can't use authconfig for winbind?

Thanks,
Scott

Comment 8 Alexander Bokovoy 2014-01-13 18:20:51 UTC
(In reply to Tomas Mraz from comment #6)
> Authconfig is a tool that configures all the services that relate to user
> identity and authentication on the system - it owns the configuration. It
> should not be run unless you know what you're doing.
What configuration is owned by authconfig with regards to this? ipa-client-install did not ask authconfig to touch winbind-related configuration at all, therefore, authconfig has no business in unconfiguring it. 

Note that on IPA master where the above disabling of winbind happens, we never want to use winbind in PAM and NSSWITCH stacks. Instead, it is used internally by IPA for AD trust-related activity and is never asked to be controlled by authconfig. Winbind has number of operating modes and authentication is only one and not the most important one.

I think what we are witnessing here is incorrect logic in authconfig. If an authentication source was never enabled through authconfig, it should not be considered for disabling. Particular case of winbind on IPA masters is an example: winbind is used to provide trusted domains topology and identity source rather than authentication.

Tomas, could you please support this use case which is vital for IPA-AD interoperability in RHEL 7.

Comment 9 Tomas Mraz 2014-01-13 18:44:52 UTC
OK, but this will require serious changes in the logic how authconfig handles starting/restarting and enabling/disabling services.

I am not sure I will be able to finish this for RHEL-7.0, it might have to wait for RHEL-7.1.

Comment 10 Alexander Bokovoy 2014-01-13 18:49:38 UTC
Thanks.

In meantime my recommendation to Scott would be to pass --mkhomedir to ipa-server-install which will cause it to be passed to ipa-client-install and later to authconfig to properly enable home directory creation on logon.

Comment 11 Scott Poore 2014-01-13 22:26:16 UTC
Thanks guys.  I will change our test scripts as necessary.

Comment 14 Scott Poore 2014-01-20 16:51:41 UTC
Quick note, I just tested this out on an existing IPA server where I had winbind running (outside of authconfig):

[root@master ~]# authconfig --enablemkhomedir --updateall
Traceback (most recent call last):
  File "/usr/sbin/authconfig", line 1067, in <module>
    sys.exit(module.run())
  File "/usr/sbin/authconfig", line 662, in run
    self.writeAuthInfo()
  File "/usr/sbin/authconfig", line 633, in writeAuthInfo
    self.info.post(self.options.nostart)
  File "/usr/share/authconfig/authinfo.py", line 4357, in post
    togglefunc(nostart)
  File "/usr/share/authconfig/authinfo.py", line 4283, in toggleNisService
    if self.enableNis and self.nisDomain:
AttributeError: AuthInfo instance has no attribute 'enableNis'


Is this because I did an upgrade to an existing server?  Or I'm missing something that authconfig is looking for?

Thanks,
Scott

Comment 16 Tomas Mraz 2014-01-20 17:20:33 UTC
(In reply to Scott Poore from comment #14)
> Quick note, I just tested this out on an existing IPA server where I had

> Is this because I did an upgrade to an existing server?  Or I'm missing
> something that authconfig is looking for?

This is a typo in the variable name - unfortunately I did not found it during the testing. I'm fixing it just now. However you should not use --updateall but --update as --updateall will trigger the restarts (and in your case disabling winbind as well). I did not change the --updateall behavior only the --update one.

Comment 17 Scott Poore 2014-01-20 17:31:19 UTC
ok, yeah, I do see that --update worked as expected:

[root@master ~]# authconfig --enablemkhomedir --update

[root@master ~]# service winbind status
Redirecting to /bin/systemctl status  winbind.service
winbind.service - Samba Winbind Daemon
   Loaded: loaded (/usr/lib/systemd/system/winbind.service; disabled)
   Active: active (running) since Fri 2014-01-17 19:12:12 CST; 2 days ago
 Main PID: 29098 (winbindd)
   CGroup: /system.slice/winbind.service
           ├─29098 /usr/sbin/winbindd
           ├─29100 /usr/sbin/winbindd
           ├─29101 /usr/sbin/winbindd
           └─29102 /usr/sbin/winbindd

Jan 20 11:18:07 master.ipa1.example.test winbindd[29100]: GSSAPI client step 1
Jan 20 11:18:07 master.ipa1.example.test winbindd[29100]: GSSAPI client step 2
Jan 20 11:23:07 master.ipa1.example.test winbindd[29100]: GSSAPI client step 1
Jan 20 11:23:07 master.ipa1.example.test winbindd[29100]: GSSAPI client step 1
Jan 20 11:23:07 master.ipa1.example.test winbindd[29100]: GSSAPI client step 1
Jan 20 11:23:07 master.ipa1.example.test winbindd[29100]: GSSAPI client step 2
Jan 20 11:28:07 master.ipa1.example.test winbindd[29100]: GSSAPI client step 1
Jan 20 11:28:07 master.ipa1.example.test winbindd[29100]: GSSAPI client step 1
Jan 20 11:28:07 master.ipa1.example.test winbindd[29100]: GSSAPI client step 1
Jan 20 11:28:07 master.ipa1.example.test winbindd[29100]: GSSAPI client step 2

I'll look for the fixed one for updateall and can check that too when available.

thanks

Comment 18 Scott Poore 2014-01-20 19:47:21 UTC
That fixed the problem:

[root@master ~]# authconfig --enablemkhomedir --updateall
[root@master ~]#

Thanks!

Comment 21 David Spurek 2014-02-03 17:31:17 UTC
Yes, change qe_test_coverage and clean qa whiteboard. Fix for this bug should be tested more deeper from my point of view, it may have impact on other parts of authconfig

Comment 22 Scott Poore 2014-02-03 17:36:32 UTC
Clearing out fields so the right group can take care of QA for this.

Thanks

Comment 24 Ludek Smid 2014-06-13 12:43:42 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.