Skip to content

Commit d3fdd6e

Browse files
authored
hestiacp#1904 v-add-sys-api-ip (hestiacp#1905)
* Add support for the command v-add-sys-api-ip 1.2.3.4 and v-delete-sys-api-ip 1.1.1.1 * Fix correction with chmod * Update change log
1 parent 0abfedd commit d3fdd6e

26 files changed

+202
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
66
### Features
77

88
- Include DMARC record in DNS record list #1836
9+
- Add command to add / delete from API_ALLOWED_IP list (#1904)
910

1011
### Bugfixes
1112

bin/v-add-mail-domain-smtp-relay

100644100755
File mode changed.

bin/v-add-sys-api-ip

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
# info: add ip adresss to allowed ip list api
3+
# options: IP
4+
# labels: hestia
5+
#
6+
# example: v-add-sys-api-ip 1.1.1.1
7+
8+
#----------------------------------------------------------#
9+
# Variable&Function #
10+
#----------------------------------------------------------#
11+
12+
ip46=${1// /}
13+
14+
# Includes
15+
16+
# shellcheck source=/usr/local/hestia/func/main.sh
17+
source $HESTIA/func/main.sh
18+
# shellcheck source=/usr/local/hestia/func/ip.sh
19+
source $HESTIA/func/ip.sh
20+
# shellcheck source=/usr/local/hestia/conf/hestia.conf
21+
source $HESTIA/conf/hestia.conf
22+
23+
#----------------------------------------------------------#
24+
# Verifications #
25+
#----------------------------------------------------------#
26+
27+
check_args '1' "$#" 'IP'
28+
is_format_valid 'ip46'
29+
30+
# Perform verification if read-only mode is enabled
31+
check_hestia_demo_mode
32+
33+
34+
#----------------------------------------------------------#
35+
# Action #
36+
#----------------------------------------------------------#
37+
38+
if [ "$API_ALLOWED_IP" != "" ]; then
39+
$BIN/v-change-sys-config-value 'API_ALLOWED_IP' "$API_ALLOWED_IP,$ip46"
40+
else
41+
$BIN/v-change-sys-config-value 'API_ALLOWED_IP' "$ip46"
42+
fi
43+
44+
# Logging
45+
$BIN/v-log-action "system" "Warning" "System" "Added new IP address added to Allowed IP API (IP: $ip46)"
46+
log_event "$OK" "$ARGUMENTS"

bin/v-add-sys-smtp-relay

100644100755
File mode changed.

bin/v-add-user-wp-cli

100644100755
File mode changed.

bin/v-change-sys-ip-helo

100644100755
File mode changed.

bin/v-change-user-config-value

100644100755
File mode changed.

bin/v-change-user-sort-order

100644100755
File mode changed.

bin/v-change-user-theme

100644100755
File mode changed.

bin/v-delete-mail-domain-smtp-relay

100644100755
File mode changed.

0 commit comments

Comments
 (0)