🔐 Auto SSL

Certificates that renew themselves

One installer sets up Let's Encrypt on a Debian or Ubuntu server, keeps every certificate renewed, and tells you on Telegram when something needs attention.

bash <(curl -fsSL https://github.com/Plus98ir/Auto_SSL/releases/latest/download/install-ssl-manager.sh)

Run it as root. It asks a few questions, then opens the ssl menu.

What it does

New certificates
Standard (with www added only when it resolves) or wildcard. Picks nginx or standalone mode on its own.
Checks before issuing
Confirms the domain points to this server and that port 80 is free, so failed attempts don't burn your Let's Encrypt quota.
Automatic renewal
Uses certbot's own timer, or cron when a proxy is set. Nothing gets scheduled twice.
After every renewal
Reloads nginx, optionally copies the files to a folder of your choice, runs your own command, and notifies Telegram.
Expiry report
A daily check that messages you when any certificate has 20 days or fewer left.
Wildcard that renews
Cloudflare API mode renews wildcards unattended. Manual TXT mode is still there, with a warning.
Telegram bot
Status, renew, new certificate, download and backup from your phone. Supports several admins.
Export
Writes .crt, .key and optionally .pfx for panels like x-ui and Marzban.
Backup and restore
Archives all of /etc/letsencrypt in one file, and puts it back just as easily.
Dry run
Test issuing or renewing against the staging server without using real quota.
Clean uninstall
Removes the bot, schedules and scripts. Your certificates stay where they are.

Step 1: create the bot (optional)

Skip this if you only want the terminal menu.

  1. Open Telegram and message @BotFather.
  2. Send /newbot and choose a display name.
  3. Choose a username that ends in bot, for example MySSLManagerBot.
  4. Copy the HTTP API token.
  5. Get your numeric ID by sending /start to @userinfobot. Repeat for every admin.
Keep the token private. If it leaks, revoke it in BotFather with /revoke and run the installer again.

Step 2: install

On a Debian or Ubuntu server, as root:

bash <(curl -fsSL https://github.com/Plus98ir/Auto_SSL/releases/latest/download/install-ssl-manager.sh)

The installer asks for:

It then installs the packages, writes the config, the renewal hook, the daily expiry check and the bot service, and opens the menu.

Upgrading from v1? Run systemctl disable --now ssl-bot first, so two listeners never poll the same token.

Terminal menu

Type ssl at any time.

OptionWhat it does
1 New certificateStandard or wildcard, with an optional dry run first.
2 Renew onePick a domain from the list and force-renew it.
3 Renew allRenews everything that is due, or tests it with a dry run.
4 Status of allFull certbot output plus days left for each domain.
5 Status of oneDetails for a single certificate.
6 Delete or revokeDeletes locally, or revokes at Let's Encrypt too. Removes the matching nginx vhost.
7 ExportWrites .crt / .key / .pfx to /root/ssl-exports/.
8 Backup or restoreArchives to /root/ssl-backups/, or restores from an archive.
9 SettingsPost-renew command, copy-to folder, and a Telegram test message.
10 UninstallRemoves SSL Manager. Certificates are kept.

Telegram bot

Only the admin IDs you entered get a reply. Everyone else is ignored.

CommandWhat it does
/startOpens the button menu.
/statusPick a domain to see its details and days left.
/renewPick a domain to renew now.
/newcert example.comChecks DNS and port 80, issues the certificate and sends the files.
/downloadPick a domain to receive its certificate files.
/backupCreates a backup on the server, and sends it if key sending is on.
With SEND_KEYS="no" the bot sends only fullchain.pem and tells you where the private key is on the server. Anything sent through Telegram stays on Telegram's servers.

How renewal works

You don't need to do anything once a certificate is issued.

Configuration

Everything lives in /etc/ssl-manager/config (mode 600). Menu option 9 edits the common settings for you.

SettingDefaultMeaning
EMAIL—Address for Let's Encrypt notices.
PROXY_URLemptyFor example http://user:[email protected]:8080. Leave empty for a direct connection.
BOT_TOKEN—Token from BotFather.
ADMIN_IDS—Numeric IDs, comma separated.
SEND_KEYSnoWhether the bot may send private keys and backups.
POST_RENEW_CMDemptyRun after each renewal, for example systemctl restart xray.
COPY_TO_DIRemptyCopy fullchain.pem and privkey.pem here after each renewal.
EXPIRY_WARN_DAYS20Report certificates with this many days or fewer left.

Files

PathPurpose
/etc/ssl-manager/configSettings and secrets.
/usr/local/bin/sslTerminal menu.
/usr/local/bin/ssl-bot.shTelegram bot, run by the ssl-bot service.
/usr/local/bin/ssl-lib.shShared helpers.
/usr/local/bin/ssl-expiry-check.shDaily expiry report.
/etc/letsencrypt/renewal-hooks/deploy/00-ssl-manager.shRuns after every renewal.
/var/log/ssl-manager.logIssues, renewals and warnings.
/root/ssl-backups/Backup archives.
/root/ssl-exports/Exported certificate files.

Security

Do you need a proxy?

Only if the server can't reach acme-v02.api.letsencrypt.org or api.telegram.org directly. Servers outside Iran should leave it empty.

The proxy has to be reachable from the server itself. 127.0.0.1 means the server, not your own computer. Check it with:

ss -ltnp | grep <port>
curl -x http://127.0.0.1:<port> -I https://api.telegram.org

Troubleshooting

SymptomCause and fix
The bot doesn't answerCheck systemctl status ssl-bot and journalctl -u ssl-bot -f. Make sure an old v1 listener isn't using the same token, and that your ID is in ADMIN_IDS.
Domain does not resolveThe A record is missing or hasn't propagated. Fix DNS and try again.
Port 80 is busyAnother service (Apache, HAProxy, Xray) holds port 80. Stop it for issuing, or put nginx in front.
Too many failed authorizationsLet's Encrypt rate limit. Wait an hour and use a dry run until it passes.
Wildcard didn't renewIt was issued in manual mode. Reissue it in Cloudflare mode.
Renewed, but the site shows the old certificateThe service using it wasn't restarted. Set POST_RENEW_CMD.
No renewal messages on TelegramUse menu option 9 to send a test message. If it fails, check the token and the proxy.