#3195 Wrong group-owner of nssdb
Closed: fixed 3 years ago by cipherboy. Opened 3 years ago by slev.

Some platforms may not provide statically allocated users/groups ids for known daemons.
Typo in pki/server/deployment/scriptlets/security_databases.py leads to:

pkispawn
...

# LANG=C ls -la /etc/pki/pki-tomcat/alias/
total 76
drwxrwx--- 2 pkiuser geoclue  4096 Jul 28 17:44 .
drwxrwx--- 5 pkiuser pkiuser  4096 Jul 28 17:44 ..
-rw------- 1 pkiuser geoclue 28672 Jul 28 17:44 cert9.db
-rw------- 1 pkiuser geoclue 36864 Jul 28 17:44 key4.db
-rw------- 1 pkiuser geoclue   432 Jul 28 17:44 pkcs11.txt

[root@dc ~]# getent passwd pkiuser
pkiuser: x:462:436:Certificate System:/var/lib/pki:/sbin/nologin

[root@dc ~]# getent group 462
geoclue: x:462:

[root@dc ~]# getent group pkiuser
pkiuser: x:436:

(Pdb) w
  /usr/lib64/python3.7/runpy.py(193)_run_module_as_main()
-> "__main__", mod_spec)
  /usr/lib64/python3.7/runpy.py(85)_run_code()
-> exec(code, run_globals)
  /usr/lib/python3/site-packages/pki/server/pkispawn.py(931)<module>()
-> main(sys.argv)
  /usr/lib/python3/site-packages/pki/server/pkispawn.py(547)main()
-> scriptlet.spawn(deployer)
> /usr/lib/python3/site-packages/pki/server/deployment/scriptlets/security_databases.py(94)spawn()
-> pki.util.chown(
(Pdb) deployer.mdict['pki_uid']
462
(Pdb) deployer.mdict['pki_gid']
436

Fix for this is trivial:

diff --git a/base/server/python/pki/server/deployment/scriptlets/security_databases.py b/base/>
index 798bf3b95..613ffdc17 100644
--- a/base/server/python/pki/server/deployment/scriptlets/security_databases.py
+++ b/base/server/python/pki/server/deployment/scriptlets/security_databases.py
@@ -108,7 +108,7 @@ class PkiScriptlet(pkiscriptlet.AbstractBasePkiScriptlet):
         pki.util.chown(
             deployer.mdict['pki_server_database_path'],
             deployer.mdict['pki_uid'],
-            deployer.mdict['pki_uid'])
+            deployer.mdict['pki_gid'])
         pki.util.chmod(
             deployer.mdict['pki_server_database_path'],
             config.PKI_DEPLOYMENT_DEFAULT_SECURITY_DATABASE_PERMISSIONS)

While the upgrade clause may be not so trivial, I'm checking.

Closing as merged upstream. Thanks @slev!

Metadata Update from @cipherboy:
- Custom field component adjusted to None
- Custom field feature adjusted to None
- Custom field origin adjusted to None
- Custom field proposedmilestone adjusted to None
- Custom field proposedpriority adjusted to None
- Custom field reviewer adjusted to None
- Custom field type adjusted to None
- Custom field version adjusted to None
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

3 years ago

There is no upgrade part.
If I understand correctly, @edewata mentioned this in:
https://github.com/dogtagpki/pki/pull/500#discussion_r463039593

I would consider to re-open this.

Dogtag PKI is moving from Pagure issues to GitHub issues. This means that existing or new
issues will be reported and tracked through Dogtag PKI's GitHub Issue tracker.

This issue has been cloned to GitHub and is available here:
https://github.com/dogtagpki/pki/issues/3312

If you want to receive further updates on the issue, please navigate to the
GitHub issue and click on Subscribe button.

Thank you for understanding, and we apologize for any inconvenience.

Login to comment on this ticket.

Metadata