Repository: cobbler/cobbler

Issue:
Cobblerd start failure due to incorrect ownership of /var/lib/cobbler/web.ss
As has been noted for some time, cobblerd will fail to start after a restart, giving an error about /var/lib/cobbler/web.ss. This was reported in https://github.com/cobbler/cobbler/issues/2183, and discussed elsewhere. When successfully starting, the permission began as: 

`
-rw-r--r--. 1 root root system_u:object_r:cobbler_var_lib_t:s0 1024 Jun  7 09:46 /var/lib/cobbler/web.ss
`

but after starting, the permission becomes:

`
-rw-r--r--. 1 apache root system_u:object_r:cobbler_var_lib_t:s0 1024 Jun  7 09:47 /var/lib/cobbler/web.ss
`

And while the ownership remains as apache, the cobblerd server will fail to start.

<!--- A clear and concise description of what the bug is. -->

The problem is that in cobblerd.py:regen_ss_file(), after this file is created by cobblerd  for  use in authorizing the CLI and web, the routine changes the ownership to 'apache',  and then when the process is restarted, the routine once again tries to open it for writing the random 1024 byte auth token, the open fails. Changing the ownership back to root fixes the issue.

<!--- HINT: You can paste gist.github.com links for long logs or larger files -->

### Steps to reproduce

1. Start the server for the first time... it starts.
2. Restart the server, It will fail with an error opening /var/lib/cobbler/web.ss
3. Changing the ownership of the file back to root.root and restarting will succeed.

### Expected behavior

<!--- A clear and concise description of what you expected to happen. -->
The cobblerd service would restart each and every time.

### Cobbler version

<!--- Paste output from `cobbler version` -->
````
Cobbler 3.3.3
  source: ?, ?
  build time: Tue Jun 14 00:00:00 2022
````
(From EPEL 9 repository)

### Operating system

<!--- On which operating system do you use Cobbler? -->
Rocky Linux release 9.2 (Blue Onyx)

### Cobbler log

<!--- Paste (partial) output from `/var/log/cobbler/cobbler.log` -->
````
[Daemon] 2023-06-07T22:11:08 - INFO | running: ['/usr/sbin/selinuxenabled']
[Daemon] 2023-06-07T22:11:08 - INFO | received on stdout: 
[Daemon] 2023-06-07T22:11:08 - DEBUG | received on stderr: 
[Daemon] 2023-06-07T22:11:08 - INFO | Automigration NOT executed
[Daemon] 2023-06-07T22:11:09 - INFO | python3-hivex not found. If you need Automatic Windows Installation support, please install.
[Daemon] 2023-06-07T22:11:09 - INFO | 11 breeds and 131 OS versions read from the signature file
[Daemon] 2023-06-07T22:11:09 - DEBUG | API handle initialized
[Daemon] 2023-06-07T22:11:09 - ERROR | [Errno 13] Permission denied: '/var/lib/cobbler/web.ss'
````

### Screenshots

<!--- If applicable, add screenshots to help explain your problem. -->

### Additional information

<!--- Add any other context about the problem here. -->
The fix is to remove the call to os.lchown() from cobblerd.py:regen_ss_file()


Discussion:
@cinnion This file is just used for the CLI authentication since the WebUI was removed in 3.3.0. With the next version of Cobbler, this file will be removed as the new CLI will use the standard XML-RPC API for authentication. As such you are welcome to open a PR against the `release33` branch but the allocated time and priorities at work don't allow me to take care of this atm.

Resolving patch:
diff --git a/cobbler/cobblerd.py b/cobbler/cobblerd.py
--- a/cobbler/cobblerd.py
+++ b/cobbler/cobblerd.py
@@ -23,10 +23,9 @@
 import binascii
 import logging.config
 import os
-import pwd
 import time
 
-from cobbler import remote, utils
+from cobbler import remote
 from cobbler.api import CobblerAPI
 
 if os.geteuid() == 0 and os.path.exists('/etc/cobbler/logging_config.conf'):
@@ -61,14 +60,6 @@ def regen_ss_file():
     with open(ssfile, 'wb', 0o660) as fd:
         fd.write(binascii.hexlify(data))
 
-    http_user = "apache"
-    family = utils.get_family()
-    if family == "debian":
-        http_user = "www-data"
-    elif family == "suse":
-        http_user = "wwwrun"
-    os.lchown("/var/lib/cobbler/web.ss", pwd.getpwnam(http_user)[2], -1)
-
 
 def do_xmlrpc_rw(cobbler_api: CobblerAPI, port):
     """


Test patch: