Bug 1353964

Summary: Log files for ipa in /var/log/ipa and /var/log directory must have similar permissions.
Product: Red Hat Enterprise Linux 8 Reporter: Sudhir Menon <sumenon>
Component: ipaAssignee: IPA Maintainers <ipa-maint>
Status: CLOSED WONTFIX QA Contact: Kaleem <ksiddiqu>
Severity: unspecified Docs Contact:
Priority: medium    
Version: 8.0CC: ipa-maint, pasik, pcech, pvoborni, rcritten, tscherf
Target Milestone: rcKeywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-22 11:49: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:

Description Sudhir Menon 2016-07-08 14:31:47 UTC
Description of problem: Log files in /var/log/ipa directory have different permissions.

Version-Release number of selected component (if applicable):
ipa-server-4.4.0-1.el7.x86_64

How reproducible: Always

Steps to Reproduce:

1. Install IPA server
2. Navigate to /var/log/ipa directory and check log file permissions.
3. Check /var/log directory for ipa related log file permissions.

Actual results:

/var/log/ipa
[root@server ipa]# ls -l
-rw-r--r--. 1 root root 4830 Jul  8 18:27 ipactl.log
-rw-------  1 root root    0 Jul  5 14:51 renew.log
-rw-r--r--  1 root root  912 Jul  8 17:52 server.log

[root@server log]# pwd
/var/log
-rw-------  1 root   root      54141 Jul  8 16:47 ipabackup.log
-rw-------. 1 root   root      62059 Jul  8 16:54 ipaclient-install.log
-rw-------. 1 root   root      47168 Jul  8 12:00 ipaclient-uninstall.log
-rw-------  1 root   root       5749 Jul  8 16:10 ipareplica-install.log
-rw-------  1 root   root      36796 Jul  8 17:24 iparestore.log
-rw-------. 1 root   root      28651 Jul  8 18:43 ipaserver-install.log
-rw-------  1 root   root      91545 Jul  8 17:58 ipaserver-kra-install.log
-rw-------  1 root   root       2562 Jul  8 17:15 ipaserver-kra-uninstall.log
-rw-------. 1 root   root      65098 Jul  8 12:00 ipaserver-uninstall.log
-rw-------  1 root   root      61890 Jul  8 11:41 ipaserver-uninstall.log.crash
-rw-------  1 root   root   10542916 Jul  8 17:30 ipaupgrade.log

Expected results:
Permissions of log file should be consistent with other log files of ipaserver
i.e 600 unless specifically required to be different.

Additional info:

Comment 2 Petr Vobornik 2016-07-21 15:55:43 UTC
triage notes:     
"""
mbasti: it looks like these logs (ipactl.log, default.log) are created by something else (systemd?) and they contain text from stderr

I suspect that ipactl.log is STDERR output from `systemctl start ipa`

IPA default logger setup has permission 0o600
"""

Comment 3 Petr Vobornik 2016-07-21 15:56:24 UTC
Upstream ticket:
https://fedorahosted.org/freeipa/ticket/6104

Comment 7 Rob Crittenden 2020-08-25 17:43:51 UTC
These are logs created via the context log in ipalib/plugable.py and not by standard ipa logger.

We can approach this in one of two ways:

If the log doesn't exist:
    create it
    chmod it to 0600

or

If the log doesn't exist:
     create it
chmod it to 0600

Something like:

diff --git a/ipalib/plugable.py b/ipalib/plugable.py
index 4c2782dbf..899805b46 100644
--- a/ipalib/plugable.py
+++ b/ipalib/plugable.py
@@ -521,6 +521,9 @@ class API(ReadOnly):
         if self.env.log is not None:
             try:
                 handler = logging.FileHandler(self.env.log)
+                if not os.path.exists(self.env.log):
+                    open(self.env.log, 'a').close()
+                os.chmod(self.env.log, 0o600)
             except IOError as e:
                 logger.error('Cannot open log file %r: %s', self.env.log, e)
             else:


I don't know why a user would want to temporarily change the mode of the log file and the second method would tighten up perms on existing context logs once the context is used again.

Comment 10 Petr Čech 2020-10-22 11:49:18 UTC
This BZ has been evaluated multiple times over the last several years and we assessed that it is a valuable request to keep in the backlog and address it at some point in future. Time showed that we did not have such capacity, nor have it now nor will have in the foreseeable future. In such a situation keeping it in the backlog is misleading and setting the wrong expectation that we will be able to address it. Unfortunately we will not. To reflect this we are closing this BZ. If you disagree with the decision please reopen or open a new support case and create a new BZ. However this does not guarantee that the request will not be closed during the triage as we are currently applying much more rigor to what we actually can accomplish in the foreseeable future. Contributions and collaboration in the upstream community and CentOS Stream is always welcome!
Thank you for understanding.
Red Hat Enterprise Linux Identity Management Team

Comment 11 Red Hat Bugzilla 2023-09-14 03:27:47 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 1000 days