Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance the log messages for authentication failures in TRACE #1246

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cherokee/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -2310,6 +2310,7 @@ cherokee_connection_check_authentication (cherokee_connection_t *conn, cherokee_
*/
ret = cherokee_header_get_known (&conn->header, header_authorization, &ptr, &len);
if (ret != ret_ok) {
TRACE(ENTRIES, "conn %p, no authorization header entry\n", conn);
goto unauthorized;
}

Expand All @@ -2325,6 +2326,7 @@ cherokee_connection_check_authentication (cherokee_connection_t *conn, cherokee_
*/
ret = get_authorization (conn, config_entry->authentication, conn->validator, ptr, len);
if (ret != ret_ok) {
TRACE(ENTRIES, "conn %p, authentication information does not match with configuration.\n", conn);
goto unauthorized;
}

Expand All @@ -2334,11 +2336,13 @@ cherokee_connection_check_authentication (cherokee_connection_t *conn, cherokee_
void *foo;

if (cherokee_buffer_is_empty (&conn->validator->user)) {
TRACE(ENTRIES, "conn %p, user field is empty.\n", conn);
goto unauthorized;
}

ret = cherokee_avl_get (config_entry->users, &conn->validator->user, &foo);
if (ret != ret_ok) {
TRACE(ENTRIES, "conn %p, the connection's user (%s) is not in the fixed list configuration.\n", conn, conn->validator->user.buf);
goto unauthorized;
}
}
Expand All @@ -2354,6 +2358,7 @@ cherokee_connection_check_authentication (cherokee_connection_t *conn, cherokee_
ret = cherokee_validator_check (conn->validator, conn);

if (ret != ret_ok) {
TRACE(ENTRIES, "conn %p, login failed: invalid password.\n", conn);
goto unauthorized;
}

Expand Down Expand Up @@ -2386,6 +2391,8 @@ cherokee_connection_check_ip_validation (cherokee_connection_t *conn, cherokee_c
}

conn->error_code = http_access_denied;
TRACE(ENTRIES, "conn %p, IP did not match IP or subnet configuration.\n", conn);

return ret_error;
}

Expand Down Expand Up @@ -2430,6 +2437,7 @@ cherokee_connection_check_http_method (cherokee_connection_t *conn, cherokee_con
conn->header.method = http_get;
}

TRACE(ENTRIES, "conn %p, the connecction's HTTP method is not allowed.\n", conn);
return ret_error;
}

Expand Down
2 changes: 1 addition & 1 deletion cherokee/error_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
admin = '/general#tabs_general-0')

e('RRD_MKDIR_WRITE',
title = "Cannot create the '%s' directory",
title = "Cannot create the '%s' directory or it doesn't have write permission",
desc = SYSTEM_ISSUE,
admin = '/general#tabs_general-0')

Expand Down