From 01a11ee57a249ff5a7fe31b75c16f7b8a6a71590 Mon Sep 17 00:00:00 2001 From: AlmaLinux RelEng Bot Date: Tue, 19 May 2026 18:47:50 -0400 Subject: [PATCH] import UBI cronie-1.7.0-14.el10 --- ...Revert-do-not-put-in-quotation-marks.patch | 34 +++++++++ 0002-Revert-set-the-return-path-hard-to.patch | 50 +++++++++++++ ...velope-address-with-default-mailfrom.patch | 31 ++++++++ cronie-anacron-tmpfiles.conf | 9 +++ cronie-tmpfiles.conf | 4 ++ cronie.spec | 45 ++++++++---- ...SS-to-PAM-for-session-classification.patch | 70 +++++++++++++++++++ 7 files changed, 231 insertions(+), 12 deletions(-) create mode 100644 0001-Revert-do-not-put-in-quotation-marks.patch create mode 100644 0002-Revert-set-the-return-path-hard-to.patch create mode 100644 0003-Use-empty-envelope-address-with-default-mailfrom.patch create mode 100644 cronie-anacron-tmpfiles.conf create mode 100644 cronie-tmpfiles.conf create mode 100644 forward-XDG_SESSION_CLASS-to-PAM-for-session-classification.patch diff --git a/0001-Revert-do-not-put-in-quotation-marks.patch b/0001-Revert-do-not-put-in-quotation-marks.patch new file mode 100644 index 0000000..6d65b0b --- /dev/null +++ b/0001-Revert-do-not-put-in-quotation-marks.patch @@ -0,0 +1,34 @@ +From 3428028e6df0a1e9b2efa1cb52b2722f790d9741 Mon Sep 17 00:00:00 2001 +From: Tomas Mraz +Date: Thu, 16 Nov 2023 18:01:00 +0100 +Subject: [PATCH 1/3] Revert "do not put <> in quotation marks" + +This reverts commit a81bede998b510dadc79917b21e0a6dfbbc3436b. +--- + configure.ac | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 8858a6d..754b8c9 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -196,14 +196,14 @@ AC_DEFINE(DEBUGGING,1,[Code will be built with debug info.]) + + AC_DEFINE(MAILARG,"/usr/sbin/sendmail",[There will be path to sendmail.]) + +-AC_DEFINE(MAILFMT,"%s -FCronDaemon -i -odi -oem -oi -t -f <>", ++AC_DEFINE(MAILFMT,"%s -FCronDaemon -i -odi -oem -oi -t -f '<>'", + [-i = don't terminate on "." by itself + -Fx = Set full-name of sender + -odi = Option Deliverymode Interactive + -oem = Option Errors Mailedtosender + -oi = Ignore "." alone on a line + -t = Get recipient from headers +--f <> = Empty envelope sender address ++-f '<>' = Empty envelope sender address + -d = undocumented but common flag.]) + + AC_DEFINE(SYSLOG,1,[Using syslog for log messages.]) +-- +2.52.0 + diff --git a/0002-Revert-set-the-return-path-hard-to.patch b/0002-Revert-set-the-return-path-hard-to.patch new file mode 100644 index 0000000..5b1cc29 --- /dev/null +++ b/0002-Revert-set-the-return-path-hard-to.patch @@ -0,0 +1,50 @@ +From 4e8c767efb1bea03da465fee29641b65da1246eb Mon Sep 17 00:00:00 2001 +From: Tomas Mraz +Date: Thu, 16 Nov 2023 18:01:12 +0100 +Subject: [PATCH 2/3] Revert "set the return-path hard to "<>"" + +This reverts commit d5d7db6a42f8c3ae6f6bd1efc767ae3fe97f4734. + +This is problematic in some use-cases. It needs to be optional. +--- + configure.ac | 4 ++-- + src/do_command.c | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 754b8c9..17fa357 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -196,14 +196,14 @@ AC_DEFINE(DEBUGGING,1,[Code will be built with debug info.]) + + AC_DEFINE(MAILARG,"/usr/sbin/sendmail",[There will be path to sendmail.]) + +-AC_DEFINE(MAILFMT,"%s -FCronDaemon -i -odi -oem -oi -t -f '<>'", ++AC_DEFINE(MAILFMT,"%s -FCronDaemon -i -odi -oem -oi -t -f %s", + [-i = don't terminate on "." by itself + -Fx = Set full-name of sender + -odi = Option Deliverymode Interactive + -oem = Option Errors Mailedtosender + -oi = Ignore "." alone on a line + -t = Get recipient from headers +--f '<>' = Empty envelope sender address ++-f %s = Envelope sender address + -d = undocumented but common flag.]) + + AC_DEFINE(SYSLOG,1,[Using syslog for log messages.]) +diff --git a/src/do_command.c b/src/do_command.c +index 665e1f0..8226a69 100644 +--- a/src/do_command.c ++++ b/src/do_command.c +@@ -471,7 +471,7 @@ static int child_process(entry * e, char **jobenv) { + if (MailCmd[0] == '\0') { + int len; + +- len = snprintf(mailcmd, sizeof mailcmd, MAILFMT, MAILARG); ++ len = snprintf(mailcmd, sizeof mailcmd, MAILFMT, MAILARG, mailfrom); + if (len < 0) { + fprintf(stderr, "mailcmd snprintf failed\n"); + (void) _exit(ERROR_EXIT); +-- +2.52.0 + diff --git a/0003-Use-empty-envelope-address-with-default-mailfrom.patch b/0003-Use-empty-envelope-address-with-default-mailfrom.patch new file mode 100644 index 0000000..f4b2172 --- /dev/null +++ b/0003-Use-empty-envelope-address-with-default-mailfrom.patch @@ -0,0 +1,31 @@ +From c640f4f39e5c20995e960e4b954cd0574a96c028 Mon Sep 17 00:00:00 2001 +From: Tomas Mraz +Date: Thu, 16 Nov 2023 18:12:12 +0100 +Subject: [PATCH 3/3] Use empty envelope address with default mailfrom + +This should still reasonably fix the issue resolved in +https://github.com/cronie-crond/cronie/pull/118 +But it would provide normal envelope address if +MAILFROM is explicitly set. +--- + src/do_command.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/src/do_command.c b/src/do_command.c +index 8226a69..d7ca840 100644 +--- a/src/do_command.c ++++ b/src/do_command.c +@@ -471,7 +471,9 @@ static int child_process(entry * e, char **jobenv) { + if (MailCmd[0] == '\0') { + int len; + +- len = snprintf(mailcmd, sizeof mailcmd, MAILFMT, MAILARG, mailfrom); ++ /* Use empty envelope address with default mailfrom */ ++ len = snprintf(mailcmd, sizeof mailcmd, MAILFMT, MAILARG, ++ mailfrom == e->pwd->pw_name ? "<>" : mailfrom); + if (len < 0) { + fprintf(stderr, "mailcmd snprintf failed\n"); + (void) _exit(ERROR_EXIT); +-- +2.52.0 + diff --git a/cronie-anacron-tmpfiles.conf b/cronie-anacron-tmpfiles.conf new file mode 100644 index 0000000..f8f9dd5 --- /dev/null +++ b/cronie-anacron-tmpfiles.conf @@ -0,0 +1,9 @@ +# systemd-tmpfiles configuration for cronie-anacron + +# Create the anacron spool directory +d /var/spool/anacron 0755 root root - + +# Create anacron timestamp files +f /var/spool/anacron/cron.daily 0600 root root - +f /var/spool/anacron/cron.weekly 0600 root root - +f /var/spool/anacron/cron.monthly 0600 root root - diff --git a/cronie-tmpfiles.conf b/cronie-tmpfiles.conf new file mode 100644 index 0000000..4e6eed2 --- /dev/null +++ b/cronie-tmpfiles.conf @@ -0,0 +1,4 @@ +# systemd-tmpfiles configuration for cronie + +# Create the cron spool directory +d /var/spool/cron 0700 root root - \ No newline at end of file diff --git a/cronie.spec b/cronie.spec index dce01b1..0ba511f 100644 --- a/cronie.spec +++ b/cronie.spec @@ -1,8 +1,8 @@ ## START: Set by rpmautospec -## (rpmautospec version 0.6.5) +## (rpmautospec version 0.8.3) ## RPMAUTOSPEC: autorelease, autochangelog %define autorelease(e:s:pb:n) %{?-p:0.}%{lua: - release_number = 12; + release_number = 14; base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}")); print(release_number + base_release_number - 1); }%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}} @@ -20,6 +20,8 @@ Release: %autorelease License: GPL-2.0-or-later AND BSD-3-Clause AND BSD-2-Clause AND ISC AND LGPL-2.1-or-later URL: https://github.com/cronie-crond/cronie Source0: https://github.com/cronie-crond/cronie/releases/download/cronie-%{version}/cronie-%{version}.tar.gz +Source1: cronie-tmpfiles.conf +Source2: cronie-anacron-tmpfiles.conf # https://github.com/cronie-crond/cronie/pull/163 Patch: n_option_wait_on_finnishing_grandchild_process.patch @@ -38,6 +40,16 @@ Patch: move_parsing_code.patch # https://github.com/cronie-crond/cronie/pull/206 Patch: 0001-crontab-Fix-backup-failure-when-cache-directory-mis.patch +# https://github.com/cronie-crond/cronie/pull/210 +Patch: forward-XDG_SESSION_CLASS-to-PAM-for-session-classification.patch + +# https://github.com/cronie-crond/cronie/issues/166 +# two of these patches touched configure.ac, so we need 'automake'as a BuildRequires +# it is safe to remove it once these patches are part of the upstream release +Patch: 0001-Revert-do-not-put-in-quotation-marks.patch +Patch: 0002-Revert-set-the-return-path-hard-to.patch +Patch: 0003-Use-empty-envelope-address-with-default-mailfrom.patch + Requires: dailyjobs %if %{with selinux} @@ -55,6 +67,7 @@ Buildrequires: audit-libs-devel >= 1.4.1 BuildRequires: gcc BuildRequires: systemd BuildRequires: make +BuildRequires: automake Obsoletes: %{name}-sysvinit Requires(post): coreutils sed @@ -127,7 +140,6 @@ extra features. %install %make_install DESTMAN=$RPM_BUILD_ROOT%{_mandir} -mkdir -pm700 $RPM_BUILD_ROOT%{_localstatedir}/spool/cron mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/ mkdir -pm755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/ %if ! %{with pam} @@ -139,10 +151,6 @@ install -m 644 contrib/anacrontab $RPM_BUILD_ROOT%{_sysconfdir}/anacrontab install -c -m755 contrib/0hourly $RPM_BUILD_ROOT%{_sysconfdir}/cron.d/0hourly mkdir -pm 755 $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly install -c -m755 contrib/0anacron $RPM_BUILD_ROOT%{_sysconfdir}/cron.hourly/0anacron -mkdir -p $RPM_BUILD_ROOT/var/spool/anacron -touch $RPM_BUILD_ROOT/var/spool/anacron/cron.daily -touch $RPM_BUILD_ROOT/var/spool/anacron/cron.weekly -touch $RPM_BUILD_ROOT/var/spool/anacron/cron.monthly # noanacron package install -m 644 contrib/dailyjobs $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/dailyjobs @@ -150,14 +158,19 @@ install -m 644 contrib/dailyjobs $RPM_BUILD_ROOT/%{_sysconfdir}/cron.d/dailyjobs # install systemd initscript install -m 644 -D contrib/cronie.systemd $RPM_BUILD_ROOT/usr/lib/systemd/system/crond.service +# install tmpfiles.d configuration for bootc compatibility +install -m 644 -D %{SOURCE1} $RPM_BUILD_ROOT%{_tmpfilesdir}/cronie.conf +install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_tmpfilesdir}/cronie-anacron.conf + %post # run after an installation %systemd_post crond.service +# create directories via tmpfiles.d for bootc compatibility +systemd-tmpfiles --create %{_tmpfilesdir}/cronie.conf 2>/dev/null || : %post anacron -[ -e /var/spool/anacron/cron.daily ] || install -m 0600 -D /dev/null /var/spool/anacron/cron.daily 2>/dev/null || : -[ -e /var/spool/anacron/cron.weekly ] || install -m 0600 -D /dev/null /var/spool/anacron/cron.weekly 2>/dev/null || : -[ -e /var/spool/anacron/cron.monthly ] || install -m 0600 -D /dev/null /var/spool/anacron/cron.monthly 2>/dev/null || : +# create directories and files via tmpfiles.d for bootc compatibility +systemd-tmpfiles --create %{_tmpfilesdir}/cronie-anacron.conf 2>/dev/null || : %preun # run before a package is removed @@ -206,7 +219,6 @@ exit 0 %{_mandir}/man5/crontab.* %{_mandir}/man1/crontab.* %{_mandir}/man1/cronnext.* -%dir %{_localstatedir}/spool/cron %dir %{_sysconfdir}/cron.d %if %{with pam} %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/pam.d/crond @@ -215,23 +227,32 @@ exit 0 %config(noreplace,missingok) %{_sysconfdir}/cron.deny %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/0hourly %attr(0644,root,root) /usr/lib/systemd/system/crond.service +%{_tmpfilesdir}/cronie.conf +%ghost %dir %attr(0700,root,root) %{_localstatedir}/spool/cron %files anacron %{_sbindir}/anacron %attr(0755,root,root) %{_sysconfdir}/cron.hourly/0anacron %config(noreplace) %{_sysconfdir}/anacrontab -%dir /var/spool/anacron +%ghost %dir %attr(0755,root,root) /var/spool/anacron %ghost %attr(0600,root,root) %verify(not md5 size mtime) /var/spool/anacron/cron.daily %ghost %attr(0600,root,root) %verify(not md5 size mtime) /var/spool/anacron/cron.weekly %ghost %attr(0600,root,root) %verify(not md5 size mtime) /var/spool/anacron/cron.monthly %{_mandir}/man5/anacrontab.* %{_mandir}/man8/anacron.* +%{_tmpfilesdir}/cronie-anacron.conf %files noanacron %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/dailyjobs %changelog ## START: Generated by rpmautospec +* Wed Jan 14 2026 Ondřej Pohořelský - 1.7.0-14 +- Fix MAILFROM envelope address handling + +* Wed Dec 17 2025 Ondřej Pohořelský - 1.7.0-13 +- Forward XDG_SESSION_CLASS to PAM for session classification + * Tue Aug 12 2025 Ondřej Pohořelský - 1.7.0-12 - Crontab fix backup failure diff --git a/forward-XDG_SESSION_CLASS-to-PAM-for-session-classification.patch b/forward-XDG_SESSION_CLASS-to-PAM-for-session-classification.patch new file mode 100644 index 0000000..20828d1 --- /dev/null +++ b/forward-XDG_SESSION_CLASS-to-PAM-for-session-classification.patch @@ -0,0 +1,70 @@ +From 5f9f16b5663becefdd0dd70df31c0ef5ac36f943 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ond=C5=99ej=20Poho=C5=99elsk=C3=BD?= +Date: Thu, 27 Nov 2025 14:38:47 +0100 +Subject: [PATCH] Forward XDG_SESSION_CLASS to PAM for session classification + +Allow users to set the XDG_SESSION_CLASS environment variable in their +crontab to control the systemd session class for cron jobs. When set, +this value is forwarded to the PAM environment so that pam_systemd can +use it for session classification (e.g., "background-light"). + +This enables cron jobs to run in lighter-weight sessions that consume +fewer system resources. +--- + man/crontab.5 | 10 ++++++++++ + src/security.c | 21 +++++++++++++++++++++ + 2 files changed, 31 insertions(+) + +diff --git a/man/crontab.5 b/man/crontab.5 +index 68380c6..7487cc5 100644 +--- a/man/crontab.5 ++++ b/man/crontab.5 +@@ -157,6 +157,16 @@ upper limit specified by the variable. The random scaling factor is + determined during the cron daemon startup so it remains constant for + the whole run time of the daemon. + .PP ++The ++.I XDG_SESSION_CLASS ++variable specifies the session class to be used when PAM creates a systemd ++session for the cron job. If set (e.g., to "background-light"), this value ++is forwarded to the PAM environment so that ++.BR pam_systemd (8) ++can use it for session classification. This allows cron jobs to run in ++lighter-weight sessions that consume fewer system resources. This variable ++has no effect if crond was built without PAM support. ++.PP + The format of a cron command is similar to the V7 standard, with a number + of upward-compatible extensions. Each line has five time-and-date fields + followed by a +diff --git a/src/security.c b/src/security.c +index 14a514a..67b6d26 100644 +--- a/src/security.c ++++ b/src/security.c +@@ -131,6 +131,27 @@ int cron_set_job_security_context(entry *e, user *u ATTRIBUTE_UNUSED, + pam_strerror(pamh, ret), 0); + return -1; + } ++ ++ /* Forward XDG_SESSION_CLASS from crontab environment to PAM ++ * so that pam_systemd.so can use it for session classification */ ++#ifdef HAVE_PAM_PUTENV ++ if (pamh != NULL) { ++ char *xdg_session_class = env_get("XDG_SESSION_CLASS", e->envp); ++ if (xdg_session_class != NULL) { ++ char *xdg_session_class_env = NULL; ++ if (asprintf(&xdg_session_class_env, "XDG_SESSION_CLASS=%s", ++ xdg_session_class) >= 0) { ++ ret = pam_putenv(pamh, xdg_session_class_env); ++ if (ret != PAM_SUCCESS) { ++ log_it(e->pwd->pw_name, getpid(), ++ "WARNING: Failed to set XDG_SESSION_CLASS in PAM environment", ++ pam_strerror(pamh, ret), 0); ++ } ++ free(xdg_session_class_env); ++ } ++ } ++ } ++#endif + #endif + + #ifdef WITH_SELINUX