39 lines
887 B
Bash
Executable File
39 lines
887 B
Bash
Executable File
#!/bin/bash -e
|
|
### Copyright 1999-2023. Plesk International GmbH. All rights reserved.
|
|
|
|
# pm_Hook_ApiCli doesn't support short options, this wrapper emulates old behavior
|
|
|
|
OPTS=()
|
|
IS_VALUE_EXPECTED=
|
|
|
|
for opt in "$@"; do
|
|
if [ -n "$IS_VALUE_EXPECTED" ]; then
|
|
OPTS+=("$opt")
|
|
IS_VALUE_EXPECTED=
|
|
continue
|
|
fi
|
|
|
|
case "$opt" in
|
|
-a) OPTS+=(--apply) ;;
|
|
-c) OPTS+=(--confirm) ;;
|
|
-d) OPTS+=(--disable) ;;
|
|
-e) OPTS+=(--enable) ;;
|
|
-r) OPTS+=(--reset) ;;
|
|
-s) OPTS+=(--set-rule) ;;
|
|
-h) OPTS+=(--help) ;;
|
|
-n) OPTS+=(-name); IS_VALUE_EXPECTED="yes" ;;
|
|
-p) OPTS+=(-ports); IS_VALUE_EXPECTED="yes" ;;
|
|
*)
|
|
OPTS+=("$opt")
|
|
case "$opt" in
|
|
--remove-rules)
|
|
IS_VALUE_EXPECTED="yes" ;;
|
|
-id|-name|-direction|-action|-ports|-remote-addresses|-from|-to|-ids|-config)
|
|
IS_VALUE_EXPECTED="yes" ;;
|
|
esac
|
|
;;
|
|
esac
|
|
done
|
|
|
|
exec /usr/sbin/plesk ext firewall "${OPTS[@]}"
|