Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Admin password required for backup command? #1363

Closed
nununo opened this issue May 22, 2022 · 2 comments · Fixed by #1432
Closed

Admin password required for backup command? #1363

nununo opened this issue May 22, 2022 · 2 comments · Fixed by #1432
Assignees
Milestone

Comments

@nununo
Copy link

nununo commented May 22, 2022

Hello,

I feel like I'm probably missing something simple here.

I have been using remark42 for a while now and everything is working fine. But now I finally decided to take care of automating backups/restores and am running into an issue:

When I try to run this command:

docker exec -it remark42 backup -s mysite

It says that mandatory parameter --admin-passwd is missing.

I assumed I didn't need an admin password in my production instance since in the docs it is said:

make sure you don't keep ADMIN_PASSWD=something... for any non-development deployments
But now it seems it is required by the backup command.

Anyway, I updated my docker-compose.yml to include an admin password and yet, when I tried to pass it to the command, I am getting a 401 Unauthorized error.

Here's my docker-compose.yml:

version: '3.4'

networks:
  traefik:
    external:
      name: traefik

services:
  remark:
    image: umputun/remark42:v1.9.0
    container_name: remark42
    hostname: remark42
    restart: always
    networks:
    - traefik
    environment:
    - TIME_ZONE=Europe/Lisbon
    - REMARK_URL=https://redacted
    - SECRET=${REMARK42_SECRET}
    - SITE=redacted
    - STORE_BOLT_PATH=/srv/var/db
    - BACKUP_PATH=/srv/var/backup
    - NOTIFY_ADMINS=email
    - NOTIFY_USERS=email
    - NOTIFY_EMAIL_FROM=redacted
    - ADMIN_SHARED_EMAIL=redacted
    - SMTP_HOST=smtp.sendgrid.net
    - SMTP_PORT=465
    - SMTP_TLS=true
    - SMTP_USERNAME=apikey
    - SMTP_PASSWORD=${REMARK42_SMTP_PASSWORD}
    - SMTP_TIMEOUT=60
    - AUTH_EMAIL_ENABLE=true
    - AUTH_EMAIL_FROM=redacted
    - AUTH_GITHUB_CID=${REMARK42_AUTH_GITHUB_CID}
    - AUTH_GITHUB_CSEC=${REMARK42_AUTH_GITHUB_CSEC}
    - AUTH_GOOGLE_CID=${REMARK42_AUTH_GOOGLE_CID}
    - AUTH_GOOGLE_CSEC=${REMARK42_AUTH_GOOGLE_CSEC}
    - ADMIN_PASSWD=${REMARK42_ADMIN_PASSWORD}
    - ADMIN_SHARED_ID=github_redacted
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "5"
    volumes:
      - data:/srv/var
    labels:
      - traefik.enable=true
      - traefik.http.services.remark42.loadbalancer.server.port=8080
      - traefik.http.routers.remark42.rule=Host(`redacted`)
      - traefik.http.routers.remark42.entrypoints=redacted
      - traefik.http.routers.remark42.tls=true
      - traefik.http.routers.remark42.tls.certresolver=letsencrypt
      - traefik.docker.network=traefik

volumes:
  data:

All the referenced environment variables are in a remark42.env file next to docker-compose.yml.

I'm sure I'm missing something simple but I don't know what it is. Please advise.

Thanks in advance.

Regards.

@umputun
Copy link
Owner

umputun commented May 22, 2022

yes, the admin password is indeed required to secure the backup/restore endpoints. This is done to allow access to protected /admin/export and /admin/import APIs.

Btw, you should have automated backups active already, making a backup file every 24h and keeping up to MAX_BACKUP_FILES (default 10) in BACKUP_PATH location (default ./var/backup)

@paskal - we should update docs to describe it.

@umputun
Copy link
Owner

umputun commented May 22, 2022

regarding "tried to pass it to the command, I am getting a 401 Unauthorized error." - are you sure you have restarted the container after the change?

you can see all the variables you set with `docker exec -it -it remark42 sh -c "export"

you can also try to run the command directly, and pass the password, like this docker exec -it remark42 /srv/remark42 backup --site=your-site --admin-passwd=password

@paskal paskal self-assigned this May 23, 2022
@paskal paskal added this to the v1.11.0 milestone Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants