andrii-kryvoviaz / slink

Self-hosted image sharing service.
GNU Affero General Public License v3.0
313 stars 9 forks source link

Unable to connect to account #25

Closed tiritibambix closed 6 months ago

tiritibambix commented 6 months ago

Hey there!

I just set up Slink on my server and I'm currently running it locally without a domain. Here's my docker-compose configuration:

version: "3.3"
services:
  slink:
    image: anirdev/slink:latest
    container_name: slink
    environment:
      - ORIGIN=http://192.168.1.103:3486
      - USER_APPROVAL_REQUIRED=false #for now
      - USER_PASSWORD_MIN_LENGTH=8
      - USER_PASSWORD_REQUIREMENTS=15
      - IMAGE_MAX_SIZE=15M
      - STORAGE_PROVIDER=local
    volumes:
      - /srv/Files/Slink/var/data:/app/var/data
      - /srv/Files/Slink/images:/app/slink/images
    ports:
      - "3486:3000"

I'm able to create an account, but unfortunately, I'm having trouble logging in. When I fill in the fields (by the way, the username field asks for an email address) and click sign in, I get redirected to the main page without actually being logged in.

Here are the logs:

2024-05-17 11:02:57,183 INFO Included extra file "/etc/supervisor/conf.d/production.conf" during parsing
2024-05-17 11:02:57,183 INFO Set uid to user 0 succeeded
2024-05-17 11:02:57,193 INFO RPC interface 'supervisor' initialized
2024-05-17 11:02:57,193 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2024-05-17 11:02:57,194 INFO supervisord started with pid 1
2024-05-17 11:02:58,201 INFO spawned: 'client-app' with pid 8
2024-05-17 11:02:58,208 INFO spawned: 'redis' with pid 9
2024-05-17 11:02:58,213 INFO spawned: 'startup' with pid 10
2024-05-17 11:02:58,219 INFO spawned: 'swoole-runtime' with pid 11
2024-05-17 11:02:58,225 INFO spawned: 'symfony_about' with pid 12
2024-05-17 11:02:58,234 INFO success: startup entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
Listening on 0.0.0.0:3000
2024-05-17 11:02:59,841 INFO success: client-app entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-05-17 11:02:59,841 INFO success: redis entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-05-17 11:02:59,841 INFO success: swoole-runtime entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-05-17 11:02:59,841 INFO success: symfony_about entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2024-05-17 11:03:00,482 WARN exited: symfony_about (exit status 1; not expected)
 [OK] Successfully migrated to version:                                         
      Slink\Shared\Infrastructure\Persistence\EventStore\Migrations\Version20231
      029174455                                                                 
 [OK] Successfully migrated to version:                                         
      Slink\Shared\Infrastructure\Persistence\Doctrine\Migrations\Version2024022
 [OK] Done!                                                                     
2024-05-17 11:03:02,626 INFO exited: startup (exit status 0; expected)

Any assistance you can provide would be greatly appreciated. Thank you!

PS: I tried docker exec -it slink slink user:activate --email=<user-email> despite setting SER_APPROVAL_REQUIRED=false. It says that the account has been successful activated but I still can't login.

andrii-kryvoviaz commented 6 months ago

Hi @tiritibambix,

It seems like there might be a problem with session persistence. The authorization is cookie-based and might not work correctly when FQDN is not set. For security reasons, it won't set cookies without SSL configured. I might need to consider making this configurable.

Alternatively, you can set up an FQDN along with an automatically generated SSL certificate from Let's Encrypt. It is not that hard, to be honest.

tiritibambix commented 6 months ago

Hello @andrii-kryvoviaz and thank you for your answer.

I just set up a subdomain with ssl certificat and changed ORIGIN to that domain. It is now working, so thank you.

I might need to consider making this configurable.

I'm not gonna lie, that would be a valuable option for my use case.

Anyway, thanks a lot for your work and help on this topic.