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

NoSuchFileException with ${kc.home.dir} on Windows #23217

Closed
2 tasks done
crystalgreen opened this issue Sep 13, 2023 · 4 comments · Fixed by #24080
Closed
2 tasks done

NoSuchFileException with ${kc.home.dir} on Windows #23217

crystalgreen opened this issue Sep 13, 2023 · 4 comments · Fixed by #24080
Assignees

Comments

@crystalgreen
Copy link

Before reporting an issue

Area

dist/quarkus

Describe the bug

Under Windows, I use keycloak.config with

https-certificate-file=${kc.home.dir}/../../cert/cert.pem

This works in v21 but no longer in v22.
When with kc.bat --verbose start I get sth like

java.nio.file.NoSuchFileException: D:Dir1Dir2Dir3keyCloakbin..\..\..\cert\cert.pem

When I replace the config path with an absolute path containing only / then it works.
E.g. D:/Dir1/Dir2/Dir3/cert/cert.pem.

Version

22.0.3

Expected behavior

The old configuration should work as it did till v21.

Actual behavior

I get a NoSuchFileException instead. Except when I use the workaround: absolute paths with \ replaced by /.

I think, ${kc.home.dir} may return \ separators and this doesn't seem to work with the file load logic.
Either that logic has changed or the ${kc.home.dir} did use / in the past instead of \.

How to Reproduce?

Use Windows and try a https-certificate-file configuration similar to mine, containing ${kc.home.dir}.

Anything else?

It may be similar like #17413.

@vmuzikar
Copy link
Contributor

@Pepo48 Can you please look into this when you get a chance?

@dpulrichth
Copy link

We're also experiencing this since Keycloak 22.0.3. It used to work in Keycloak 22.0.1

@Pepo48
Copy link
Contributor

Pepo48 commented Oct 17, 2023

Hello everyone, first of all, thanks for the reports. Jfyi, I can confirm that issue first appeared in 22.0.2.
Let me investigate it in more detail first.

Pepo48 added a commit to Pepo48/keycloak that referenced this issue Oct 18, 2023
* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
@Pepo48
Copy link
Contributor

Pepo48 commented Oct 18, 2023

I narrowed the problem to this PR/commit. The changes made there suggest that this may be a bug on a Quarkus/SmallRye side (most likely in VertxHttpRecorder.java in quarkus.vertx.http.runtime, according to my brief investigation), since what Keycloak does is that it just consumes (newer) quarkus.http.ssl.certificate.*files Quarkus properties as is and exposes them further as a https-certificate-*file Keycloak properties.

There is already a follow up #21871 to allow to process multiple certificates/keys at once (just to be on a par Quarkus's behaviour).

What we could do at this point is to provide an additional validation, like I similarly did with Keycloak Keystore path/password properties for a similar reason.
Wdyt @mabartos?
Cc: @vmuzikar

I'll send a PR with the proposed in a minute.

Pepo48 added a commit to Pepo48/keycloak that referenced this issue Oct 18, 2023
* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
Pepo48 added a commit to Pepo48/keycloak that referenced this issue Oct 18, 2023
* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
Pepo48 added a commit to Pepo48/keycloak that referenced this issue Oct 18, 2023
* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
Pepo48 added a commit to Pepo48/keycloak that referenced this issue Nov 22, 2023
* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
Pepo48 added a commit to Pepo48/keycloak that referenced this issue Nov 25, 2023
* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
Pepo48 added a commit to Pepo48/keycloak that referenced this issue Nov 28, 2023
* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
Pepo48 added a commit to Pepo48/keycloak that referenced this issue Nov 28, 2023
* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
Pepo48 added a commit to Pepo48/keycloak that referenced this issue Nov 28, 2023
* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
Pepo48 added a commit to Pepo48/keycloak that referenced this issue Nov 29, 2023
* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
Pepo48 added a commit to Pepo48/keycloak that referenced this issue Nov 29, 2023
* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
@ghost ghost removed the status/triage label Nov 30, 2023
shawkins pushed a commit that referenced this issue Nov 30, 2023
* NoSuchFileException with ${kc.home.dir} on Windows

* added a path validation for https cert and key files in HttpPropertyMappers

Closes #23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

* NoSuchFileException with ${kc.home.dir} on Windows

* added a path validation for https cert and key files in HttpPropertyMappers

Closes #23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

* NoSuchFileException with ${kc.home.dir} on Windows

* added a path validation for https cert and key files in HttpPropertyMappers

Closes #23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

---------

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
srose pushed a commit to srose/keycloak that referenced this issue Dec 20, 2023
* NoSuchFileException with ${kc.home.dir} on Windows

* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

* NoSuchFileException with ${kc.home.dir} on Windows

* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

* NoSuchFileException with ${kc.home.dir} on Windows

* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

---------

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
kamontat pushed a commit to kamontat/keycloak that referenced this issue Jan 20, 2024
* NoSuchFileException with ${kc.home.dir} on Windows

* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

* NoSuchFileException with ${kc.home.dir} on Windows

* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

* NoSuchFileException with ${kc.home.dir} on Windows

* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

---------

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
Signed-off-by: Kamontat Chantrachirathumrong <14089557+kamontat@users.noreply.github.com>
ShefeeqPM pushed a commit to ShefeeqPM/keycloak that referenced this issue Jan 27, 2024
* NoSuchFileException with ${kc.home.dir} on Windows

* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

* NoSuchFileException with ${kc.home.dir} on Windows

* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

* NoSuchFileException with ${kc.home.dir} on Windows

* added a path validation for https cert and key files in HttpPropertyMappers

Closes keycloak#23217

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>

---------

Signed-off-by: Peter Zaoral <pzaoral@redhat.com>
Signed-off-by: ShefeeqPM <86718986+ShefeeqPM@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants