#!/usr/bin/env fish cd (dirname (status current-filename))/certs; or exit set days 10000 # 27 years if test -f key.pem echo 'Warning! If you have already generated keys, they will be overwritten.' echo 'If you continue, you will fail Trust On First Use, and some browsers may' echo 'be unhappy with your site.' echo 'If you have not yet published your site, you can ignore this warning.' echo end echo 'To generate certificatates, enter the domain name that your site will be' echo 'eventually published on. If you don\'t care, you can enter nothing.' echo -n 'Example input: '; set_color cyan; echo 'an-excellent.website' read domain -P 'domain name > ' echo # Country, state, locality, organisation, unit, domain name, email echo -en ".\n.\n.\n.\n.\n$domain\n.\n" | \ openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days $days -nodes \ ; or exit echo echo echo 'Everything appears to be okay.'