Skip to main content

Posts

Specific NodeJs version install with NVM

Node.js is an opensource cross-platform JavaScript run-time environment for server-side execution of JavaScript code. It’s built on Chrome’s JavaScript engine so it can be used to build different types of server-side application. npm is the very popular and default package manager for Node.js with large number of packages. In this tutorial, we will learn how to install Node.js and npm on Debian 9. Install Node.js and npm on Debian There are multiple ways to install Node.js and npm on your Debian 9 systems. You can follow any of following to install: Install Node.js from NodeSource Repository NodeSource provides a repository containing latest version of Node.js and npm. It’s very simple to install Node.js and npm from NodeSource. At first, you need to add NodeSource repository on your system using following  curl  command: curl -sL https://deb.nodesource.com/setup_10.x | sudo bash - NOTE :  The latest LTS version of Node.js is 10.x if you want to install ...

Install wkhtmltopdf from source

Install wkhtmltopdf on Debian 8, 9 Reference:  https://gist.github.com/fedir/48caf91c02197ecb68c22a70555f6f0e Raw   wkhtmltopdf@Debian8.sh apt-get update aptitude install xfonts-base xfonts-75dpi fontconfig xvfb mkdir ~ /src/wkhtmltopdf -p cd ~ /src/wkhtmltopdf wget https://bitbucket.org/wkhtmltopdf/wkhtmltopdf/downloads/wkhtmltox-0.13.0-alpha-7b36694_linux-jessie-amd64.deb dpkg -i wkhtmltox-0.13.0-alpha-7b36694_linux-jessie-amd64.deb echo ' xvfb-run --server-args="-screen 0, 1024x768x24" /usr/local/bin/wkhtmltopdf $* ' > /usr/bin/wkhtmltopdf.sh chmod a+rx /usr/bin/wkhtmltopdf.sh ln -s /usr/bin/wkhtmltopdf.sh /usr/local/sbin/wkhtmltopdf /usr/local/sbin/wkhtmltopdf https://www.google.fr output.pdf Raw   wkhtmltopdf@Debian9.sh apt-get update apt-get install wkhtmltopdf xvfb xauth xfonts-base xfonts-75dpi fontconfig echo ' xvfb-run --server-args="-screen 0, 1024x768x24" /usr/bin/wkhtmltopdf $* ' ...

Prevent SSH Brute Force Attack by Automatically Blacklisted

Automated Solution for Centos/RHEL to Block Bad Actors Here's a script for Centos to check ssh failed logins for both invalid user accounts and bad passwords for valid accounts. If the source IP has hit us more than 3 times and is not already on the deny list, it gets added to the deny list. I run this every 15 minutes from root's crontab. I've also disallowed root logins via ssh, so the combination keeps things fairly quiet. #/bin/bash # Save a copy of the existing hosts.deny file for safety cp /etc/hosts.deny /etc/hosts.deny.bak # Get a list of the offending IP addresses and process them for z in `grep "Invalid\|Failed" /var/log/secure | awk '{ print $NF }' | sort | uniq` do # Get the number of times this IP hit us hits=`grep "Invalid\|Failed" /var/log/secure* | grep $z | wc -l` # Check whether this IP is already blocked blocked=`grep $z /etc/hosts.deny | wc -l` # If they hit us mo...

Bandwidth Limiting Big Files Download - Mikrotik

Here is one of my queues with burst, setup using Winbox. All settings are on the General Tab. Settings are given as tx/rx (upload/download). Name - 2.201/32 Target Address - 192.168.2.201/32 Limit At - 65536/131072 Max Limit - 262144/524288 Burst Limit - 393216/786432 Burst Threshold - 262144/524288 Burst Time - 90/180 This is a Simple queue for the user at IP 192.168.2.201. He is given a basic speed of 64k upload and 128k download. According to the MT manual, this is a guaranteed minimum speed, provided enough bandwidth is available. His maximum sustained speed is 256k upload and 512k download. His speed is allowed to burst as high as 384k upload and 768k download. If his speed goes above the threshold (256/512) and stays there, the burst timer starts. After the allowed time, 90sec for upload and 180sec for download, his speed is throttled back from the burst limit (384/768) to the max limit (256/512) and held there until the traffic flow stops. When the flow stops, the timer...

WSO2Torial: Setting up WSO2 with a valid SSL certificate

WSO2  products can be downloaded from the WSO2 website, installed in a matter of seconds after which you can try out the software. No fees, no contracts and …. no lawyers. What you’ll find when you start up any WSO2 product is that the browser will balk on the certificate that is used to encrypt the connection. This is a so called self-signed certificate and is deemed to be less secure then one from a Certificate authority. How do Certificates work? Without going into too much detail, certificates work using a trust mechanism. Certificates are issued by a so called Certificate Authority like the companies Comodo or Symantec. A certificate issued by them should be trusted since the trust relationship with CA’s is beyond discussion.  The certificate issued guarantees that the site is indeed who it claims to be. Certificates in this sense are used to encrypt the secure https traffic to and from your WSO2 products. To set up HTTPS you will need a valid certificate t...

Give permission to a SSH user only to a specific directory and block terminal access !!

How do I restrict the user to only be able to do anything within that folder? (ie: that folder is the user's root and they cannot view/edit anything higher in the directory tree) Step-1 : adding a new group sudo addgroup sftptsl Step-2 : Create the chroot directory sudo mkdir /var/www/html/user-dir/ sudo chmod g+rx /var/www/html/user-dir/ Step-3 : Create the group-writable directory sudo mkdir -p /var/www/html/user-dir/working-dir1/ sudo chmod g+rwx /var/www/html/user-dir/working-dir1/ Step-4 : Give them both to the new group. sudo chgrp -R sftptsl /var/www/html/user-dir/ Step-5 : create an user and asign to this group  sudo adduser --ingroup sftptsl sftpuser ## group change You can also assign an existing user to the group usermod -g primarygroupname username usermod -G secondarygroupname username -g (primary group assigned to the users) -G (Other groups the user belongs to) ...