Bug 1655594

Summary: created backup may contain unexpected strings at the end of file
Product: Red Hat Enterprise Linux 8 Reporter: Pavel Březina <pbrezina>
Component: authselectAssignee: Pavel Březina <pbrezina>
Status: CLOSED CURRENTRELEASE QA Contact: Steeve Goveas <sgoveas>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.0CC: extras-qa, pbrezina, sgadekar
Target Milestone: rc   
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1655025 Environment:
Last Closed: 2019-06-14 02:03:18 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:
Embargoed:
Bug Depends On: 1655025    
Bug Blocks:    

Description Pavel Březina 2018-12-03 14:04:34 UTC
+++ This bug was initially created as a clone of Bug #1655025 +++

Due to a buffer error, created backups may contain unexpected strings at the end of backed up file.

How to reproduce:
$ sudo bin/authselect select sssd --force
Backup stored at /dev/shm/install/var/lib/authselect/backups/2018-11-30-10-54-59.33ajk7
Profile "sssd" was selected.
The following nsswitch maps are overwritten by the profile:
- passwd
- group
- netgroup
- automount
- services

Make sure that SSSD service is configured and enabled. See SSSD documentation for more information.

$ sudo cat /dev/shm/install/var/lib/authselect/backups/2018-11-30-10-54-59.33ajk7/nsswitch.conf
-> the output may contain unexpected string at the end of file

--- Additional comment from Pavel Březina on 2018-11-30 06:08:41 EST ---

Upstream ticket:
https://github.com/pbrezina/authselect/issues/123

Comment 2 shridhar 2019-01-08 09:24:20 UTC
verified with   sssd-2.0.0-32.el8.x86_64

[root@auto-hv-02-guest07 ~]# cat /var/lib/authselect/backups/2018-12-31-07-50-59.LBivPx/nsswitch.conf
#

    /etc/nsswitch.conf
    #
    An example Name Service Switch config file. This file should be
    sorted with the most-used services at the beginning.
    #
    The entry '[NOTFOUND=return]' means that the search for an
    entry should stop if the search in the previous entry turned
    up nothing. Note that if the search failed due to some other reason
    (like no NIS server responding) then the search continues with the
    next entry.
    #
    Valid entries include:
    #
    nisplus Use NIS+ (NIS version 3)
    nis Use NIS (NIS version 2), also called YP
    dns Use DNS (Domain Name Service)
    files Use the local files in /etc
    db Use the pre-processed /var/db files
    compat Use /etc files plus *_compat pseudo-databases
    hesiod Use Hesiod (DNS) for user lookups
    sss Use sssd (System Security Services Daemon)
    [NOTFOUND=return] Stop searching if not found so far
    #
    'sssd' performs its own 'files'-based caching, so it should
    generally come before 'files'.

    To use 'db', install the nss_db package, and put the 'db' in front
    of 'files' for entries you want to be looked up first in the
    databases, like this:
    #
    passwd: db files
    shadow: db files
    group: db files

passwd: sss files systemd
shadow: files sss
group: sss files systemd

hosts: files dns myhostname

bootparams: files

ethers: files
netmasks: files
networks: files
protocols: files
rpc: files
services: files sss

netgroup: sss

publickey: files

automount: files sss
aliases: files
[root@auto-hv-02-guest07 ~]# cat /var/lib/authselect/backups/2018-12-31-07-50-59.LBivPx/
fingerprint-auth nsswitch.conf password-auth postlogin smartcard-auth system-auth
[root@auto-hv-02-guest07 ~]# cat /var/lib/authselect/backups/2018-12-31-07-50-59.LBivPx/fingerprint-auth
#%PAM-1.0

    This file is auto-generated.
    User changes will be destroyed the next time authselect is run.
    auth required pam_env.so
    auth sufficient pam_fprintd.so
    auth required pam_deny.so

account required pam_unix.so
account sufficient pam_localuser.so
account sufficient pam_succeed_if.so uid < 500 quiet
account required pam_permit.so

password required pam_deny.so

