Backup Webite to Amazon S3

Create file

Add

Make the file executable

Set it run everyday with cronjob

To backup MySQL database, use

https://serverok.in/mysqldump-backup

See Backup

ModSecurity

ModSecurity is a Web Application Firewall. Protect sites from SQL injection and Application level hacking.

To install ModSecurity on Ubuntu/Debian with Apache, run

verify Apache module is installed with

Enable config file

Update config

Restart Apache

Docker detach container

Docker container stop once the main program it started with stop running. If you start a docker container with console using -ti option, it stop when you disconnect.

To avoid process getting stopped, you can detach from the console.

This is done by pressing keys

Followed by

You can just press CTRL key, then press “p”, then “q”.

exiqgrep

exiqgrep allows you to search exim mail queue.

To search for a particular recipients, run

To search for all emails from a particular email account, use

You can use -i option to list only message id. This is useful when you need to delete mails from a particular account.

To delete all email sent from a particular email account, run

exim

FreeBSD ports Sucks

During 2004, i used to use FreeBSD 4 and 5 servers. During this time Cpanel Control panel supported FreeBSD. After cpanel stopped supporting FreeBSD, all the servers slowly got converted to Linux.

I was FreeBSD free for several years. Today i decided to try FreeBSD again.

I tried to install node.js from ports to see how ports work.

It started with a dialogue box, where i select some of the options, that made me happy that i have freedom what to install. Then it started downloading software, compiling it. It is good to see where all the software coming.

After some time, it popup another dialogue box, it wanted me select some options. I done it.

It repeated 3 or 4 times. I lost my patience and pressed CTRL+C, that stopped the installation.

It is impossible to watch the screen during such long installs and select options as it pops up. If you are only doing it for one software and only update once in a while, then it is fine, if that is the case, why ports even there. I can’t imaging how many popups i will get if i am installing Apache + PHP and all its module from ports.

I remember long back i had web sites break after doing ports upgrade, php web sites just show source code, then i have to shutdown apache to prevent disclosure of database credentials stored in PHP files and reinstall PHP from ports to get it working.

I ended up installing node.js from pkg, that worked perfectly fine.

Installing Software with FreeBSD ports

FreeBSD ports allows installing software from source.

Updating Index

Before you can use ports, you need to fetch index. To do this, run

Find Software

To find software, use

Install a Software

To install a software, for example node.js, run

Installing Software in FreeBSD with pkg

pkg command is used to install software in FreeBSD.

To update package repo, run

Example

To install postfix mail server, run

To auto start postfix, you need to run

You can also add postfix_enable=”YES” to /etc/rc.conf manually.

Finding Software

To find package that provides a software, you can run

Example

Delete a software

Upgrade all installed software

exiwhat

exiwhat commands shows what exim mail server is doing.

exim