Skip to content

Instantly share code, notes, and snippets.

@Jimbolino
Created June 14, 2023 00:09
Show Gist options
  • Save Jimbolino/a2c8c0aeafa8ed35a364786e1aea77ba to your computer and use it in GitHub Desktop.
Save Jimbolino/a2c8c0aeafa8ed35a364786e1aea77ba to your computer and use it in GitHub Desktop.
HP DeskJet 2600 letsencrypt auto renewal script
#!/usr/bin/env bash
IP=192.168.1.123
PFX=certificate.pfx
DOMAIN=hp2600.example.com
PASS=$(cat /proc/sys/kernel/random/uuid)
openssl pkcs12 -export -out ${PFX} -inkey /etc/letsencrypt/live/${DOMAIN}/privkey.pem -in /etc/letsencrypt/live/${DOMAIN}/cert.pem -passout pass:"${PASS}"
curl --silent --insecure "https://${IP}/Security/DeviceCertificates/NewCertWithPassword/Upload?fixed_response=true" --form certificate=@${PFX} --form password="${PASS}" > last-result.log
rm ${PFX}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment