Open jakwarrior opened 1 year ago
/cc @sberyozkin (security)
@jakwarrior Can you please create a reproducer ?
I wonder if the MTLS authentication mechanism is interfering somehow.
Can you try to restrict the form authentication to specific request paths, for example, https://quarkus.io/guides/security-overview-concept#path-specific-authentication-mechanisms, the form authentication mechanism is form
.
Without such a restriction, since you have 2 authentication mechanisms, you may be having MTLS mechanism affecting the form requests
This feature is also interesting because it is possible that both MTLS and for example basic or bearer token authentication must succeed, I don't think we have any tests combining MTLS.
Assigning myself just to explore a bit later combining MTLS with other mechanisms. Michal, please keep an eye on the form auth related concerns here. I don't think it is issue specific to Form Auth, but just in case
@jakwarrior Can you please create a reproducer ? I wonder if the MTLS authentication mechanism is interfering somehow. Can you try to restrict the form authentication to specific request paths, for example, https://quarkus.io/guides/security-overview-concept#path-specific-authentication-mechanisms, the form authentication mechanism is
form
. Without such a restriction, since you have 2 authentication mechanisms, you may be having MTLS mechanism affecting the form requests
Thanks @sberyozkin for your answer. I changed my configuration like this and it works well !
quarkus.http.ssl.client-auth=required
quarkus.http.auth.form.post-location=/auth/j_security_check
quarkus.http.auth.permission.default.paths=/*
quarkus.http.auth.permission.default.policy=authenticated
quarkus.http.auth.permission.form.paths=/auth/j_security_check
quarkus.http.auth.permission.form.policy=authenticated
quarkus.http.auth.permission.form.auth-mechanism=form
I try to make a reproducer as soon as I have free time.
Thanks @jakwarrior, I think we have enough info now to confirm that both MTLS and in this case Form are competing.
Looks like quarkus.http.ssl.client-auth=required
is a problem in this case, i.e, if no client cert is present, MTLS should let other mechanisms handle the autentication
Oh I see, so in the original description it is quarkus.http.ssl.client-auth=request
, the client cert is optional.
I had the same issue with quarkus.http.ssl.client-auth=request
or quarkus.http.ssl.client-auth=required
.
Describe the bug
I have a form based authentication on my application. Randomly, I have a 404 error with the url /j_security_check when a client send a POST message. Even after a restart of the server, the error can be here. I can't find any logic. Sometimes it works, sometimes it doesn't. It seems to be related to mutual TLS authentication. I want my server to only let through clients that have the correct certificates. So I add that line in my application.properties: quarkus.http.ssl.client-auth=request I don't see the error with mutual TLS authentication disabled.
Expected behavior
No 404 error during authentication
Actual behavior
A 404 error appears during authentication, the url /j_security_check cannot be found. With quarkus logs configured in debug mode, I can see this stacktrace:
It's just the beginning of the stacktrace.
How to Reproduce?
This is my application.properties:
Output of
uname -a
orver
Ubuntu 20.04
Output of
java -version
Adoptium 11.0.15+10
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.15.3
Build tool (ie. output of
mvnw --version
orgradlew --version
)Maven 3.8.3
Additional information
No response