From 6343b3e20d88b1dec693db1288fff360b7ac0f4e Mon Sep 17 00:00:00 2001 From: myvesta Date: Sat, 24 Aug 2019 02:00:22 +0200 Subject: [PATCH] Introducing v-change-vesta-port --- bin/v-add-letsencrypt-user | 0 bin/v-change-vesta-port | 49 ++++++++++++++++++++++++++++++++++++++ bin/v-list-sys-config | 0 3 files changed, 49 insertions(+) mode change 100644 => 100755 bin/v-add-letsencrypt-user create mode 100755 bin/v-change-vesta-port mode change 100644 => 100755 bin/v-list-sys-config diff --git a/bin/v-add-letsencrypt-user b/bin/v-add-letsencrypt-user old mode 100644 new mode 100755 diff --git a/bin/v-change-vesta-port b/bin/v-change-vesta-port new file mode 100755 index 00000000..53beef2d --- /dev/null +++ b/bin/v-change-vesta-port @@ -0,0 +1,49 @@ +#!/bin/bash +# info: change vesta port +# options: port +# +# Function change vesta port + + +#----------------------------------------------------------# +# Variable&Function # +#----------------------------------------------------------# + +whoami=$(whoami) +if [ "$whoami" != "root" ] && [ "$whoami" != "admin" ] ; then + echo "You must be root or admin to execute this script"; + exit 1; +fi + + +# Argument definition +port=$1 + +re='^[0-9]+$' +if ! [[ $port =~ $re ]] ; then + echo "error: Not a number" >&2; exit 1 +fi + +if [ ! -f "$VESTA/conf/port.conf" ]; then + oldport=8083 +else + oldport=`cat $VESTA/conf/port.conf` +fi + +sed -i "s|$oldport;|$port;|g" /usr/local/vesta/nginx/conf/nginx.conf +sed -i "s|'$oldport'|'$port'|g" /etc/roundcube/plugins/password/config.inc.php +sed -i "s|'$oldport'|'$port'|g" /usr/local/vesta/data/firewall/rules.conf +$VESTA/bin/v-update-firewall +systemctl restart fail2ban.service +systemctl restart vesta + +echo "$port" > $VESTA/conf/port.conf + +#----------------------------------------------------------# +# Vesta # +#----------------------------------------------------------# + +# Logging +log_event "$OK" "$ARGUMENTS" + +exit 0; diff --git a/bin/v-list-sys-config b/bin/v-list-sys-config old mode 100644 new mode 100755