Bug 1319356

Summary: offline sudo does not work
Product: [Fedora] Fedora Reporter: Adam Williamson <awilliam>
Component: sssdAssignee: Jakub Hrozek <jhrozek>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 23CC: abokovoy, awilliam, jhrozek, lslebodn, mkosek, pbrezina, rharwood, sbose, ssorce
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-12-20 19:30:45 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:
Attachments:
Description Flags
sssd_sudo log
none
sssd_happyassassin log
none
sudo debug log none

Description Adam Williamson 2016-03-18 23:37:58 UTC
I have a personal FreeIPA domain set up. On one of my laptops, which is running F23, I can't seem to sudo when the machine is offline (or on the internet but cannot reach the FreeIPA server, e.g. not running on my local network). I can sudo just fine as long as I can reach the server, but offline caching via sssd does not seem to work.

I have this in /etc/nssswitch.conf :

sudoers:    sss

note - not "files sss". I have this /etc/sssd/sssd.conf:

---------------

[domain/happyassassin.net]

cache_credentials = True
krb5_store_password_if_offline = True
ipa_domain = happyassassin.net
id_provider = ipa
auth_provider = ipa
access_provider = ipa
ipa_hostname = xps13.happyassassin.net
chpass_provider = ipa
ipa_server = _srv_, id.happyassassin.net
ldap_tls_cacert = /etc/ipa/ca.crt

# for SUDO via FreeIPA
sudo_provider = ldap
ldap_uri = ldaps://id.happyassassin.net
ldap_sudo_search_base = ou=sudoers,dc=happyassassin,dc=net
ldap_sasl_mech = GSSAPI
ldap_sasl_authid = host/xps13.happyassassin.net
ldap_sasl_realm = HAPPYASSASSIN.NET
krb5_server = id.happyassassin.net

[sssd]
services = nss, pam, ssh, sudo
config_file_version = 2

domains = happyassassin.net
[nss]

[pam]

[sudo]

[autofs]

[ssh]

[pac]

-----------------------

I think if I make nsswitch.conf 'files sss' it would work, but it would be kinda cheating - it'd just work because my user happens to be in the wheel group and /etc/sudoers allows anyone in wheel to sudo. So it wouldn't be using FreeIPA at all in that case. AIUI, this is supposed to work via sssd.

Comment 1 Lukas Slebodnik 2016-03-19 10:22:32 UTC
(In reply to Adam Williamson from comment #0)
> I have a personal FreeIPA domain set up. On one of my laptops, which is
> running F23, I can't seem to sudo when the machine is offline (or on the
> internet but cannot reach the FreeIPA server, e.g. not running on my local
> network). I can sudo just fine as long as I can reach the server, but
> offline caching via sssd does not seem to work.
> 
> I have this in /etc/nssswitch.conf :
> 
> sudoers:    sss
> 
> note - not "files sss". I have this /etc/sssd/sssd.conf:
> 
> ---------------
> 
> [domain/happyassassin.net]
> 
> cache_credentials = True
> krb5_store_password_if_offline = True
> ipa_domain = happyassassin.net
> id_provider = ipa
> auth_provider = ipa
> access_provider = ipa
> ipa_hostname = xps13.happyassassin.net
> chpass_provider = ipa
> ipa_server = _srv_, id.happyassassin.net
> ldap_tls_cacert = /etc/ipa/ca.crt
> 
> # for SUDO via FreeIPA
> sudo_provider = ldap
> ldap_uri = ldaps://id.happyassassin.net
> ldap_sudo_search_base = ou=sudoers,dc=happyassassin,dc=net
> ldap_sasl_mech = GSSAPI
> ldap_sasl_authid = host/xps13.happyassassin.net
> ldap_sasl_realm = HAPPYASSASSIN.NET
> krb5_server = id.happyassassin.net
>
You need't use "sudo_provider = ldap" with freeipa since sssd-1.10.0
 
> [sssd]
> services = nss, pam, ssh, sudo
> config_file_version = 2
> 
> domains = happyassassin.net
> [nss]
> 
> [pam]
> 
> [sudo]
> 
> [autofs]
> 
> [ssh]
> 
> [pac]
> 
> -----------------------
> 
> I think if I make nsswitch.conf 'files sss' it would work, but it would be
> kinda cheating - it'd just work because my user happens to be in the wheel
> group and /etc/sudoers allows anyone in wheel to sudo. So it wouldn't be
> using FreeIPA at all in that case. AIUI, this is supposed to work via sssd.

What is a difference between output of "sudo -l" when sssd in connected to IPA and when sssd is offline?

Comment 2 Adam Williamson 2016-03-31 05:47:13 UTC
sorry, forgot to check on this, will do it soon.

Comment 3 Adam Williamson 2016-03-31 20:27:38 UTC
jeez, I've been hating this bug for like six months and now the *one* time I go to reproduce it intentionally for a needinfo, it mysteriously disappears? What the hell? I just turned off my wifi, tried rebooting with it turned off, and sudo is working like a champ. Bizarre. I really doubt this bug is actually fixed, though, so I'm not gonna close it yet. Next time it happens I'll try and remember to run sudo -l. If it somehow really does stop happening in the wild I'll close the bug after a bit.

Comment 4 Adam Williamson 2016-03-31 20:28:32 UTC
oh, on the 'sudo_provider=ldap' bit - can i drop that whole chunk you quoted, or only the sudo_provider line?

Comment 5 Jakub Hrozek 2016-03-31 21:08:44 UTC
(In reply to Adam Williamson from comment #4)
> oh, on the 'sudo_provider=ldap' bit - can i drop that whole chunk you
> quoted, or only the sudo_provider line?

You can drop the whole block with the ldap_ and krb5_ options following the comment that says "# for SUDO via FreeIPA"

Comment 6 Lukas Slebodnik 2016-04-21 12:58:05 UTC
Adam,
are you able to reproduce this bug?
or should we close it?

Comment 7 Adam Williamson 2016-04-21 15:29:50 UTC
sorry, yes, it still happens all the time.

sudo -l output is not very enlightening, just:

[adamw@xps13 ~]$ sudo -l
[sudo] password for adamw: 
User adamw is not allowed to run sudo on xps13.

When I'm on the network:

[adamw@xps13 fedora_nightlies (master %)]$ sudo -l
[sudo] password for adamw: 
User adamw may run the following commands on xps13:
    (ALL) ALL

Comment 8 Jakub Hrozek 2016-04-21 15:33:42 UTC
It would be really useful to collect sssd debug logs along with sudo debug logs to diagnose the issue:
https://fedorahosted.org/sssd/wiki/HOWTO_Troubleshoot_SUDO

Comment 9 Adam Williamson 2016-04-28 16:50:27 UTC
I'm getting to it. If there's anything else you might need can you please list it now? It's easier for me to get it all at once than have to keep coming back to this bug to get something different.

Comment 10 Adam Williamson 2016-05-03 20:00:45 UTC
Sigh, so once again this one goes away when I try to look at it in detail. Let me try and remember the sequence of events here:

1. Started with my laptop on the network as usual
2. Disconnected from the network, tried to sudo, got denied
3. Removed now-unnecessary block from sssd.conf and added debugging statements there and to sudo.conf, restarted sssd, tried to sudo, go denied
4. Got back on the network, sudo worked again
5. Disconnected and tried to sudo immediately, it worked (no password)
6. Waited some time and tried to sudo again, still worked (prompted for password)
7. Rebooted, disconnected from network, tried to sudo, it worked (password prompt)

So I do have logs with *one* instance of the failure case, but now I can't seem to trigger it again. I guess it's possible that removing the 'unnecessary' block from the sssd.conf changed things? I'll leave the debug statements in for now and see, once again, if this still happens when I travel...I'll also attach the logs, just for interest.

Comment 11 Adam Williamson 2016-05-03 20:32:16 UTC
Created attachment 1153580 [details]
sssd_sudo log

Comment 12 Adam Williamson 2016-05-03 20:35:35 UTC
Created attachment 1153583 [details]
sssd_happyassassin log

Comment 13 Adam Williamson 2016-05-03 20:36:06 UTC
Created attachment 1153584 [details]
sudo debug log

Comment 14 Pavel Březina 2016-05-06 08:51:09 UTC
Hi,
thank you for tha logs. I can see that sssd give rules to sudo for evaluation even when offline. Unfortunately the sudo logs doesn't contains information I'd like to see, do you have "Debug sudo /var/log/sudo_debug all@debug" in /etc/sudo.conf?

Can you sent us how does the sudo rule look like (ipa sudorule-show)?

Comment 15 Adam Williamson 2016-09-26 20:44:51 UTC
Still seeing this (laptop's on F24 at present). I've just added that line to sudo.conf . I'll get updated logs when I can.

Comment 16 Fedora End Of Life 2016-11-24 16:08:13 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '23'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 23 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 17 Fedora End Of Life 2016-12-20 19:30:45 UTC
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.