Posts

Showing posts from May, 2020

LIMIT SSH ACCESS BY COUNTRY

Image
This is useful when being attack of constant login brute-force attempts mainly from countries like China and Russia. Install GeoLite2 Country Database      $ sudo apt-get install geoip-bin Make sure that geoiplookup is working before implementing the script below.      $ geoiplookup 8.8.8.8 Create bash script that will filter ssh access by country.      $ sudo nano /usr/local/bin/sshfilter.sh      #!/bin/bash     # UPPERCASE space-separated country codes to ACCEPT     ALLOW_COUNTRIES="PH"     if [ $# -ne 1 ]; then       echo "Usage:  `basename $0` <ip>" 1>&2       exit 0 # return true in case of config issue     fi     COUNTRY=`geoiplookup $1 | awk -F ": " '{ print $2 }' | awk -F "," '{ print $1 }' | head -n 1`     [[ $COUNTRY = "IP Address not found" || $ALLOW_COUNTRIES =~ $COUNTRY ]] && RESPONSE="ALLOW" || RESPONSE="DENY"     if [ $RESPONSE = "ALLOW" ]     then       e

CakePHP 3/4 File Manager for CKEditor with Roxy Fileman

Image
Create plugins directory in your webroot directory. Download  CKEditor 4 Extract CKEditor inside webroot/plugins directory. Download latest Roxy Fileman  Extract Roxy Fileman inside webroot/plugins  directory. Create uploaded directory inside webroot directory. This is the folder which can be browsed and where the new files will be uploaded. Edit Roxy Fileman conf.json to finish your setup. Below configuration is based the directories we created. Set configuration option INTEGRATION to "ckeditor".  See the  Roxy Fileman configuration options  for details In your view/template add an element that CKEditor should replace:      Load CKEditor. Set these options when initializing CKEditor. All must point to index.html in the Fileman's installation directory. If you encounter this issue E_LoadingAjax /plugins/fileman/php/dirtree.php Comment verifyAction content in your functions.inc.php