Monthly Archives: June 2014

NAXSI: protecting websites with Nginx

NAXSI is Nginx Anti XSS & SQL injection. In simple words, it’s a firewall for web applications (WAF) for Nginx, protecting from XSS, SQL injections, CSRF, Local & Remote file inclusions. NAXSI is known for its fast working and simple configuring. It’s a good alternative for mod_security in Apache.

What would you need NAXSI for?

It’s obvious that’s the best way of protection from attacks is correctly written code, but in some situations WAF and particularly NAXSI can help:

  • low quality of site code with no resources or possibilities of rewriting it;
  • closed source code in which fixing mistakes is impossible;
  • the quality of code is unknown and unpredictable (i.e. shared hosting).

Read more at http://howtounix.info/howto/naxsi-nginx-firewall

Got it from my friend from hexcode.org

WordPress – backup and restore!

 

Export/Backup your MySQL database to a .sql
mysqldump -u [uname] -p db_name > ~/db_backup.sql
Copy the .sql file for other server

Copy the generated file, on your user’s home to the new server with scp.

scp ~/db_backup.sql [email protected]:/home/username
Create a new database to import it into

Login into the mysql

mysql -u root -p

Create the database

create database database_name;
Import/Recover your .sql files to mysql
mysql> use database_name;
mysql> source /full/path/your_file.sql;
Create and grant privileges for your NON ROOT user
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
Grant privileges for your NON ROOT user use it.
grant all privileges on database.* to username@localhost identified by 'password';
FLUSH PRIVILEGES;