• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Plesk on Amazon EC2

found it
Code:
#!/bin/sh

LOG=/usr/local/psa/var/log/amazon
RECONFIG=/root/amazon_update_ip.conf
ADMIN_PWD=`cat /etc/psa/.psa.shadow`
ERRFILE=/tmp/amazon_update_ip.err

# check arguments
if [ -z "$2" ]; then
        OLD_EXT_IP=""
        NEW_EXT_IP=$1
else
        OLD_EXT_IP=$1
        NEW_EXT_IP=$2
fi
IPchk=`echo $NEW_EXT_IP | sed -e "s/[0-9]\{1,3\}\\\\.[0-9]\{1,3\}\\\\.[0-9]\{1,3\}\\\\.[0-9]\{1,3\}//g"`

# help
if [ -z "$1" -o "$1" = "--help" -o ! -z "$IPchk" ]; then
        echo $0 [old_external_ip] new_external_ip
        exit 1;
fi

date >> $LOG
echo $0 $* >> $LOG


# get old internal IP from DB
QUERY="SELECT ip_address FROM IP_Addresses;"
OLD_INT_IP=`echo $QUERY | mysql --user=admin --password=$ADMIN_PWD psa 2>$ERRFILE | tail -n 1`
if [ -s $ERRFILE ]; then
        echo "Error querying database for the old IP address"
        cat $ERRFILE
        rm $ERRFILE
        exit 2;
fi
rm -f $ERRFILE

# get new internal IP from network device
NEW_INT_IP=`/usr/local/psa/admin/sbin/ifmng -l | grep eth0 | cut -d\  -f 1`

# escape the dots to be usable in regex
OLD_INT_IP_RE=`echo $OLD_INT_IP | sed -e s/\\\\./\\\\\\\\./g`
NEW_INT_IP_RE=`echo $NEW_INT_IP | sed -e s/\\\\./\\\\\\\\./g`

# try to guess old external IP
if [ -z "$OLD_EXT_IP" ]; then
        OLD_EXT_IP=`grep ^\w*MasqueradeAddress /etc/proftpd.conf | cut -d\  -f 2`
fi

# check if old IP is set
IPchk=`echo $OLD_EXT_IP | sed -e "s/[0-9]\{1,3\}\\\\.[0-9]\{1,3\}\\\\.[0-9]\{1,3\}\\\\.[0-9]\{1,3\}//g"`
if [ -z "$OLD_EXT_IP" -o ! -z "$IPchk" ]; then
        echo Can\'t guess old IP or it is not defined properly as an argument
        $0 --help
        exit 1;
fi

echo Change IP: $OLD_INT_IP to $NEW_INT_IP and $OLD_EXT_IP to $NEW_EXT_IP
echo Change IP: $OLD_INT_IP to $NEW_INT_IP and $OLD_EXT_IP to $NEW_EXT_IP >> $LOG

# Make a backup
cp /etc/hosts /etc/hosts.tmp
ERR=$?

# If backup fails, there is a problem
if [ $ERR -ne 0 ]; then
        echo ERROR making a backup copy of /etc/hosts to /etc/hosts.tmp
        exit 2;
fi

sed -e s/$OLD_INT_IP_RE/$NEW_INT_IP_RE/g < /etc/hosts.tmp > /etc/hosts


# create reconfigurator config
rm -f $RECONFIG.{old,new}
/usr/local/psa/bin/reconfigurator $RECONFIG.old

# map OLD_INT_IP -> NEW_INT_IP
if [ "$OLD_INT_IP" != "$NEW_INT_IP" ]; then
        sed -e s/\>\ eth0\ $OLD_INT_IP_RE/\>\ eth0\ $NEW_INT_IP_RE/g < $RECONFIG.old > $RECONFIG.new;
else
        cp $RECONFIG.old $RECONFIG.new;
fi
# map OLD_EXT_IP -> NEW_EXT_IP
if [ "$OLD_EXT_IP" != "$NEW_EXT_IP" ]; then
        echo xxx $OLD_EXT_IP 255.255.255.0 -\> xxx $NEW_EXT_IP 255.255.255.0 >> $RECONFIG.new;
fi
# do the actual work
/usr/local/psa/bin/reconfigurator $RECONFIG.new
/usr/local/psa/bin/amazon_setup_ip $NEW_EXT_IP

rm -f $RECONFIG.{old,new} $ERRFILE
 
found it
Code:
#!/bin/sh

LOG=/usr/local/psa/var/log/amazon
RECONFIG=/root/amazon_update_ip.conf
ADMIN_PWD=`cat /etc/psa/.psa.shadow`
ERRFILE=/tmp/amazon_update_ip.err

