• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Question Reset firewall rules with command line

Joss

New Pleskian
Hi,
I no longer have access to my server because my IP address has changed.
I can access to it in rescue mode...
How can I reset firewall rules with command line ?
Thanks,
 
Hi Igor, thanks for your reply, but it doesn't work...
My configuration :
Plesk: Plesk Obsidian v18.0.35_build1800210430.11 os_CentOS 8
System: CentOS Linux 8.3.2011
 
Ok, but I don't know how can I manage this in rescue mode with a OVH dedicated server...?
Do you have a way to make this for me ?
 
Nothing easier than that... ;)

Restart your server in rescue mode and mount the device on which your Plesk installation is located as described in the docs ...

Now navigate to the directory: /yourMountpoint/opt/psa/var/modules/firewall
Open the file: firewall-active.sh in a text editor.
Look there for the old IP address and replace it with the new IP address.
If you don't know the old IP anymore, look for the string: /sbin/iptables -A INPUT -p tcp --dport 22 and /sbin/iptables -A INPUT -p tcp --dport 8443 and replace the old IP with the new one.
If you can find your old IP in other places, replace it with the new IP here as well.
Please be careful not to change anything other than just changing the IP.

Now save the file and restart your server as normal.

Log into the Plesk panel and navigate to the selection "Firewall" ... replace the old IP with the new IP there and save your new setting.

Hth.
 
Ok, but I don't know how to navigate to /yourMountpoint/opt/psa/var/modules/firewall
When make this, there is "No such file or directory"
 
"yourMountpoint" is just a placeholder that you have to adapt to your circumstances
If you are not familiar with this or can follow the explanations, you should look for a professional service provider.

After this link, the correct spelling is if you have mounted the disk with Plesk on /mnt

cd /mnt/opt/psa/var/modules/firewall
 
I think I have correctly mounted the disk with /mnt, after this I do a chroot /mnt, and cd /mnt/opt/psa/var/modules/firewall, but there is always :"No such file or directory"
 
The command line is :
find /mnt/ -name firewall-active.sh
??
Can you explain me what this command do ?
 
This turns the server into a washing machine. ;)
Joking aside.

The command searches /mnt/... for the script firewall-active.sh which is apparently in a different place than here at Ubuntu18
 
Your command line do nothing...
Code:
root@rescue:~# mount /dev/md127 /mnt/
root@rescue:~# chroot /mnt
[root@rescue /]# find /mnt/ -name firewall-active.sh
[root@rescue /]#
 
I have found my error guys, yeeeessss !!

When I chroot my disk, there is some [...] who came, and I thinked that is the way to do the command lines, but nothing was good in this way.
So, I typed exit and after that, your find /mnt/ -name firewall-active.sh give me the right folder of the file.

I was able to modify the file with nano and save it, done !

Thank you very much for your help @LTUser !
 
Nothing easier than that... ;)

Restart your server in rescue mode and mount the device on which your Plesk installation is located as described in the docs ...

Now navigate to the directory: /yourMountpoint/opt/psa/var/modules/firewall
Open the file: firewall-active.sh in a text editor.
Look there for the old IP address and replace it with the new IP address.
If you don't know the old IP anymore, look for the string: /sbin/iptables -A INPUT -p tcp --dport 22 and /sbin/iptables -A INPUT -p tcp --dport 8443 and replace the old IP with the new one.
If you can find your old IP in other places, replace it with the new IP here as well.
Please be careful not to change anything other than just changing the IP.

Now save the file and restart your server as normal.

Log into the Plesk panel and navigate to the selection "Firewall" ... replace the old IP with the new IP there and save your new setting.

Hth.
The right directory for my case is :
Code:
/mnt/usr/local/psa/var/modules/firewall/firewall-active.sh
 
Back
Top