Bug 1438502

Summary: Wrong directory path specified for rpc user
Product: Red Hat Enterprise Linux 6 Reporter: Freddy E. Montero <fmontero>
Component: rpcbindAssignee: Steve Dickson <steved>
Status: CLOSED WONTFIX QA Contact: Yongcheng Yang <yoyang>
Severity: medium Docs Contact:
Priority: high    
Version: 6.9CC: chunwang, dwysocha, eguan, fmontero, jiyin, joedward, rhandlin, rmj, snavale, steved, swhiteho, xzhou, yoyang
Target Milestone: rcKeywords: EasyFix
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1628901 (view as bug list) Environment:
Last Closed: 2017-12-11 16:03:05 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:    
Bug Blocks: 1461138, 1507140    

Description Freddy E. Montero 2017-04-03 14:53:42 UTC
Description of problem:
On the latest version of RHEL 6 (v9), the rpcbind rpm creates an rpc user with directory path "/var/lib/rpcbind" but this directory path does not get created when the rpm is installed. 
The old directory path "/var/cache/rpcbind" gets created instead.

Looking at spec file for (rpcbind-0.2.0-13) the old path still listed:
mkdir -p %{buildroot}/var/cache/rpcbind

and the user now gets created with the wrong home path:
# Softly static allocate the rpc uid and gid.
getent group rpc >/dev/null || groupadd -f -g 32 -r rpc
if ! getent passwd rpc >/dev/null ; then
        if ! getent passwd 32 >/dev/null ; then
           useradd -l -c "Rpcbind Daemon" -d /var/lib/rpcbind  \
              -g rpc -M -s /sbin/nologin -o -u 32 rpc > /dev/null 2>&1
        else
           useradd -l -c "Rpcbind Daemon" -d /var/lib/rpcbind  \
              -g rpc -M -s /sbin/nologin rpc > /dev/null 2>&1
        fi
 fi

This is a change from what was listed on the spec file for (rpcbind-0.2.0-11 [RHEL6v7]) spec file:
rpcid=`getent passwd rpc | cut -d: -f 3`
if [ -n "$rpcid" -a "$rpcid" != "32" ]; then
        /usr/sbin/userdel  rpc 2> /dev/null || :
        /usr/sbin/groupdel rpc 2> /dev/null || :
fi
if [ -z "$rpcid" -o "$rpcid" != "32" ]; then
        /usr/sbin/groupadd -o -g 32 rpc > /dev/null 2>&1
        /usr/sbin/useradd -o -l -c "Rpcbind Daemon" -d /var/cache/rpcbind -g 32 \
        -M -s /sbin/nologin -u 32 rpc > /dev/null 2>&1
fi

Version-Release number of selected component (if applicable):
rpcbind-0.2.0-13.el6.x86_64

How reproducible:
Reproducible every time.

Steps to Reproduce:
1. Install rpcbind-0.2.0-13
2. 
3.

