sirtoobii / vaultwarden_ldap_sync

Autmatically keep ldap in sync with your Vaultwarden installation
GNU General Public License v3.0
10 stars 7 forks source link

Cannot sync to vaultwarden #7

Closed TheLaskY closed 2 months ago

TheLaskY commented 2 months ago

When i start the containers, vaultwarden and vaultwarden_ldap_sync, an error happens:

2024-08-19:08:40:44 ERROR [sync.py] Something went wrong. Error: HTTPConnectionPool(host='127.0.0.1', port=80): Max retries exceeded with url: /admin/users (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f63be4e2880>: Failed to establish a new connection: [Errno 111] Connection refused'))

For the development purposes, vaultwarden url is set as http://127.0.0.1:80 Admin Token is set to root LDAP binding is good.

Here is my docker-compose:

version: "3.1"

services:
  vaultwarden_ldap_sync:
    container_name: vaultwarden_ldap_sync
    build:
      dockerfile: Dockerfile
      context: .
    restart: on-failure
    env_file:
      - .env-ldap
    volumes:
      - "./data/:/data"
  vaultwarden:
    container_name: vaultwarden
    image: vaultwarden/server:latest
    restart: on-failure
    env_file:
      - .env-vault
    ports:
      - 80:80
    volumes:
      - ./vw-data:/data/

Really hope to have some news to this project, never been so close to syncing AD users to vaultwarden!

sirtoobii commented 2 months ago

Hey @TheLaskY

This is most likely due to Docker's internal network configuration. You have not set networking mode to "host" and therefore 127.0.0.1 is only valid inside the docker container. To make it work, you have to set the Vaultwarden URL to something like http://vaultwarden

TheLaskY commented 2 months ago

Hey! Vacations made me forget about simple things to check, replacing 127.0.0.1 by my private ip works really fine now!

I'm closing this issue :D