-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Introduce Management Interface #30506
Conversation
/cc @ebullient (metrics,micrometer), @jmartisk (metrics) |
6941cfe
to
156b568
Compare
156b568
to
3e2d632
Compare
1d17783
to
2578b4f
Compare
I've rebased on top of the new main (jakarta). |
🙈 The PR is closed and the preview is expired. |
70b65a2
to
db09f4d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Docs suggestions
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried just few things with the app running against cescoffier:management-interface-3
based on https://code.quarkus.io/?e=smallrye-health&e=micrometer&e=resteasy-reactive&S=io.quarkus.platform%3A3.0&extension-search=origin:platform%20resteas with usage of 999-SNAPSHOT bom
Few observations:
A) quarkus.http.non-application-root-path=/qq
is not reflected, health check is still on http://localhost:9000/q/health
I know the new doc says to use quarkus.management.root-path=/xyz
. Current Quarkus users are used to the above property, there needs to clear message about the need for different property when using management interface - migration guide, release text.
B) quarkus.http.root-path
is not reflected
https://quarkus.io/guides/all-config#quarkus-vertx-http_quarkus.http.non-application-root-path says Relative path (Default, q) → Non-application endpoints will be served from ${quarkus.http.root-path}/${quarkus.http.non-application-root-path}.
Similarly to the above point. Needs good message towards users.
C) existing guides
Guides for Health Checks, SmallRye Metrics, and Micrometer Prometheus should have pointer to the docs/src/main/asciidoc/management-interface-reference.adoc
D) Docs for root-path config for health / metrics / micrometer
Text rendered in https://quarkus.io/guides/all-config#quarkus-smallrye-health_quarkus.smallrye-health.root-path and similar parts for metrics/micrometer need to cover both quarkus.http
and quarkus.management
based exposure
E) Enabled by default or not ...
Should be enabled by default to provide "secured" experience?
Breaking change on the other hand ...
F) dev mode is stuck, had to kill-9
the process
my application.properties for the above app
quarkus.management.enabled=true
quarkus.http.root-path=/api
quarkus.http.non-application-root-path=/qq
Well, just quarkus.management.enabled=true
is enough to get stuck in dev mode. After hitting Ctrl+C the process ( mvn quarkus:dev
) doesn't end and I have to run kill -9
the process
forgot to attach management-interface-thread-dump.txt |
@@ -0,0 +1 @@ | |||
quarkus.management.enabled=true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cescoffier Can you please have this test confirming the optional Basic authentication works ? I've noticed you have added SSL tests which is great but they don't confirm the actual HTTP authentication mechanisms are working
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cescoffier I noticed AuthConfig
was removed which was fine, but IMHO we really should have something available from the start, having an open management port in prod mode without any simple authentication is a problem. Complexity of the MTLS setup to have a secure management port access would indeed be rarely used if ever used (esp if we assume the browser will be used to access it).
We need to have a Basic Auth support from the start IMHO. You said Verx authentication would be used directly, not sure it is a good idea as it would prevent reusing Quarkus identity providers like JDBC/JPA to keep user name and passwords. It should not really bypass the actual Quarkus Security.
I can propose a fairly simple solution:
- Have
ManagementAuthConfig
group, but only copyAuthConfig.basic
to it, so that if someone wants they just doquarkus.management.auth.basic=true
- If it is enabled then BasicAuthenticationMechanism is created (update the condition in HttpSecurityRecorder where it is created) and then in HttpSecurityRecorder.initPermissions, have
PathMatchingHttpSecurityPolicy
updated with one morePolicyMappingConfig
(add new method to PathMatchingHttpSecurityPolicy to acceptPolicyMappingConfig
which will havebasic
authentication scheme requiring an authenticated access for the management root).
And that should be it for now, then users just will have to add security-jpa or security-jdbc, or set user name/password in application.properties with the file properties.
Would you like to give it a quick try, it will literally take 30 mins for you to complete.
In the future we can also update those policies to be applicable to specific ports only, I can handle the port related part separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also if for ex both management and application need Basic auth, then how to ensure that someone who passes the application level basic auth check can not access management, and vice versa, for that PolicyMappingConfig for management can in the future include a management
role, it can be taken care of in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that basic auth would be nice, but I don't have the time to do it right now.
Also, I've looked into hooking the quarkus security provider, and it requires a lot more work and adaptation than just using vertx auth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My initial investigation really scared me. Can you @sergei make it happen then I'm happy to look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cescoffier Can you clarify something please, what happens in HttpSecurityRecorder
, does it affect the main router only or other routers such as the management router is also affected ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only the main router.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cescoffier Thanks, I started guessing it was the case, after getting the basic authentication activated only in the 404 case in the test which I understand now hits the main router only.
What exactly binds the main router to it, I don't see any obvious link,
I see in HttpSecurityProcessor
:
@BuildStep
@Record(ExecutionTime.RUNTIME_INIT)
SyntheticBeanBuildItem initBasicAuth(
HttpSecurityRecorder recorder,
HttpBuildTimeConfig buildTimeConfig...) {
...
}
and
public HttpSecurityRecorder(RuntimeValue<HttpConfiguration> httpConfiguration, HttpBuildTimeConfig buildTimeConfig) {
this.httpConfiguration = httpConfiguration;
this.buildTimeConfig = buildTimeConfig;
}
Both routers are created in VertxHttpRecorder
but I lack some Vert.x HTTP extension knowledge to understand why HttpSecurityProcessor
and HttpSecurityRecorder
affect the main router only.
Can you clarify please ? It is obviously taking more than my 30 mins's assertion, so I'll lift my change request. I'll continue investigating the Quarkus Sec path anyway, but I'd appreciate some help related to this router binding, thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sberyozkin You would need to completely duplicate the HttpSecurityRecorder
because the input of that class are the main server configuration and not the management one. However, the authenticationMechanismHandler
should be reusable (at 90%).
However, with a bit of modification, I believe we would be able to reduce the amount of duplication to almost nothing:
1 - modify the current recorder to extract the used value from the received configuration
2 - add a second recorded for the management interface doing the same
3 - extract the field containing these values and the authenticationMechanismHandler
in a parent class.
4- call the new recorder when we configure the management interface
It's important to understand that the main and management servers are managed entirely separately at runtime, on purpose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cescoffier Thanks, I'll try to get something working with a duplicate first just to get some feeling it actually works, and then we can optimize, will ping offline for some extra hints, but in any case, as I said, I don't want to hold this PR, my change request has been lifted
...management-interface/src/test/java/io/quarkus/it/management/ManagementInterfaceTestCase.java
Show resolved
Hide resolved
Ability to have a management interface on a separate port (and host) was added[1] to Quarkus upstream. These changes are required to properly cover this feature in TS. Noticeable user-facing feature is addition of `management` method to `RestService` class This method either returns a way to communicate to the interface or fails, if separate interface is not enabled. [1] quarkusio/quarkus#30506
Ability to have a management interface on a separate port (and host) was added[1] to Quarkus upstream. These changes are required to properly cover this feature in TS. Noticeable user-facing feature is addition of `management` method to `RestService` class This method either returns a way to communicate to the interface or fails, if separate interface is not enabled. [1] quarkusio/quarkus#30506
Ability to have a management interface on a separate port (and host) was added[1] to Quarkus upstream. These changes are required to properly cover this feature in TS. Noticeable user-facing feature is addition of `management` method to `RestService` class This method either returns a way to communicate to the interface or fails, if separate interface is not enabled. [1] quarkusio/quarkus#30506
Ability to have a management interface on a separate port (and host) was added[1] to Quarkus upstream. These changes are required to properly cover this feature in TS. Noticeable user-facing feature is addition of `management` method to `RestService` class This method either returns a way to communicate to the interface or fails, if separate interface is not enabled. [1] quarkusio/quarkus#30506
Now Quarkus can expose endpoints for metrics and health on a separate network interface. We verify, that this is supported, and we can use custom port, switch HTTPS on and off and change api path. This requires supports on the side of the FW and enabling one of the disabled tests. Test plans for the change: https://github.com/quarkus-qe/quarkus-test-plans/blob/main/QUARKUS-2738.md Related links: quarkusio/quarkus#30506 https://issues.redhat.com/browse/QUARKUS-2738
Now Quarkus can expose endpoints for metrics and health on a separate network interface. We verify, that this is supported, and we can use custom port, switch HTTPS on and off and change api path. This requires supports on the side of the FW and enabling one of the disabled tests. Test plans for the change: https://github.com/quarkus-qe/quarkus-test-plans/blob/main/QUARKUS-2738.md Related links: quarkusio/quarkus#30506 https://issues.redhat.com/browse/QUARKUS-2738
Now Quarkus can expose endpoints for metrics and health on a separate network interface. We verify, that this is supported, and we can use custom port, switch HTTPS on and off and change api path. This requires supports on the side of the FW and enabling one of the disabled tests. Test plans for the change: https://github.com/quarkus-qe/quarkus-test-plans/blob/main/QUARKUS-2738.md Related links: quarkusio/quarkus#30506 https://issues.redhat.com/browse/QUARKUS-2738
Now Quarkus can expose endpoints for metrics and health on a separate network interface. We verify, that this is supported, and we can use custom port, switch HTTPS on and off and change api path. This requires supports on the side of the FW and enabling one of the disabled tests. Test plans for the change: https://github.com/quarkus-qe/quarkus-test-plans/blob/main/QUARKUS-2738.md Related links: quarkusio/quarkus#30506 https://issues.redhat.com/browse/QUARKUS-2738
Now Quarkus can expose endpoints for metrics and health on a separate network interface. We verify, that this is supported, and we can use custom port, switch HTTPS on and off and change api path. This requires supports on the side of the FW and enabling one of the disabled tests. Test plans for the change: https://github.com/quarkus-qe/quarkus-test-plans/blob/main/QUARKUS-2738.md Related links: quarkusio/quarkus#30506 https://issues.redhat.com/browse/QUARKUS-2738
Now Quarkus can expose endpoints for metrics and health on a separate network interface. We verify, that this is supported, and we can use custom port, switch HTTPS on and off and change api path. This requires supports on the side of the FW and enabling one of the disabled tests. Test plans for the change: https://github.com/quarkus-qe/quarkus-test-plans/blob/main/QUARKUS-2738.md Related links: quarkusio/quarkus#30506 https://issues.redhat.com/browse/QUARKUS-2738
Follow-up to 2b483fa Apps with separate management interface can now be deployed by quarkus openshift-extension Test plans for the change: https://github.com/quarkus-qe/quarkus-test-plans/blob/main/QUARKUS-2738.md Related links: quarkusio/quarkus#30506 https://issues.redhat.com/browse/QUARKUS-2738
Follow-up to 2b483fa Apps with separate management interface can now be deployed by quarkus openshift-extension Test plans for the change: https://github.com/quarkus-qe/quarkus-test-plans/blob/main/QUARKUS-2738.md Related links: quarkusio/quarkus#30506 https://issues.redhat.com/browse/QUARKUS-2738
Follow-up to 2b483fa Apps with separate management interface can now be deployed by quarkus openshift-extension Test plans for the change: https://github.com/quarkus-qe/quarkus-test-plans/blob/main/QUARKUS-2738.md Related links: quarkusio/quarkus#30506 https://issues.redhat.com/browse/QUARKUS-2738
Follow-up to 2b483fa Apps with separate management interface can now be deployed by quarkus openshift-extension Test plans for the change: https://github.com/quarkus-qe/quarkus-test-plans/blob/main/QUARKUS-2738.md Related links: quarkusio/quarkus#30506 https://issues.redhat.com/browse/QUARKUS-2738
Follow-up to 2b483fa Apps with separate management interface can now be deployed by quarkus openshift-extension Test plans for the change: https://github.com/quarkus-qe/quarkus-test-plans/blob/main/QUARKUS-2738.md Related links: quarkusio/quarkus#30506 https://issues.redhat.com/browse/QUARKUS-2738
Follow-up to 2b483fa Apps with separate management interface can now be deployed by quarkus openshift-extension Test plans for the change: https://github.com/quarkus-qe/quarkus-test-plans/blob/main/QUARKUS-2738.md Related links: quarkusio/quarkus#30506 https://issues.redhat.com/browse/QUARKUS-2738
This PR adds management interface support. It allows exposing selected routes (management routes) to a different HTTP server. It avoids exposing these management routes on the main HTTP server, which could lead to leaks and undesired access to these endpoints.
Enabling/Disabling the management interface is a build-time property. However, the interface, port, and SSL... are runtime values.
The management interface is not intended to be used using native transport (as high concurrency is rarely a need for these endpoints). Also, the access log and same site cookie are not supported yet.
The management interface does not expose plain and secured endpoints. It's either using HTTP or HTTPS.
At the moment are considered management routes:
When deploying to Kubernetes and Openshift, the
management
port is also exposed.The Promethues scrape url and the health checks probes are configured to use that
management
port.Tasks:
Related issues