# check arguments
if [ -z "$2" ]; then
        OLD_EXT_IP=""
        NEW_EXT_IP=$1
else
        OLD_EXT_IP=$1
        NEW_EXT_IP=$2
fi
IPchk=`echo $NEW_EXT_IP | sed -e "s/[0-9]\{1,3\}\\\\.[0-9]\{1,3\}\\\\.[0-9]\{1,3\}\\\\.[0-9]\{1,3\}//g"`

# help
if [ -z "$1" -o "$1" = "--help" -o ! -z "$IPchk" ]; then
        echo $0 [old_external_ip] new_external_ip
        exit 1;
fi

date >> $LOG
echo $0 $* >> $LOG


# get old internal IP from DB
QUERY="SELECT ip_address FROM IP_Addresses;"
OLD_INT_IP=`echo $QUERY | mysql --user=admin --password=$ADMIN_PWD psa 2>$ERRFILE | tail -n 1`
if [ -s $ERRFILE ]; then
        echo "Error querying database for the old IP address"
        cat $ERRFILE
        rm $ERRFILE
        exit 2;
fi
rm -f $ERRFILE

# get new internal IP from network device
NEW_INT_IP=`/usr/local/psa/admin/sbin/ifmng -l | grep eth0 | cut -d\  -f 1`

# escape the dots to be usable in regex
OLD_INT_IP_RE=`echo $OLD_INT_IP | sed -e s/\\\\./\\\\\\\\./g`
NEW_INT_IP_RE=`echo $NEW_INT_IP | sed -e s/\\\\./\\\\\\\\./g`

# try to guess old external IP
if [ -z "$OLD_EXT_IP" ]; then
        OLD_EXT_IP=`grep ^\w*MasqueradeAddress /etc/proftpd.conf | cut -d\  -f 2`
fi

# check if old IP is set
IPchk=`echo $OLD_EXT_IP | sed -e "s/[0-9]\{1,3\}\\\\.[0-9]\{1,3\}\\\\.[0-9]\{1,3\}\\\\.[0-9]\{1,3\}//g"`
if [ -z "$OLD_EXT_IP" -o ! -z "$IPchk" ]; then
        echo Can\'t guess old IP or it is not defined properly as an argument
        $0 --help
        exit 1;
fi

echo Change IP: $OLD_INT_IP to $NEW_INT_IP and $OLD_EXT_IP to $NEW_EXT_IP
echo Change IP: $OLD_INT_IP to $NEW_INT_IP and $OLD_EXT_IP to $NEW_EXT_IP >> $LOG

# Make a backup
cp /etc/hosts /etc/hosts.tmp
ERR=$?

# If backup fails, there is a problem
if [ $ERR -ne 0 ]; then
        echo ERROR making a backup copy of /etc/hosts to /etc/hosts.tmp
        exit 2;
fi

sed -e s/$OLD_INT_IP_RE/$NEW_INT_IP_RE/g < /etc/hosts.tmp > /etc/hosts


# create reconfigurator config
rm -f $RECONFIG.{old,new}
/usr/local/psa/bin/reconfigurator $RECONFIG.old

# map OLD_INT_IP -> NEW_INT_IP
if [ "$OLD_INT_IP" != "$NEW_INT_IP" ]; then
        sed -e s/\>\ eth0\ $OLD_INT_IP_RE/\>\ eth0\ $NEW_INT_IP_RE/g < $RECONFIG.old > $RECONFIG.new;
else
        cp $RECONFIG.old $RECONFIG.new;
fi
# map OLD_EXT_IP -> NEW_EXT_IP
if [ "$OLD_EXT_IP" != "$NEW_EXT_IP" ]; then
        echo xxx $OLD_EXT_IP 255.255.255.0 -\> xxx $NEW_EXT_IP 255.255.255.0 >> $RECONFIG.new;
fi
# do the actual work
/usr/local/psa/bin/reconfigurator $RECONFIG.new
/usr/local/psa/bin/amazon_setup_ip $NEW_EXT_IP

rm -f $RECONFIG.{old,new} $ERRFILE

Does that still work? I am testing the CloudLinux AWS offering and it has this problem.
I was able to fix it by using local VPC 10.0.0.x IP address, but the CL version works differently.
CL is telling me they wont support the AWS instance they offer, so I am wondering if anyone else has figured this out?
 
That is the problem that I'm interested.
Is there any update on my issue? It seems like the integration of Elastic IP with Plesk is causing this problem. I think a minor configuration change can make my favourite panel up and running on the cloud.
 
Back
Top