Comment 3 ChunYu Wang 2017-04-04 04:49:46 UTC
(In reply to Freddy E. Montero from comment #0)
> Description of problem:
> On the latest version of RHEL 6 (v9), the rpcbind rpm creates an rpc user
> with directory path "/var/lib/rpcbind" but this directory path does not get
> created when the rpm is installed. 
> The old directory path "/var/cache/rpcbind" gets created instead.
> 
> Looking at spec file for (rpcbind-0.2.0-13) the old path still listed:
> mkdir -p %{buildroot}/var/cache/rpcbind
> 

> Version-Release number of selected component (if applicable):
> rpcbind-0.2.0-13.el6.x86_64
> 
> How reproducible:
> Reproducible every time.
> 

Easy to reproduce with rpcbind-0.2.0-13. Same test on RHEL-7 shows this problem may not exist on them:

- RHEL-6.9 + rpcbind-0.2.0-13
[root@~ ~]# rpm -qa |grep rpcbind
rpcbind-0.2.0-13.el6.x86_64
[root@~ ~]# cat /etc/passwd|grep rpc
rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
[root@~ ~]# test -d /var/lib/rpcbind;echo $?
1


- RHEL-7.4 nightly + rpcbind-0.2.0-39.el7.x86_64
[root@~ ~]# rpm -qa |grep rpcbind
rpcbind-0.2.0-39.el7.x86_64
[root@~ ~]# cat /etc/passwd|grep rpc
rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
[root@~ ~]# test -d /var/lib/rpcbind;echo $?
0

Comment 4 Sagar Navale 2017-04-06 16:08:08 UTC
*** Bug 1439832 has been marked as a duplicate of this bug. ***

Comment 6 Steve Dickson 2017-10-18 15:52:06 UTC
I guess I don't understand what the problem is... 

rpcbind used a new cache directory but the same home directory for the
rpc account. Why is that a problem?

Comment 7 Jonathan Edwards 2017-10-25 19:48:18 UTC
The issue in the rpcbind rpm is that the rpm does not contain a /var/lib/rpcbind nor does the specfile create one - 

%files
%defattr(-,root,root)
%doc AUTHORS ChangeLog README
/sbin/rpcbind
%{_sbindir}/rpcinfo
%{_mandir}/man8/*
%config %{_initddir}/rpcbind

%dir %attr(700,rpc,rpc) /var/cache/rpcbind

however the rpcbind user is created with a home directory of /var/lib/rpcbind .. 

# Softly static allocate the rpc uid and gid.
getent group rpc >/dev/null || groupadd -f -g 32 -r rpc
if ! getent passwd rpc >/dev/null ; then
	if ! getent passwd 32 >/dev/null ; then
	   useradd -l -c "Rpcbind Daemon" -d /var/lib/rpcbind  \
	      -g rpc -M -s /sbin/nologin -o -u 32 rpc > /dev/null 2>&1
	else
	   useradd -l -c "Rpcbind Daemon" -d /var/lib/rpcbind  \
	      -g rpc -M -s /sbin/nologin rpc > /dev/null 2>&1
	fi
 fi


regardless if rpcbind chooses to cache in /var/cache/rpcbind or /var/lib/rpcbind - or if both are created - the /var/lib/rpcbind directory should either be created or the useradd should be adjusted to point to the cache dir

simply fix the specfile and/or the rpm

Comment 9 Steve Dickson 2017-11-08 15:05:19 UTC
(In reply to Jonathan Edwards from comment #7)
>
> # Softly static allocate the rpc uid and gid.
> getent group rpc >/dev/null || groupadd -f -g 32 -r rpc
> if ! getent passwd rpc >/dev/null ; then
> 	if ! getent passwd 32 >/dev/null ; then
> 	   useradd -l -c "Rpcbind Daemon" -d /var/lib/rpcbind  \
> 	      -g rpc -M -s /sbin/nologin -o -u 32 rpc > /dev/null 2>&1
> 	else
> 	   useradd -l -c "Rpcbind Daemon" -d /var/lib/rpcbind  \
> 	      -g rpc -M -s /sbin/nologin rpc > /dev/null 2>&1
> 	fi
>  fi
> 
> 
> regardless if rpcbind chooses to cache in /var/cache/rpcbind or
> /var/lib/rpcbind - or if both are created - the /var/lib/rpcbind directory
> should either be created or the useradd should be adjusted to point to the
> cache dir
> 
> simply fix the specfile and/or the rpm
What I don't understand is why /var/lib/rpcbind is not being created.
Looking at useradd(8) the '-d' should be creating the directory 
"The new user will be created using HOME_DIR as the value for the user."
and it usually does..

I guess the logic behind using both /var/cache and /var/lib is
caches are not stable (aka they can be removed) which is
not the case with home directories... They need to be stable.

Comment 10 Steve Whitehouse 2017-12-01 10:46:50 UTC
SteveD, what is the status on this one? We need to decide what we need to do here.

Comment 11 Steve Dickson 2017-12-11 16:02:56 UTC
I don't see a problem here... devel nacking

Comment 12 Red Hat Bugzilla Rules Engine 2017-12-11 16:03:05 UTC
Development Management has reviewed and declined this request. You may appeal this decision by reopening this request.