{ stdenv, writeText , simp_le , eject }: #dir: domain: let dir = "/etc/ssl/self/${domain}"; script = writeText "${domain}.sh" '' backupDir=/root/ssl_archive/$(date +'%Y-%m-%d')-$$-${domain} mkdir -p ${dir} cd ${dir} mkdir -p $backupDir for f in account_key.json cert.pem fullchain.pem key.pem privkey.pem; do [[ -e $f ]] && mv $f $backupDir done ${simp_le}/bin/simp_le -d ${domain}:/srv/www/acme/${domain}/ \ --email "phikeebaogobaegh@141.li" \ -f account_key.json \ -f cert.pem \ -f fullchain.pem \ -f key.pem || { for f in *; do rm $f; done; mv $backupDir/* . && rmdir $backupDir; } [[ -e key.pem ]] && ln -s -f key.pem privkey.pem ''; in "bash ${script} 2>&1 | ${eject}/bin/logger -p auth.info"