Hi from Gem2Browser

I added a feature to my HTTP to Gemini that can load client certs! :3

ref: Discourse post about the new feature

😺 swee

2025-01-15 · 1 year ago · 👍 clseibold

13 Comments ↓

🌆 skyjake [...] · 2025-01-15 at 05:55:

Where are the client certificates (their private keys) stored? For security purposes, it would be wise to keep them on the user's local machine.

😺 swee [OP] · 2025-01-15 at 05:59:

The certificates uploaded to the server will be stored persistently on the server, if it were generated, the server would store it, and make the client download both the private key and chain in zip form.

😺 swee [OP] · 2025-01-15 at 06:01:

The name of the certificate (which would be a UUID) is stored in a cookie (locally)

😺 swee [OP] · 2025-01-15 at 21:58:

I might make it store the cert & privkey in cookies some time

💎 pista · 2025-01-17 at 17:50:

I was about to work on something like this. Glad someone already did it.

It’s a good way to solve the problem of enabling Gemini access from older systems without modern SSL if you don’t mind the security holes that come from running it on port 80 behind basic http auth.

😺 swee [OP] · 2025-01-17 at 19:28:

@pista yeah, I mainly made this because there isn't a great way to universally use Gemini (Especially when I use Alpine Linux and old android versions)

Plus, it just feels easier/comfortable to access gemini from my regular browser instead of some client I have to learn to use.

💎 pista · 2025-01-18 at 00:01:

Is it currently in a working state? I tried installing and am getting what appears to be error related to hypercorn and flask:

[2025-01-17 18:56:02 -0500] [276399] [ERROR] Error in ASGI Framework

Traceback (most recent call last):

File "/usr/lib/python3/dist-packages/hypercorn/asyncio/task_group.py", line 21, in _handle

await invoke_asgi(app, scope, receive, send)

File "/usr/lib/python3/dist-packages/hypercorn/utils.py", line 242, in invoke_asgi

asgi_instance = app(scope)

TypeError: Flask.__call__() missing 1 required positional argument: 'start_response'

😺 swee [OP] · 2025-01-18 at 23:30:

@pista Yes, it is working for me. Weird, I never had an error like this...

I'm currently using Flask version 3.0.2 and hypercorn version 0.14 (provided by Ubuntu)

Update: I made a workflow to test my webserver, it uses the latest Hypercorn & Flask ver, but it seems to work fine

— ref: Forgejo action runs

💎 pista · 2025-01-19 at 04:37:

That’s probably the problem. My server is on jammy and has the last version of flask.

Ho hum. Guess I need to go ahead with writing my own version in something with easier requirements.

😺 swee [OP] · 2025-01-19 at 06:21:

@pista I made an update that requires the manual use of the hypercorn command, you can try using the webserver using `hypercorn --bind=0.0.0.0:2009 server:app` and it should work properly

💎 pista · 2025-01-19 at 15:32:

No change really. It's probably the fault of the Python libraries, not you.

[ERROR] Error in ASGI Framework

Traceback (most recent call last):

File "/usr/lib/python3/dist-packages/hypercorn/asyncio/task_group.py", line 21, in _handle

await invoke_asgi(app, scope, receive, send)

File "/usr/lib/python3/dist-packages/hypercorn/utils.py", line 242, in invoke_asgi

asgi_instance = app(scope)

TypeError: Flask.__call__() missing 1 required positional argument: 'start_response'

😺 swee [OP] · 2025-01-19 at 19:40:

@pista ugh, who knows what'll fix that than, maybe even using a different ASGI/WSGI framework could fix it, though I only tested the flask app on hypercorn and flask dev mode :p

😺 swee [OP] · 2025-02-17 at 05:35:

@pista Just found out about your problem...

Apparently the hypercorn and flask versions provided by Ubuntu **jammy** and older are outdated and break.

So what I'd recommend you to do is either use venv, use pip, or upgrade to Ubuntu Noble