# Einrichtung Lets Encrypt Zertifikat über Port 80 und im Terminal

#### Einrichtung des Clients

1\. Als erstes Git installieren. Dazu per ssh einloggen

```
apt install git -y
```

2\. Client herunterladen

```
cd /root/
git clone https://github.com/Neilpang/acme.sh.git acme-master
```

Client konfigurieren unsere einstellungen speichern wir unter /etc/pve/.le  
Dazu wird das Verzeichnis erstellt.

```
mkdir /etc/pve/.le
cd /root/acme-master
```

Nun die Konfiguration erstellen, dazu benötigen wir eine Emailadresse

```
./acme.sh --install --accountconf /etc/pve/.le/account.conf --accountkey /etc/pve/.le/account.key --accountemail "eMail@addresse.de"
```

Danach aus der Shell ausloggen und wieder einloggen, um die bashrc neu zu laden

#### Das erste Zertifikat

zuerst wird ein Probezertifikat erstellt um zu sehen ob auch alles klappt bevor wir uns sperren lassen.  
$DOMAIN wird mit unserer Domain ersetzt z.b meinedomain.org oder subdomain.meinedomain.org

```
cd /root/acme-master
./acme.sh --issue --standalone --keypath /etc/pve/local/pveproxy-ssl.key --fullchainpath /etc/pve/local/pveproxy-ssl.pem --reloadcmd "systemctl restart pveproxy" -d $DOMAIN --test
```

Ist das Zertifikat durchgelaufen, dann wird test durch --force ersetzt

```
./acme.sh --issue --standalone --keypath /etc/pve/local/pveproxy-ssl.key --fullchainpath /etc/pve/local/pveproxy-ssl.pem --reloadcmd "systemctl restart pveproxy" -d $DOMAIN --force
```

#### Zertifikat Updaten

Einen cronjob anlegen

```
crontab -e
```

Nun im crontab diese zeile einfügen

```
0 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null
```

Fertig