Compare commits

...
Sign in to create a new pull request.

2 commits

Author SHA1 Message Date
Orion Poplawski
5ddaaca42c Add upstream patch for CVE-2022-0860 (bz#2066592) 2022-03-23 07:07:43 -06:00
Orion Poplawski
c930a1ecda More complete fix for CVE-2021-45083 - enforce permissions in %post 2022-03-01 17:23:35 -07:00
2 changed files with 65 additions and 1 deletions

View file

@ -0,0 +1,42 @@
From aeb10a6d169da55bab0a5000dce5913e467c9344 Mon Sep 17 00:00:00 2001
From: Enno Gotthold <egotthold@suse.de>
Date: Thu, 10 Mar 2022 16:16:29 +0100
Subject: [PATCH] Security: Fix CVE-2022-0860
If PAM is correctly configured and a user account is set to expired,
the expired user-account is still able to successfully log into
Cobbler in all places (Web UI, CLI & XMLRPC-API).
The same applies to user accounts with passwords set to be expired.
This patch is fixing this and checking that this behavior is now
correct via a reproducible test.
---
cobbler/modules/authentication/pam.py | 8 ++++++++
tests/special_cases/security_test.py | 28 +++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/cobbler/modules/authentication/pam.py b/cobbler/modules/authentication/pam.py
index 97ecc02ab..893422c5b 100644
--- a/cobbler/modules/authentication/pam.py
+++ b/cobbler/modules/authentication/pam.py
@@ -114,6 +114,10 @@ class PamConv(Structure):
PAM_AUTHENTICATE.restype = c_int
PAM_AUTHENTICATE.argtypes = [PamHandle, c_int]
+PAM_ACCT_MGMT = LIBPAM.pam_acct_mgmt
+PAM_ACCT_MGMT.restype = c_int
+PAM_ACCT_MGMT.argtypes = [PamHandle, c_int]
+
def authenticate(api_handle, username: str, password: str) -> bool:
"""
@@ -157,4 +161,8 @@ def my_conv(n_messages, messages, p_response, app_data):
return False
retval = PAM_AUTHENTICATE(handle, 0)
+
+ if retval == 0:
+ retval = PAM_ACCT_MGMT(handle, 0)
+
return retval == 0

View file

@ -5,7 +5,7 @@
Name: cobbler
Version: 3.2.2
Release: 9%{?dist}
Release: 11%{?dist}
Summary: Boot server configurator
URL: https://cobbler.github.io/
License: GPLv2+
@ -25,6 +25,8 @@ Patch3: cobbler-remove-get-loaders.patch
Patch4: cobbler-CVE-2021-45082.patch
# Do not run coverage tests
Patch5: cobbler-nocov.patch
# Upstream fix for CVE-2022-0860 (expired accounts)
Patch6: https://github.com/cobbler/cobbler/commit/9044aa990a94752fa5bd5a24051adde099280bfa.patch
BuildArch: noarch
BuildRequires: python%{python3_pkgversion}-devel
@ -179,6 +181,20 @@ fi
%post
%systemd_post cobblerd.service
# Fixup permission for world readable settings files
chmod 640 %{_sysconfdir}/cobbler/settings.yaml
chmod 600 %{_sysconfdir}/cobbler/mongodb.conf
chmod 600 %{_sysconfdir}/cobbler/modules.conf
chmod 640 %{_sysconfdir}/cobbler/users.conf
chmod 640 %{_sysconfdir}/cobbler/users.digest
chmod 750 %{_sysconfdir}/cobbler/settings.d
chmod 640 %{_sysconfdir}/cobbler/settings.d/*
chgrp apache %{_sysconfdir}/cobbler/settings.yaml
chgrp apache %{_sysconfdir}/cobbler/users.conf
chgrp apache %{_sysconfdir}/cobbler/users.digest
chgrp apache %{_sysconfdir}/cobbler/settings.d
chgrp apache %{_sysconfdir}/cobbler/settings.d/*
%posttrans
# Migrate pre-3.2.1 settings to settings.yaml
@ -281,6 +297,12 @@ sed -i -e "s/SECRET_KEY = ''/SECRET_KEY = \'$RAND_SECRET\'/" %{_datadir}/cobbler
%changelog
* Wed Mar 23 2022 Orion Poplawski <orion@nwra.com> - 3.2.2-11
- Add upstream patch for CVE-2022-0860 (bz#2066592)
* Wed Mar 02 2022 Orion Poplawski <orion@nwra.com> - 3.2.2-10
- More complete fix for CVE-2021-45083 - enforce permissions in %%post
* Tue Mar 01 2022 Orion Poplawski <orion@nwra.com> - 3.2.2-9
- Apply fixes for CVE-2021-45082/3
- Remove BR on python3-coverage