Google Cloud open a port in firewall

To open port 80 globally for all VMs on google cloud project, run

Postfix Delete Mails from a user

To delete emails from a particular user from postfix mail queue, run

See postfix

Configure Failover IP in Ubuntu 18.04 OVH VPS

Default /etc/network/interfaces in Ubuntu 18.04 in OVH VPS look like following

First install

Configure Main IP

use “ip a” command to find out interface name and IP of the VPS

In this case,

IP = 51.77.149.182
Interface Name = ens3

Use “route -n” command to find out gateway.

GATEWAY = 51.77.148.1

Edit /etc/network/interfaces

Add following

In the above, replace INTERFACE_NAME, SEVER_MAIN_IP and GATEWAY_IP.

For this server, i added.

Now reboot the server.

Once server is back online, you can configure failover IPS.

Configure Failover IP

Use following script to generate your config, add in end of /etc/network/inferfaces file

php script to generate ip config

Once configured, you need to reboot the servr.

Verify IP is up with fping command.

fping
/etc/inetnet/interfaces

Amazon Route 53 DKIM error

DKIM keys failed to validate on a mail server. The domain used Amazon ROute 53 DNS server.

amavisd-new showkeys command print out following public key for this domain.

When you cut and paste this in Amazon ROute 53, it get treadted as 4 seperate TXT records.

When i test with

It shows syntax error.

To fix this, make the DKIM key into 1 line and paste into Amazon Route 53.

Now the nslookup response look like

Once DNS record updated, testkeys command passed.

Disable PHP on a folder

A web site had vlunerability, all allowed hacker to upload backdoor script to “uploads” folder used by the script.

As a quick fix, i disabled PHP execution from “uploads” folder. Doing this for any site is a good dea when if your site is not vlunerable at the moment.

Method 1

To disable PHP execution, create a file with name .htaccess

Add

Method 2

In .htacess, add

See htaccess

WordPress Backup and Migration Plugins

Migrate Guru: Migrate & Clone WordPress Free

This plugin allow you to transfer your wordpress web site to another hosting for free. It support sites upto 200 GB in size. Use BlogVault to do the transfer.

https://wordpress.org/plugins/migrate-guru/

All-in-One WP Migration

This free plugin allow you to backup and restore your wordpress site. Free version support sites upto 500 MB. If your site is larger, you need to use paid version of this plugin.

https://wordpress.org/plugins/all-in-one-wp-migration/

Create Python Flask Docker Container

Create a folder and change to the folder

Create file

Add following content

Create file requirements.txt, add “Flask” to it.

Now lets create our Python Flask Application

Add following content

To test Flask application locally, install Flask using pip

Now run the application using

Now you will be able to see web application at

Press CTRL+C to stop the application.

To build Docker image, run

-t specify tag.

If all worked properly, you will see

You can see the container image listed

Now your docker image is ready. To build a container using this image, run

You can access your python application running inside docker container on URL

To stop the application, run

To start it, run