tweak cert template
change permissions
make script cd into base_dir
add logic for reading dev_env env var