Category Linux

Linux: GRUB slow on 4k screens

In case you have a screen with high resolutions, a 4k screen for example, it is possible that GRUB is incredibly slow. If that is the case, the workaround is to edit the /etc/default/grub file, and add/replace the following line…

Mysql: optimize all tables in all databases

In order to optimize all databases & tables within your mysql instance, you can use the code below. You can also use a more specific script, where only the tables are optimized which have 10MB free space and 10% free…

FFmpeg: decrease size of mp4 file

With ffmpeg you can also decrease the size (aka: quality) of a mp4 file on linux command line.You can use the following example, which will generate a +/- 5Mb file :

Denyhosts: Add IP to whitelist

Create a file ‘allowed-hosts’ in the ‘work_dir’ (can be found in the denyhosts.conf file), which is /var/lib/denyhosts on Ubuntu, containing the ip.See the example below:

Fail2ban: unblock an ip

Find IP Address to Unblock Log in to your server via SSH and type in the following command: iptables -L -n Look for the IP address you want to unblock / unban. Now we must find the jail name this…

Fail2ban: whitelist an ip

First, edit the config file : vi Then, check the line : ignoreip = Add now add all ip you want. Each IP or range IP must be placed here with a space. Ex: 192.168.0.1 192.168.5.0/32 Save. And restart…

HAProxy: redirect http traffic to https

Within HAProxy it is possible to redirect all http traffic to https.It is sufficient to add the following rule within the frontend section: frontend incoming80 bind 10.1.1.13:80 redirect scheme https if !{ ssl_fc }

HAProxy: configure transparent proxy

If you configure HAProxy by default, the backends will receive the IP address of the HAProxy as incoming IP address. Some applications (or people) don’t want that. It is possible to configure haproxy as transparent proxy, so that the IP…

Linux: increase inodes on EXT4 file system

If you have a file system with a lot of small files, it it possible that you are running out of inodes.Unfortunately it is not possible to increase the number of inodes on the fly.In order achieve this, you will…

ModSecurity: Mod Security rules for wordpress/joomla/drupal

You can use the following mod_security rules for wordpress/joomla/drupal ## Rules for the CWP ## SecRuleRemoveById 910006SecRuleRemoveById 950000SecRuleRemoveById 950001SecRuleRemoveById 950005SecRuleRemoveById 950006SecRuleRemoveById 950117SecRuleRemoveById 950907SecRuleRemoveById 958039SecRuleRemoveById 958051SecRuleRemoveById 958291SecRuleRemoveById 959006SecRuleRemoveById 959151SecRuleRemoveById 960008SecRuleRemoveById 960010 SecRuleRemoveById 960011 SecRuleRemoveById 960012 SecRuleRemoveById 960035 SecRuleRemoveById 960335 SecRuleRemoveById 960904 SecRuleRemoveById 960915 SecRuleRemoveById 970003 SecRuleRemoveById 970015 SecRuleRemoveById 970903 SecRuleRemoveById 973301 SecRuleRemoveById…