Forceu / Gokapi

Lightweight selfhosted Firefox Send alternative without public upload. AWS S3 supported.
GNU Affero General Public License v3.0
1.14k stars 47 forks source link

E2E Encryption not initialising #188

Closed Forceu closed 1 week ago

Forceu commented 2 weeks ago

Discussed in https://github.com/Forceu/Gokapi/discussions/187

Originally posted by **MalteMagnussen** July 5, 2024 Trying to set up Level 3 End-to-End Encryption: https://gokapi.readthedocs.io/en/latest/setup.html#encryption But it just "hangs" when it gets to this point. ![image](https://github.com/Forceu/Gokapi/assets/11192971/18bae5d5-1dca-455f-8374-baa4f0da6ae7) Nothing in the log about it either.
Forceu commented 2 weeks ago

@MalteMagnussen What OS/Browser are you using?

MalteMagnussen commented 2 weeks ago

The "OS" is Ubuntu on my machine, but it is running locally via docker-compose in the official image.

The browser is firefox.

I do:

  1. docker compose up
  2. Open browser (Firefox) for setup
  3. Just spam "next" through setup. Do username+password.
  4. Login as admin
  5. See the "Generating" page

Logs:

mhm@mhm:~/Documents/gokapi$ docker compose up
[+] Running 2/0
 ✔ Container gokapi-gokapi-1     Created                                                                               0.0s 
 ✔ Container gokapi-fluentbit-1  Created                                                                               0.0s 
Attaching to fluentbit-1, gokapi-1
gokapi-1     | 
gokapi-1     | ██████   ██████   ██   ██  █████  ██████  ██ 
gokapi-1     | ██       ██    ██ ██  ██  ██   ██ ██   ██ ██ 
gokapi-1     | ██   ███ ██    ██ █████   ███████ ██████  ██ 
gokapi-1     | ██    ██ ██    ██ ██  ██  ██   ██ ██      ██ 
gokapi-1     |  ██████   ██████  ██   ██ ██   ██ ██      ██ 
gokapi-1     |                                              
gokapi-1     | Gokapi v1.8.4 starting
gokapi-1     | Please open http://127.0.0.1:53842/setup to setup Gokapi.
fluentbit-1  | Fluent Bit v3.0.7
fluentbit-1  | * Copyright (C) 2015-2024 The Fluent Bit Authors
fluentbit-1  | * Fluent Bit is a CNCF sub-project under the umbrella of Fluentd
fluentbit-1  | * https://fluentbit.io
fluentbit-1  | 
fluentbit-1  | ___________.__                        __    __________.__  __          ________  
fluentbit-1  | \_   _____/|  |  __ __   ____   _____/  |_  \______   \__|/  |_  ___  _\_____  \ 
fluentbit-1  |  |    __)  |  | |  |  \_/ __ \ /    \   __\  |    |  _/  \   __\ \  \/ / _(__  < 
fluentbit-1  |  |     \   |  |_|  |  /\  ___/|   |  \  |    |    |   \  ||  |    \   / /       \
fluentbit-1  |  \___  /   |____/____/  \___  >___|  /__|    |______  /__||__|     \_/ /______  /
fluentbit-1  |      \/                     \/     \/               \/                        \/ 
fluentbit-1  | 
fluentbit-1  | [2024/07/09 14:31:10] [ info] [fluent bit] version=3.0.7, commit=c3d12804d2, pid=1
fluentbit-1  | [2024/07/09 14:31:10] [ info] [storage] ver=1.5.2, type=memory, sync=normal, checksum=off, max_chunks_up=128
fluentbit-1  | [2024/07/09 14:31:10] [ info] [cmetrics] version=0.9.1
fluentbit-1  | [2024/07/09 14:31:10] [ info] [ctraces ] version=0.5.1
fluentbit-1  | [2024/07/09 14:31:10] [ info] [input:tail:tail.0] initializing
fluentbit-1  | [2024/07/09 14:31:10] [ info] [input:tail:tail.0] storage_strategy='memory' (memory only)
fluentbit-1  | [2024/07/09 14:31:10] [ info] [sp] stream processor started
fluentbit-1  | [2024/07/09 14:31:10] [ info] [output:stdout:stdout.0] worker #0 started
gokapi-1     | Saving new files to local storage
gokapi-1     | Found folder 'templates', using local folder instead of internal template folder
gokapi-1     | Found folder 'static', using local folder instead of internal static folder
gokapi-1     | Binding webserver to :53842
gokapi-1     | Webserver can be accessed at http://127.0.0.1:53842/admin
gokapi-1     | Press CTRL+C to stop Gokapi

image

Forceu commented 2 weeks ago

According to the attached logs you are replacing the static folder that contains the JavaScript with a local folder. Can you confirm that the JS file was minified and is correctly loaded?

MalteMagnussen commented 2 weeks ago

@Forceu - The Dockerfile is as follows:

FROM company-mirror/gokapi:v1.8.4

COPY ./web/templates/ /app/templates/
COPY ./web/static/ /app/static/

# https://github.com/Forceu/Gokapi/discussions/184#discussioncomment-9871479
RUN mv /app/static/css/cover.css /app/static/css/min/gokapi.min.css

The web folder is a copy of the web folder from this repo, with some updates to apply company branding.

We don't do any minify or loading.

I followed the steps here, which say to just copy the files: https://gokapi.readthedocs.io/en/latest/advanced.html#customising

Do we need to add something like

FROM company-mirror/gokapi:v1.8.4

COPY ./web/templates/ /app/templates/
COPY ./web/static/ /app/static/

RUN go generate ./... 
RUN go build github.com/forceu/gokapi/cmd/gokapi.

EDIT: Ah, we're back to the multi-stage thing.

https://github.com/Forceu/Gokapi/blob/master/Dockerfile#L15

Should I just submodule this repo, and basically copy the Dockerfile, and change it so we COPY our web folder instead of yours?

Forceu commented 2 weeks ago

Please try if it works if you do not replace the static and template folder. If it does, there is a problem with your modification and out of scope for this place. Otherwise I offer a paid support plan for commercial users of Gokapi. If your company is interested in this, let me know.

MalteMagnussen commented 1 week ago

@Forceu - I ran it with your official image directly, and it works just fine.

So it seems like there is some change that interferes somehow in our web folder.

Forceu commented 1 week ago

Okay, thanks for the reply. Yeah it is weird, that there is no console output, but it is probably a problem with the JavaScript file