session optional pam_keyinit.so revoke
session required pam_limits.so
-session optional pam_systemd.so
session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session required pam_unix.so
[root@auto-hv-02-guest07 ~]# cat /var/lib/authselect/backups/2018-12-31-07-50-59.LBivPx/
fingerprint-auth nsswitch.conf password-auth postlogin smartcard-auth system-auth
[root@auto-hv-02-guest07 ~]# cat /var/lib/authselect/backups/2018-12-31-07-50-59.LBivPx/password-auth
#%PAM-1.0

    This file is auto-generated.
    User changes will be destroyed the next time authselect is run.
    auth required pam_env.so
    auth sufficient pam_unix.so try_first_pass nullok
    auth required pam_deny.so

account required pam_unix.so

password requisite pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=
password sufficient pam_unix.so try_first_pass use_authtok nullok sha512 shadow
password required pam_deny.so

session optional pam_keyinit.so revoke
session required pam_limits.so
-session optional pam_systemd.so
session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session required pam_unix.so
[root@auto-hv-02-guest07 ~]# cat /var/lib/authselect/backups/2018-12-31-07-50-59.LBivPx/
fingerprint-auth nsswitch.conf password-auth postlogin smartcard-auth system-auth
[root@auto-hv-02-guest07 ~]# cat /var/lib/authselect/backups/2018-12-31-07-50-59.LBivPx/smartcard-auth
#%PAM-1.0

    This file is auto-generated.
    User changes will be destroyed the next time authselect is run.
    auth required pam_env.so
    auth [success=done ignore=ignore default=die] pam_pkcs11.so wait_for_card
    auth required pam_deny.so

account required pam_unix.so
account sufficient pam_localuser.so
account sufficient pam_succeed_if.so uid < 500 quiet
account required pam_permit.so

password optional pam_pkcs11.so

session optional pam_keyinit.so revoke
session required pam_limits.so
-session optional pam_systemd.so
session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session required pam_unix.so
[root@auto-hv-02-guest07 ~]# cat /var/lib/authselect/backups/2018-12-31-07-50-59.LBivPx/
fingerprint-auth nsswitch.conf password-auth postlogin smartcard-auth system-auth
[root@auto-hv-02-guest07 ~]# cat /var/lib/authselect/backups/2018-12-31-07-50-59.LBivPx/
fingerprint-auth nsswitch.conf password-auth postlogin smartcard-auth system-auth
[root@auto-hv-02-guest07 ~]# cat /var/lib/authselect/backups/2018-12-31-07-50-59.LBivPx/
fingerprint-auth nsswitch.conf password-auth postlogin smartcard-auth system-auth
[root@auto-hv-02-guest07 ~]# cat /var/lib/authselect/backups/2018-12-31-07-50-59.LBivPx/
fingerprint-auth nsswitch.conf password-auth postlogin smartcard-auth system-auth
[root@auto-hv-02-guest07 ~]# cat /var/lib/authselect/backups/2018-12-31-07-50-59.LBivPx/
fingerprint-auth nsswitch.conf password-auth postlogin smartcard-auth system-auth
[root@auto-hv-02-guest07 ~]# cat /var/lib/authselect/backups/2018-12-31-07-50-59.LBivPx/
fingerprint-auth nsswitch.conf password-auth postlogin smartcard-auth system-auth
[root@auto-hv-02-guest07 ~]# cat /var/lib/authselect/backups/2018-12-31-07-50-59.LBivPx/system-auth
#%PAM-1.0

    This file is auto-generated.
    User changes will be destroyed the next time authselect is run.
    auth required pam_env.so
    auth sufficient pam_unix.so try_first_pass nullok
    auth required pam_deny.so

account required pam_unix.so

password requisite pam_pwquality.so try_first_pass local_users_only retry=3 authtok_type=
password sufficient pam_unix.so try_first_pass use_authtok nullok sha512 shadow
password required pam_deny.so

session optional pam_keyinit.so revoke
session required pam_limits.so
-session optional pam_systemd.so
session [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session required pam_unix.so