Skip to content

FR: Add command hook to tailscale cert #5011

Closed

Description

@durind

What are you trying to do?

I'm trying to automate certificate renewal for Proxmox PVE and now I have to create a daily cronjob to update the Tailscale certificate with running pvenode cert set /root/[hostname].ts.net.crt /root/[hostname].ts.net.key --force --restart

How should we solve this?

If the tailscale cert command had an -run argument it could be used to run server specific commands to install and reload the renewed certificates when they are created.

tailscale cert -run "pvenode cert set /root/[hostname].ts.net.crt /root/[hostname].ts.net.key --force --restart"

What is the impact of not solving this?

Anything else?

No response

Activity

  1. added
    fr
    on Jul 6, 2022
  2. DentonGentry commented on Jul 6, 2022

    @DentonGentry
    Contributor

    I don't understand what a --run argument would bring versus having cron run a script:

    #!/bin/sh
    set -e
    tailscale cert --cert-file=/root/[hostname].ts.net.crt --key-file=/root/[hostname].ts.net.key example-tails-scales.ts.net
    pvenode cert set /root/[hostname].ts.net.crt /root/[hostname].ts.net.key --force --restart
    
  3. durind commented on Jul 6, 2022

    @durind
    Author

    I've understood that I don't have to run tailscale cert every time the certificate needs to be renewed in a cron job since tailscale would do that automatically.

    But when Tailscale renews the certificate it will save the certificates to --cert-file/key location but won't instruct the service to reload it (proxmox, nginx, apache, etc.)

  4. DentonGentry commented on Jul 6, 2022

    @DentonGentry
    Contributor

    tailscale cert runs once. It does not do some kind of background process to periodically update the certificates. In a few months when the certificates expire they just stop working.

    If you want to keep the certificates refreshed you need to periodically re-run tailscale cert

  5. durind commented on Jul 6, 2022

    @durind
    Author

    Then the KB-page https://tailscale.com/kb/1153/enabling-https/ has misleading information.

    "Either methods renew certificates as needed, before their 90 day expiry. A certificate is automatically requested for renewal within the weeks before its expiry, when a certificate is fetched."

  6. ecliptik commented on Jul 7, 2022

    @ecliptik

    I would like to see some way to manually renew a Tailscale certificate as well. I recently setup Plex Media Server using Tailscale MagicDNS and HTTPS certificates, but Plex uses a pkcs12 certificate and a passkey.

    These can be generated from the Tailscale certs with,

    sudo openssl pkcs12 -export -passout pass:"my_plex_pass_key" \
    -out /var/lib/tailscale/certs/plex.tailnet-0000.ts.net.p12 \
    -in /var/lib/tailscale/certs/plex.tailnet-0000.ts.net.crt \
    -inkey /var/lib/tailscale/certs/plex.tailnet-0000.ts.net.key \
    -certfile /var/lib/tailscale/certs/acme-account.key.pem
    

    and then configured as a Custom Certificate section in Plex, and it works.

    This will break when the certs expire, and having a way to manually renew them to put them into a cronjob to renew/restart automatically can avoid this.

    Currently I'm going to setup a daily cronjob to re-create plex.tailnet-0000.ts.net.p12 and restart Plex, which should catch any certs renewals most of the time, but having a deterministic way of doing this via tailscale cert is preferred.

  7. added
    L3 Some users
    P2 Aggravating
    T4 Docs
    and removed on Jul 9, 2022
  8. DentonGentry commented on Aug 28, 2022

    @DentonGentry
    Contributor

    Currently I'm going to setup a daily cronjob to re-create plex.tailnet-0000.ts.net.p12 and restart Plex, which should catch any certs renewals most of the time, but having a deterministic way of doing this via tailscale cert is preferred.

    A cronjob is what I would expect. Maybe once a week, request an updated certificate and install it.

  9. Omeryl commented on Oct 20, 2022

    @Omeryl

    @DentonGentry this seems like a good opportunity to at least clarify the docs, the way they are worded makes it sound like the certificate is kept in a tailscale config and automatically renewed without re-running the command. Maybe a section on adding it to a crontab?

  10. DentonGentry commented on Feb 17, 2023

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    L3 Some usersP2 AggravatingT4 Docsfrpending

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions