check ufw status first
This commit is contained in:
parent
a167d3e4ab
commit
89b3aaa5aa
10
ufw-docker
10
ufw-docker
@ -162,10 +162,14 @@ function err() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function die() {
|
function die() {
|
||||||
err "Fatal:" "$@"
|
err "ERROR:" "$@"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ! ufw status 2>/dev/null | grep -Fq "Status: active" ; then
|
||||||
|
die "UFW is disabled or you are not root user."
|
||||||
|
fi
|
||||||
|
|
||||||
case "$UFW_ACTION" in
|
case "$UFW_ACTION" in
|
||||||
delete)
|
delete)
|
||||||
shift || true
|
shift || true
|
||||||
@ -176,10 +180,6 @@ case "$UFW_ACTION" in
|
|||||||
list|allow)
|
list|allow)
|
||||||
shift || true
|
shift || true
|
||||||
|
|
||||||
if ! ufw status | grep -F "Status: active" &>/dev/null; then
|
|
||||||
die "UFW is not actived or your are not root user."
|
|
||||||
fi
|
|
||||||
|
|
||||||
INSTANCE_ID="${1:?Docker instance name/ID cannot be empty.}"
|
INSTANCE_ID="${1:?Docker instance name/ID cannot be empty.}"
|
||||||
INSTANCE_NAME="$(ufw-docker--instance-name "$INSTANCE_ID")"
|
INSTANCE_NAME="$(ufw-docker--instance-name "$INSTANCE_ID")"
|
||||||
shift || true
|
shift || true
|
||||||
|
Loading…
Reference in New Issue
Block a user