Bug 849538 - Lookup and login for new users fails when /var is full
Lookup and login for new users fails when /var is full
Status: CLOSED DEFERRED
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: sssd (Show other bugs)
7.2
All Linux
medium Severity medium
: rc
: ---
Assigned To: SSSD Maintainers
Kaushik Banerjee
: Reopened
Depends On:
Blocks: 1113520
  Show dependency treegraph
 
Reported: 2012-08-20 03:02 EDT by Sigbjorn Lie
Modified: 2016-08-10 03:41 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-08-10 01:20:17 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Sigbjorn Lie 2012-08-20 03:02:33 EDT
Description of problem:
Lookup and login for new users fails when /var is full

Version-Release number of selected component (if applicable):
1.8.0-32


Steps to Reproduce:
Full up /var. Attempt to log in with a not cached user, or run "id not-cached-username" in an already logged in shell.
User cannot be looked up and an user not found message is displayed.
  
Expected results:
I should still be able to log in when sssd in online, even /var is full.

Additional info:
I am using IPA as backend.
Comment 2 Jakub Hrozek 2012-08-20 06:12:27 EDT
Upstream ticket:
https://fedorahosted.org/sssd/ticket/1212
Comment 3 Jakub Hrozek 2012-08-20 06:14:00 EDT
This was already discussed upstream a while ago and got deferred -- see https://fedorahosted.org/sssd/ticket/1212#comment:1
Comment 4 Sigbjorn Lie 2012-08-20 06:37:55 EDT
I see deferring this issue as a bad desicion. There is a focus to disable the root accounts in our organization, and other organizations. In the case of a full /var would then disable admins from logging on to the server and fixing the full disk issue.

If anything, this should be treatet as a high priority security issue as an attacker can fill up /var to prevent the administrators to log in.

Putting /var/lib/sss on a seperate partition is an ugly hack. Show me how many people actually do this?

I do not expect the cached logins to work (offline logins) when /var is full. Only when sssd is online the logins should work regardsless of a full /var.

Please reconsider the status of this bug.

