Let's Encrypt SSL on Azure for Posit Team (RHEL and Ubuntu)
Step-by-step: issue and auto-renew a free Let's Encrypt certificate with Certbot on Red Hat and Ubuntu servers in Azure, then serve Posit Team over HTTPS.
- 2
- 3
- 0
Overview
This guide walks through issuing a free, publicly trusted Let’s Encrypt certificate with Certbot on a Red Hat Enterprise Linux or Ubuntu Server virtual machine in Microsoft Azure, and then using that certificate for Posit Team: Posit Connect, Posit Workbench and Posit Package Manager.
It follows the official Let’s Encrypt guidance (use an ACME client, test against staging before production) and adapts the general Posit approach for Certbot to Azure. The Posit configuration blocks are the same on both distributions; only the install steps differ.
Replace <FQDN> with the server’s public name, for example posit.<region>.cloudapp.azure.com.
Problem
Browsers reject plain HTTP for sign-in pages and warn on untrusted certificates. Posit products also call each other and R or Python package repositories over HTTPS, so an untrusted certificate breaks automation as well as the browser experience.
Let’s Encrypt certificates are short lived (90 days), so a manual process does not scale. Issuance and renewal have to be automated, and each Posit service has to pick up the renewed file.
Approach
Phase 1: Azure prerequisites
- Give the VM a static public IP and a DNS name. Either set the DNS name label on the public IP (
<label>.<region>.cloudapp.azure.com) or create anArecord in Azure DNS or your own zone. - In the VM’s network security group, allow inbound TCP 80 (needed for the HTTP-01 challenge, which runs only on port 80) and TCP 443, plus any Posit ports you serve over HTTPS.
- Confirm the name resolves to the VM before requesting a certificate:
dig +short <FQDN>
If port 80 cannot be exposed, use the DNS-01 challenge instead. It needs a DNS provider with an API and supports wildcard names, but API credentials on the server are a security consideration.
Phase 2: install Certbot
Let’s Encrypt recommends Certbot for most people. Certbot’s own instructions use snap, so the same method works on both distributions once snapd is present.
Ubuntu Server
sudo apt update
sudo snap install --classic certbot
sudo ln -sf /snap/bin/certbot /usr/local/bin/certbot
Red Hat Enterprise Linux
sudo dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-$(rpm -E %rhel).noarch.rpm
sudo dnf install -y snapd
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap
sudo snap install --classic certbot
sudo ln -sf /snap/bin/certbot /usr/local/bin/certbot
Log out and in again (or wait a minute) if snap reports that it is still seeding. If the host uses a firewall, open the ports too:
# RHEL (firewalld)
sudo firewall-cmd --permanent --add-service=http --add-service=https && sudo firewall-cmd --reload
# Ubuntu (ufw)
sudo ufw allow 80,443/tcp
Phase 3: request the certificate
Posit products do not share a web server that Certbot can edit, so use the standalone authenticator. It starts a temporary listener on port 80, so nothing else may be using that port while it runs.
Test against the Let’s Encrypt staging environment first, to avoid rate limits while you debug:
sudo certbot certonly --standalone --dry-run -d <FQDN> -m <ADMIN_EMAIL> --agree-tos
Then issue the real certificate:
sudo certbot certonly --standalone -d <FQDN> -m <ADMIN_EMAIL> --agree-tos
Certbot writes the files under /etc/letsencrypt/live/<FQDN>/:
fullchain.pem: the certificate plus the intermediate chain (use this as the certificate)privkey.pem: the private key
Those paths are symlinks into archive/ and change on every renewal, and privkey.pem is readable only by root. Posit services run as their own users, so copy the files to a location they can read, as the next phase shows.
Phase 4: share the certificate with the Posit service users
Create a group, a directory and a deploy hook. Certbot runs every script in renewal-hooks/deploy/ after each successful renewal, so this is also what keeps the services current.
sudo groupadd --system posit-ssl
sudo usermod -aG posit-ssl rstudio-connect
sudo usermod -aG posit-ssl rstudio-pm
sudo usermod -aG posit-ssl rstudio-server 2>/dev/null || true
sudo install -d -m 750 -o root -g posit-ssl /etc/posit-ssl
/etc/letsencrypt/renewal-hooks/deploy/posit.sh:
#!/bin/bash
set -euo pipefail
LIVE=/etc/letsencrypt/live/<FQDN>
DEST=/etc/posit-ssl
install -m 644 -o root -g posit-ssl "$LIVE/fullchain.pem" "$DEST/fullchain.pem"
install -m 640 -o root -g posit-ssl "$LIVE/privkey.pem" "$DEST/privkey.pem"
systemctl restart rstudio-connect rstudio-pm
rstudio-server restart
sudo chmod 755 /etc/letsencrypt/renewal-hooks/deploy/posit.sh
sudo /etc/letsencrypt/renewal-hooks/deploy/posit.sh
On RHEL with SELinux enforcing, label the directory so the services may read it, and leave SELinux enabled:
sudo semanage fcontext -a -t cert_t "/etc/posit-ssl(/.*)?"
sudo restorecon -Rv /etc/posit-ssl
Phase 5: Posit Connect
/etc/rstudio-connect/rstudio-connect.gcfg:
[Server]
Address = https://<FQDN>
[HTTPS]
Listen = :443
Certificate = /etc/posit-ssl/fullchain.pem
Key = /etc/posit-ssl/privkey.pem
Permanent = true
Phase 6: Posit Workbench
/etc/rstudio/rserver.conf:
ssl-enabled=1
ssl-certificate=/etc/posit-ssl/fullchain.pem
ssl-certificate-key=/etc/posit-ssl/privkey.pem
ssl-protocols=TLSv1.2 TLSv1.3
Phase 7: Posit Package Manager
/etc/rstudio-pm/rstudio-pm.gcfg. Package Manager needs distinct HTTP and HTTPS ports:
[Server]
Address = https://<FQDN>:<PACKAGE_MANAGER_PORT>
[HTTP]
Listen = :<PACKAGE_MANAGER_HTTP_PORT>
[HTTPS]
Listen = :<PACKAGE_MANAGER_PORT>
Certificate = /etc/posit-ssl/fullchain.pem
Key = /etc/posit-ssl/privkey.pem
If all three products share one server, give each its own HTTPS port (or put them behind separate hostnames), since only one process can listen on 443. Restart each service after editing its configuration:
sudo rspm check-config
sudo systemctl restart rstudio-connect rstudio-pm
sudo rstudio-server restart
Outcome
Confirm the certificate and chain from any machine:
curl -vI https://<FQDN> 2>&1 | grep -E "subject:|issuer:|expire date|HTTP/"
Then prove that renewal works end to end, hook included, without waiting 60 days:
sudo certbot renew --dry-run
sudo systemctl list-timers | grep -i certbot
The snap installs a timer that runs twice a day and renews a certificate only when it is close to expiry.
Technical notes
Troubleshooting reference
| Symptom | Likely cause | Fix |
|---|---|---|
Timeout during connect or Connection refused |
Port 80 blocked by the Azure NSG, host firewall, or a service already bound to it | Allow TCP 80 in the NSG and firewall, stop the service using port 80, retry |
DNS problem: NXDOMAIN |
The name does not resolve to the VM yet | Fix the DNS label or A record, check with dig |
too many certificates already issued |
Let’s Encrypt rate limit reached | Use --dry-run (staging) while testing; wait for the limit window to pass |
permission denied opening the key |
Service user is not in posit-ssl, or directory not 750 |
Check id <service-user>; confirm 640 root:posit-ssl on the key |
| Service still serves the old certificate | Deploy hook did not run or the service was not restarted | Run the hook manually; check journalctl -u rstudio-connect |
| SELinux denials on RHEL | Key and certificate path not labelled | semanage fcontext and restorecon; inspect with ausearch -m avc |
Notes on the approach
- HTTP-01 versus DNS-01. HTTP-01 is the easiest to automate on a single public VM. Choose DNS-01 for wildcard names or servers that cannot expose port 80.
- Staging first. Test with
--dry-runbefore issuing; production has rate limits. - Internal-only servers. If the host has no public name or open port 80, Let’s Encrypt cannot validate it; use an internal CA or a self-signed certificate instead.
- Source note. The Posit support article on generating a Certbot certificate for Posit products was not accessible when this guide was written, so the Posit settings above follow the standard Connect, Workbench and Package Manager configuration. Check them against the version of each product you run.
next step
Discuss a similar project
Thirty minutes, free, on Google Meet. Bring the current state and the constraint.
