westor

UnrealIRCD Update CERTS for ComputerTech v1.0

Oct 25th, 2020 (edited)
575
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.62 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # To work under crontab it must be used: chmod +x certs_update.sh
  4.  
  5. P="/home/USER_NAME_HERE/unrealircd"
  6. U1="https://DOMAIN_NAME_HERE/fullchain.pem"
  7. U2="https://DOMAIN_NAME_HERE/privkey.pem"
  8. F1="fullchain.pem"
  9. F2="privkey.pem"
  10.  
  11. if [ -f "$P/conf/certs/$F1" ]; then
  12.     cp -v $P/conf/certs/$F1 $P/conf/certs/$F1.OLD
  13. fi ;
  14.  
  15. if [ -f "$P/conf/certs/$F2" ]; then
  16.     cp -v $P/conf/certs/$F2 $P/conf/certs/$F2.OLD
  17. fi ;
  18.  
  19. curl "$U1" --output "$P/conf/certs/$F1"
  20.  
  21. if [[ $? != 0 ]] ; then
  22.     exit 1
  23. fi ;
  24.  
  25. curl "$U2" --output "$P/conf/certs/$F2"
  26.  
  27. if [[ $? != 0 ]] ; then
  28.     exit 2
  29. fi ;
  30.  
  31. $P/unrealircd rehash -tls
Add Comment
Please, Sign In to add comment