Thank you.
Comment 5 Stephen Gallagher 2012-08-20 07:44:28 EDT
(In reply to comment #4)
> I see deferring this issue as a bad desicion. There is a focus to disable
> the root accounts in our organization, and other organizations. In the case
> of a full /var would then disable admins from logging on to the server and
> fixing the full disk issue.
> 

Disabling root completely and relying on network auth exclusively is a security issue. Anything that manages to remove your network access will result in you being unable to resolve the issues. Root should always be present on the system so that single-user mode is at least available.

> If anything, this should be treatet as a high priority security issue as an
> attacker can fill up /var to prevent the administrators to log in.
> 
> Putting /var/lib/sss on a seperate partition is an ugly hack. Show me how
> many people actually do this?
> 

Not many people put /var/lib/sss itself on a separate partition. A *great* many people store /var/log on a separate partition (often even a network share), which is the number one reason why /var would fill up.

> I do not expect the cached logins to work (offline logins) when /var is
> full. Only when sssd is online the logins should work regardsless of a full
> /var.
> 

The issue is nowhere near as simple as you think it is. The architecture of the SSSD requires the use of the cache during authentication. It would be a substantial redesign to accommodate what is a genuine edge-case.

> Please reconsider the status of this bug.
> 

We recognize that it is an issue, and we'll be taking your request into account. However, given the invasive nature of the necessary changes compared to the low likelihood of the partition filling up (if /var/log is properly isolated), it's likely that we will continue to defer this in favor of spending our effort on higher-priority issues and enhancements.

Patches from the community to address this issue would be welcomed warmly and we'd be happy to assist anyone who wishes to take this on.
Comment 6 Sigbjorn Lie 2012-08-23 07:03:50 EDT
Yes the root account will always be available, however several of our customers are having a strong password set for root accounts and this password is locked away where only a very few people have access to them. The rest of the admin users have to use their networked accounts to access the server. A particular company I worked for this did this where the people with direct root access was only available in a different country with a different timezone.

Other companies I have worked for have had the root password locked away in a safe.

If these practices are the best practices can be discussed, but that's a seperate discussion. Having the networked access disabled just due to a full disk is unacceptable in these situations. And to my knowledge, more and more companies are moving towards having direct root access "removed", only accessing root privileges throgh sudo or similar tools.

What these companies have in common is that they all run Red Hat EL. Having SSSD failing at full filesystems might prevent their adoption of SSSD.


You assume that it's /var/log filling up the disk. I would say it's more of a common practice to seperate /var from /. I've seen a great many applications fill up /var, for instance mysql in it's default data path /var/lib/mysql. I have also seen cfengine creating large log files in it's default directory /var/cfengine, large files uploaded to a web directory in /var/www, and the list just keeps going on.


I do not know the internals of SSSD so I do not know the amount of work required to implement this. But as far as I understand SSSD will always attempt to use the cache, and if it fails either due to an expired record or non existing record it will continue to the network server.

If the issue lies with the cache engine: What if the db files sssd uses we're allocated larger on disk than their actual usage? I'm not speaking of much, but some extra MB would not be a big issue. By doing this the space would already be allocated when needed in case of a full filesystem.
Comment 10 Jakub Hrozek 2013-01-02 15:04:30 EST
One thing we could do would be to force a cleanup when the back end encounters the ENOSPC error. That would be a smallish investment, but in many cases, I'm not sure how much it would help with the current cache cleanup design.

We might change the cleanup task a bit to have an "emergency mode" and i.e. pick and remove a user entry without cached password (currently we pick a user entry w/o a password that hasn't been refreshed in a long time) or maybe group with ghost users only, set the group as expired and trim its ghost members. This would be quite simple, but usually the reason /var got full is another program flooding the logs or as Sigbjorn said, growing its database, such as mysql. This solution would only be temporary if another process is filling up /var.

W might also reserve a couple of entries for the ENOSPC situation and use them as some kind of cycle buffer, for example. I'm not sure how practical it would be as there's no guarantee on how much space we might need for a login of a new user when he comes in (the user might be a member of several large groups, for example).

Returning entries without caching them at all is simply not possible in the SSSD with its current design.
Comment 14 Sigbjorn Lie 2013-12-12 07:27:23 EST
What is the status of this request? Has any of the suggestions Jakub had made it into the code of SSSD?
Comment 15 Jakub Hrozek 2013-12-12 07:34:09 EST
No, sorry, as stated in one of the comments above, any kind of forced cleanup would only be temporary and /var would usually be filled up really quickly again.

The best solution would be to put the database (or the /var/logs, /var/cache to tackle the problem the other way around) to a separate partition.
Comment 16 Sigbjorn Lie 2013-12-20 02:17:25 EST
I suggest putting /var/lib/sss/ on a seperate partition instead. It's the only way to ensure that there will always be enough space for sssd to allow logins.
Comment 17 Jakub Hrozek 2013-12-20 04:07:49 EST
Right, that's a good solution.
Comment 18 Sigbjorn Lie 2013-12-20 04:55:51 EST
What would a reasonable size be? I suppose it depends somewhat of the size of organization. We are using about 24MB in /var/lib/sss today. How much can we expect this to grow?
Comment 19 Jakub Hrozek 2013-12-20 06:59:06 EST
Depends on how many users do you expect to have cached..

The largest environment I have readily access to has about 7000 users and about the same number of groups. After enumerating the whole directory, the cache is about 115MB in size. 

With IPA you'd store more data, primarily HBAC rules are cached as well, but anyway, I'd be suprised if you needed more than 1GB, even with a large directory.
Comment 20 Martin Kosek 2015-04-24 07:23:34 EDT
Thank you taking your time and submitting this request for Red Hat Enterprise Linux. Unfortunately, this bug was not given a priority and was deferred both in the upstream project and in Red Hat Enterprise Linux.

Given that we are unable to fulfill this request in following Red Hat Enterprise Linux releases, I am closing the Bugzilla as DEFERRED. To request that Red Hat re-considers the decision, please re-open the Bugzilla via appropriate support channels and provide additional business and/or technical details about its importance to you.

Note that you can still track this request or even contribute patches in the referred upstream Trac ticket.
Comment 21 Abhinay Reddy Peddireddy 2016-08-09 18:56:20 EDT
Re-opening this bug as per the request from the same customer "Amway Japan" with the account number : 532521. 

Customer comment : 

We want to reopen this bug and request a solution for it.

We want to expedite this to the next level.

We have a valid support contract and last time we needed to wait a full year to get a solution !!
https://access.redhat.com/support/cases/#/case/01360311

We need a solution for this bug as we use the OS in a cloud environment. 
Logging in via ssh is the only method we are able to do.
The cloud environment does not allow for direct root login for obvious reasons.
Comment 22 Lukas Slebodnik 2016-08-10 01:20:17 EDT
sssd should not replace the monitoring of machine and solution is already described in comment 16.
Comment 23 Jakub Hrozek 2016-08-10 03:41:41 EDT
To expand a bit on Lukas' comment - there is virtually nothing we *can* do, it's not like we just decline to do the work. The cache is an architectural component of SSSD and there is no way around it. Before entries are returned from the cache, they *must* be saved to the cache first. And if the disk is full and we can't save data to the cache, there is just no way we can process the request.

You can see some basic diagrams here:
https://jhrozek.wordpress.com/2015/03/11/anatomy-of-sssd-user-lookup/

Note You need to log in before you can comment on or make changes to this bug.