Skip to content

Allow certificates to be automatically re-read when they are updated #2823

Open

Description

@calisro

Reference:
https://forum.rclone.org/t/davs-http-read-new-certificate/7877/3

Issue: when ssl certificates are replaced (like letsencrypt) in order for rclone to use those new certificates, rclone would need to be restarted. This enhancement would be to have that file either reread automatically or allow it to be programatically told to re-read via the rc remote control daemon process so that there would be no need to restart rclone.

Letsencrypt certificates get replaced more frequently than 1yr or 2yr certificates so this would help here.

Activity

  1. changed the title [-]All certificates to be automatically re-read when they are updated[/-] [+]Allow certificates to be automatically re-read when they are updated[/+] on Dec 8, 2018
  2. added this to the v1.46 milestone on Dec 30, 2018
  3. modified the milestones: v1.46, v1.47 on Feb 9, 2019
  4. modified the milestones: v1.47, v1.48 on Apr 15, 2019
  5. modified the milestones: v1.48, v1.49 on Jun 19, 2019
  6. modified the milestones: v1.49, v1.50 on Aug 27, 2019
  7. modified the milestones: v1.50, Soon on Oct 26, 2019
  8. ivandeex commented on Nov 16, 2020

    @ivandeex
    Member

    rclone could either re-read certs on SIGHUP or honor new flag --certs-poll-interval=xxx

  9. Ronnocerman commented on Mar 17, 2023

    @Ronnocerman

    So that others have an easier time finding this to +1 it, I'm going to explain it with some keyword-heavy language since it took me ~6 months of looking around online to finally find this issue:

    rclone stops serving images after a few weeks to a month and starts giving the error:

    {date} {time} http: TLS handshake error from {ip}:{port}: remote error: tls: unknown certificate

    This is due to the fact that rclone does not pick up the new certificates when ssl certificates are renewed, causing the expired and out-of-date certificate to be served, resulting in broken images.

    To fix this, you generally have to restart rclone every so often.

  10. ncw commented on Mar 17, 2023

    @ncw
    Member

    Thanks @Ronnocerman .

    Fancy having a go at a fix?

  11. Ronnocerman commented on Mar 17, 2023

    @Ronnocerman

    Nope. I know just enough to sound like I know more than I do. :) I wouldn't even remotely have the expertise to be able to fix it.

    However, I will help out future viewers by giving them a bandage that I cobbled together from various places:

    First, create a systemd service:
    sudo vim /etc/systemd/system/your_service_name.service

    Next, paste this in and edit where indicated:

    [Unit]
    Description=Rclone VFS Mount <OR YOUR DESCRIPTION HERE>
    After=network-online.target
    
    [Service]
    User=root <OR YOUR SPECIFIC RCLONE USER HERE>
    Group=root <OR YOUR SPECIFIC RCLONE GROUP HERE>
    Type=simple
    ExecStartPre=/bin/sleep 10
    ExecStart=/usr/bin/rclone serve http <YOUR RCLONE PARAMS HERE>
      --log-level INFO \
      --log-file /opt/rclone.log
    Restart=on-failure
    RestartSec=5
    RuntimeMaxSec=1d
    LimitNOFILE=infinity
    
    [Install]
    WantedBy=default.target
    

    Then start your service:
    sudo systemctl start your_service_name

    Or, if you want it to always start on boot, enable your service:
    sudo systemctl enable your_service_name

    The Restart=on-failure plus RuntimeMaxSec=1d will make it so that rclone restarts every day, picking up the new certificates. Feel free to adjust the interval to whatever you want.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions