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

Remove the need for outbound internet connection from Oathkeeper #234

Closed
tsjnsn opened this issue Aug 8, 2019 · 8 comments · Fixed by #282
Closed

Remove the need for outbound internet connection from Oathkeeper #234

tsjnsn opened this issue Aug 8, 2019 · 8 comments · Fixed by #282
Labels
feat New feature or request.

Comments

@tsjnsn
Copy link

tsjnsn commented Aug 8, 2019

Is your feature request related to a problem? Please describe.

Oathkeeper without internet access doesn't function due to needing to pull a schema from github at runtime.
time="2019-08-08T15:03:53Z" level=fatal msg="The configuration is invalid and could not be loaded." error="Get https://raw.githubusercontent.com/ory/x/master/.schemas/logrusx/viper.schema.json: dial tcp 151.101.200.133:443: i/o timeout"

Describe the solution you'd like

ability to provide schema via config or build into the container

Describe alternatives you've considered

outbound proxy. does not seem like this is a good enough case for it though.

Additional context

@aeneasr
Copy link
Member

aeneasr commented Aug 8, 2019

This is currently not easy implementable because of the way JSON Schema works. The schema within Oathkeeper is built into the binary, however, that schema relies on other schemas to work by using the $ref syntax. There is currently no easy way around this.

@tsjnsn
Copy link
Author

tsjnsn commented Aug 8, 2019

An option here would be to use a tool like https://github.com/APIDevTools/json-schema-ref-parser at build time to deref the schemas

@samh
Copy link

samh commented Sep 6, 2019

In my use case, the servers where this would be deployed are in isolated networks with no internet access at all.

But even if internet is available, if githubusercontent.com was ever offline, nobody would be able to start Oathkeeper, right?

@aeneasr
Copy link
Member

aeneasr commented Sep 17, 2019

We will try to figure something out. For now, as a workaround, is a cache proxy reasonable? on top of a modified /etc/hosts file?

We could probably dereference the json schema as part of the build process and include it in the binary to fix this for real.

@samh
Copy link

samh commented Sep 17, 2019

@aeneasr Thanks for your willingness to look into it! I'm willing to help with the code if I can; any pointers would be helpful.

I'm just starting to evaluate Oathkeeper now, so I don't necessarily need a workaround yet. I guess you mean serve up that file from e.g. localhost and point raw.githubusercontent.com at there using /etc/hosts? That seems reasonable as a temporary solution.

@aeneasr
Copy link
Member

aeneasr commented Sep 17, 2019

Exactly!

@samh
Copy link

samh commented Sep 17, 2019

Now that I think of it some more, I'm not sure about the workaround, because it's https, so I think you'd have to generate and trust a local certificate for raw.githubusercontent.com.

@aeneasr It looks like oathkeeper is using "packr" to embed .scemas/config.schema.json. Could the same be done inside https://github.com/ory/x to embed the files in the .scemas directory into that package? Then it looks like (maybe in viperx/validate.go) you could use AddSchemas to add the local copies of the schema, and gojsonschema should load them locally: https://github.com/ory/gojsonschema#loading-local-schemas.

What do you think? I'm not that familiar with Go, so I'm not clear on how packr would work with a library (also, ory/x seems to be on packr v1, while oathkeeper is using packr v2).

@aeneasr
Copy link
Member

aeneasr commented Sep 25, 2019

Yes absolutely, I think the idea to get this working would be to have a build pipeline that:

  • dereferences the json schema (by downloading all the linked schemas)
  • packing the whole directory in the binary
  • loading the whole directory with gojsonschema

Should be straight forward but I didn't have time yet to properly test it out.

@aeneasr aeneasr added the feat New feature or request. label Sep 25, 2019
aeneasr added a commit that referenced this issue Oct 26, 2019
Resolves several documentation issues, see also: ory/docs#217

Closes #234
Closes #281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat New feature or request.
Projects
None yet
3 participants