Skip to content

scheduler: Raise auth failure log level from DEBUG to WARN for fail2ban compatibility#1561

Merged
michaelrsweet merged 6 commits intoOpenPrinting:masterfrom
abubakarsabir924-cell:fix/auth-failure-log-level
Apr 28, 2026
Merged

scheduler: Raise auth failure log level from DEBUG to WARN for fail2ban compatibility#1561
michaelrsweet merged 6 commits intoOpenPrinting:masterfrom
abubakarsabir924-cell:fix/auth-failure-log-level

Conversation

@abubakarsabir924-cell
Copy link
Copy Markdown
Contributor

Fixes #1553

When LogLevel is set to "error" in cupsd.conf, authentication
failure messages were logged at CUPSD_LOG_DEBUG level and never
appeared in logs. This prevented fail2ban from detecting failed
login attempts and blocked brute force protection.

This change raises the log level from CUPSD_LOG_DEBUG to
CUPSD_LOG_WARN for the "User not in group(s)" message in
scheduler/auth.c, ensuring it appears in logs regardless of
the configured LogLevel.

@abubakarsabir924-cell
Copy link
Copy Markdown
Contributor Author

abubakarsabir924-cell commented Apr 26, 2026

Hi @michaelrsweet Sir, I have submitted PR #[PR 1561] for this issue. I have updated the PR to ensure consistent log messaging across the scheduler. I also fixed the argument count in the log calls to match the format strings. Ready for review!

Copy link
Copy Markdown
Member

@michaelrsweet michaelrsweet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor changes here, then I can work on the OAuth and Kerberos messaging to match.

Comment thread scheduler/auth.c Outdated
if (pamerr != PAM_SUCCESS)
{
cupsdLogClient(con, CUPSD_LOG_ERROR, "pam_authenticate() returned %d (%s)", pamerr, pam_strerror(pamh, pamerr));
cupsdLogClient(con, CUPSD_LOG_WARN, "Authentication failed for user \"%s\" from %s", username, con->http->hostname);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'd rather combine these into a single ERROR message; maybe we can standardize the wording here and for the other methods, something like:

Authentication failed for user \"%s\" from %s (%s)

where the message in parens is the error.

Comment thread scheduler/auth.c Outdated
*/

cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdIsAuthorized: User not in group(s).");
cupsdLogMessage(CUPSD_LOG_WARN, "cupsdIsAuthorized: User not in group(s).");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be:

Authentication failed for user \"%s\" from %s (Not in group.)

@abubakarsabir924-cell
Copy link
Copy Markdown
Contributor Author

Hi @michaelrsweet Sir, I have updated PR #1561 as per your review comments. Both auth failure messages now use ERROR level with standardized wording including username and hostname. pam_end() call is also preserved. Please review!
thankyou

@michaelrsweet michaelrsweet self-assigned this Apr 28, 2026
@michaelrsweet michaelrsweet added the enhancement New feature or request label Apr 28, 2026
@michaelrsweet michaelrsweet added this to the v2.5 milestone Apr 28, 2026
@michaelrsweet michaelrsweet merged commit ca52f28 into OpenPrinting:master Apr 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change authentication failure logging priority to error or warning

2 participants