Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12242001
delete-certbot-certificate.sh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
delete-certbot-certificate.sh
View Options
#!/bin/sh
# -------------------------------------------------------------
# Remove a Let's Encrypt
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Project: Nasqueron
# License: BSD-2-Clause
# Source file: roles/core/certificates/files/certbot/utilities/delete-certbot-certificate.sh
# -------------------------------------------------------------
#
# <auto-generated>
# This file is managed by our rOPS SaltStack repository.
#
# Changes to this file may cause incorrect behavior
# and will be lost if the state is redeployed.
# </auto-generated>
set
-e
# -------------------------------------------------------------
# Ensure user is root
#
# Note: POSIX shells don't always define $UID or $EUID.
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if
[
"
${
EUID
:-$(
id -u
)
}
"
-ne
0
]
;
then
echo
"This command must be run as root."
>
&
2
exit
1
fi
# -------------------------------------------------------------
# Parse arguments
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if
[
$#
-eq
0
]
;
then
echo
"Usage:
$(
basename
"
$0
"
)
<certificate>"
>
&
2
exit
1
fi
CERTIFICATE
=
$1
# -------------------------------------------------------------
# Determine etc directory path
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
. /etc/os-release
if
[
"
$ID
"
=
"freebsd"
]
;
then
ETC
=
/usr/local/etc
else
ETC
=
/etc
fi
# -------------------------------------------------------------
# Determine if the certificate exists
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
if
[
! -f
"
$ETC
/letsencrypt/live/
$CERTIFICATE
/chain.pem"
]
;
then
echo
"The certificate cannot be found."
>
&
2
exit
2
fi
# -------------------------------------------------------------
# Delete certificate and renewal information
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rm -rf
"
$ETC
/letsencrypt/live/
$CERTIFICATE
"
rm -rf
"
$ETC
/letsencrypt/archive/
$CERTIFICATE
"
rm
"
$ETC
/letsencrypt/renewal/
$CERTIFICATE
.conf"
File Metadata
Details
Attached
Mime Type
text/x-shellscript
Expires
Sun, Oct 12, 07:14 (19 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3064636
Default Alt Text
delete-certbot-certificate.sh (2 KB)
Attached To
Mode
rOPS Nasqueron Operations
Attached
Detach File
Event Timeline
Log In to Comment