Monday, December 17, 2012

MySQL hardening

•Install Antivirus and Antispam software

•Configure the operating system’s firewall
    -enable IP tables
•Consider the safety of your server's physical location
    Use geographically redundant places when deploying
•Install the services you intend the machine to run

•Harden the production server and services

•Disable unnecessary services
    Which reduce the connectivity points from outside

•Follow services vendors’ recommendations regarding patches and updates needed for the safe and secure operation of their servicesv

•Limit listen bind interface localhost. Use whenever possible
  bind-address=127.0.0.1

•To diable local data infile
   set-variable=local-infile=0
  
•Rename root user to different user
  mysql> RENAME USER root TO new_user;
  The MySQL "RENAME USER" command first appeared in MySQL version 5.0.2.
  mysql> use mysql;
  mysql> update user set user="new_user" where user="root";
  mysql> flush privileges;
 
•Unix run in chroot.

•Use dedicated OS account

•Use several partitions, separate logical and physical volumes for each
    MySQL dir - /installs
    data dir - /data
    logs dir - /logs

•Restrict port and IP access

•Delete bash history

•Using MYSQL_PWD will make vulnarable the passwords to outside

•Use complex password for root and all user 

•Make configuration readonly (/etc/my.cnf) and not accessible to others by store in restricted
 
•To change a user’s password, use the following command-line command:

  mysql> SET PASSWORD FOR 'username'@'%hostname' = PASSWORD('newpass');
  It is also possible to change the password using the "mysqladmin" utility:

  shell> mysqladmin -u username -p password newpass
•Remove "test" database
  mysql> drop database test;

•Use dns names instead server IP when connecting

•Avoid empty passwords, no wild cards on host, Avoid anonymous accounts

•Create single user for each account

•Use complex password

•No grant access to nono-admin users, FILE and PROCESS privilege

•Restrict SHUTDOWN, CREATE USER, RELOAD, GLOBAL GRANT,