Fork me on GitHub
#clojure
<
2023-07-21
>
Colin (fosskers)09:07:41

What's the simplest way to do TLS with Ring? I see that the jetty adapter can be passed a :ssl-context value, but it's not otherwise clear what that value is expected to be or where it comes from.

dharrigan09:07:09

In most cases, I just front my web server with haproxy/caddy to do TLS termination.

Colin (fosskers)09:07:16

I'm happy to do it directly in the Clojure if that means fewer moving parts (as opposed to an external proxy)

vemv09:07:31

In case the observation helps, that external moving part helps you with "slow client" attacks, which are expensive to tackle at the application level

👍 2
mpenet13:07:53

There’s a lib that helps untangle the java bits to get ssl-contexts for various purposes: https://github.com/aphyr/less-awful-ssl

Ivar Refsdal11:07:25

less-awful-ssl is good, but outdated and supports maximum TLSv1.2 IIRC. I've updated the code in less-awful-ssl to support TLSv1.3 when adding mutual TLS support for nREPL. You can see the pull request here: https://github.com/nrepl/nrepl/pull/283/files It's certainly more work than just adding a proxy. Personally I've used nginx when doing TLS proxies. So I'd recommend the "proxy way" as well. Also worth checking out if you don't want your browser complaining when you are visiting your local https port: https://github.com/FiloSottile/mkcert/ How I've used this tool is generating a cert with mkcert, put it in an nginx docker container running with net host locally, then have the nginx forward to the actual http dev server running at e.g. http://localhost:12345. With that, http browser headers can be strict like in production, i.e. you'll have a good dev/prod parity. (Not sure if you are targeting browsers or not though.)

dharrigan13:07:15

I'm a big fan of mkcert - I use it for all my local development too 🙂

👍 2
Colin (fosskers)09:07:48

Thanks for the suggestions folks. I'm still tempted to handle things in-app :thinking_face:

Ivar Refsdal10:07:24

From what I can tell :ssl-context should be an instance of .ssl.SSLContext. that in turn can be created/constructed with less-awful-ssl. Some details here: https://github.com/ring-clojure/ring/issues/424 You can also see the nREPL pull request here: https://github.com/nrepl/nrepl/pull/283/files#diff-b7957e0ec76c0b96ff69fcf6a92bc013c0916dad48732b361f956e59446c42daR153-R170 (That namespace also supports smaller and more modern elliptic curve keys. It's just slightly modified from less-awful-ssl.)

Colin (fosskers)00:07:49

Ok that's a good sample, thank you

mx200010:07:35

I was just wondering if anyone is developing games with clojure ? At the moment I am cleaning up the engine of the rpg game I am developing: https://github.com/damn/gdx I have searched far and wide online but did not find anything much more then some old demos. Is nobody making games with clojure ?

Noah Bogart13:07:34

there's also the somewhat inactive #C066UV2MV channel

phill15:07:08

IIRC one of the more enthusiastic use cases for ClojureCLR was a certain game framework?

phill15:07:53

I expect ClojureDart will change the picture somewhat.

gnl17:07:17

Always worth mentioning in this context: • https://github.com/nasser/magichttps://github.com/arcadia-unity/Arcadia

👍 2
mx200019:07:10

Those are engines but I'm looking for actual games developed in clojure which are more than tech demos.

didibus04:07:20

Games per-say, not sure. But what always comes to my mind is how the Defold game engine is implemented in Clojure (the UI of it)

p-himik08:07:08

Seems like only the editor is written with Clojure and not the engine itself. Ah, that's probably what you meant by "the UI of it", which can be interpreted differently.

didibus10:07:15

Ya, that's what I meant. Engine is in C++

jumar05:07:51

There was once a kicksparter project for this game: https://github.com/Zetawar/zetawar I think it's abondoned now but I found it interesting at the time.

🙂 2
John Doe15:07:14

I followed https://clojure.org/reference/deps_and_cli#_using_tool_aliases try to install tool as alias in ~/.clojure/deps.edn

{:aliases {:cljfmt {:deps {io.github.weavejester/cljfmt
                           {:git/sha "4d32002e60c144f778df5bb3cfdcda098adc36e3"
                            :git/tag "0.10.6"}}
                    :ns-default cljfmt.tool}}}
clj -Tcljfmt complains Error building classpath. Unknown tool: cljfmt Any idea what am I doing wrong here? Clojure CLI version 1.11.1.1347

p-himik15:07:49

-T:cljfmt should be used instead of -Tcljfmt. But don't know whether that's the culprit.

John Doe15:07:05

@U2FRKM4TW you're right! I missed a colon... thanks mate

👍 2
John Doe16:07:06

I got confused with the proper tool install way that

clj -Ttools 
which does not need colon..