OSCP Review - Proctored Version About Me: I am motivated IT professional with 14 years of experience in the IT industry. During the initial days of my career I worked as a programmer. After some time I got interested into Systems Administration and started working as a systems engineer. Later in my career I took
replication Setting up PostGresql Replication with Loadbalancing with PGPOOL II Installation (on both Master and Slave Nodes): yum install https://yum.postgresql.org/9.5/redhat/rhel-7-x86_64/pgdg-centos95-9.5-3.noarch.rpm yum install postgresql95 postgresql95-server postgresql-libs postgresql95-contrib rsync Initialize the database and configure postgresql /usr/pgsql-9.5/bin/postgresql95-setup initdb cd /var/lib/pgsql/9.5/data cp postgresql.
Rotate your video with ffmpeg You might run into an issue with the orientation on your videos at times and yeah it is super easy to rotate your video with a free and open source utility ffmpeg. Here is how : ffmpeg -i input.mp4 -vf "transpose=1" output.mp4 Where 0=90 Degrees
FFMPEG Cut Video file with ffmpeg FFMPEG is an open source and really powerful audio/video processor. You can do a lot of different things with ffmpeg. One of which is to cut video. Below are some examples to see how you can cut video with free ffmpeg. Basic Syntax: ffmpeg -i [input_file] -ss [start_
Postfix Configure postfix to use Sendgrid as default Relay If you would like to configure postfix to use Sendgrid as the mail relay, you can do so by editing the postfix main configuration file. vi /etc/postfix/main.cf And then paste the content below at the end of the file : smtp_sasl_auth_enable = yes smtp_sasl_password_
Wordpress Admin Security Yeah there are a lot of script kiddies out there scanning word press sites and brute forcing word press admin logins. There are ways you can limit access to the wordpress admin panel from restricted set IP Address or block unwanted browser agents. Here are some examples using .htaccess and
Bash Touch command tips and tricks Changing modification time using touch: touch -d '-4 day' filename touch -d '-4 hour' filename touch -d "30 days ago" filename Setting Timestamp : touch -t 201606101712 filename
Bash - Convert a comma separated list to any Array #!/bin/bash IFS="," sampleData="59,100,23,98,50" arr=($sampleData) for i in "${!arr[@]}";do echo Item $i:"${arr[$i]}" done unset IFS echo "Completed"
wake on lan Random Wake up of Windows Machine from Sleep mode It happens at times that the windows machine wakes up randomly from sleep mode. Here are some steps you may be able to follow to identify the cause and address the issue : Find out the cause of the wake : powercfg -lastwake You may see the Device that woke the computer
Installing newer or multiple version of python on Centos I stumbled across this situation where I needed to install python > 2.7 on Centos. Yum breaks if you upgrade the system python as yum relies on python 2.6 . So the only way to not touch the system python but still be able to use later version of
manage postfix queue Postfix Queue Management Retry delivery of mail in queue : postqueue -f Flush mail for a domain to primary mail server from Relay server: postqueue -s domain.com Delete all email in queue for a domain: postqueue -p | tail -n +2 | awk 'BEGIN { RS = "" } /@example.com/ { print $1 }' | tr -d
Linux Administration Build 32 bit application or libraries on 64 bit machine In order to configure script to build 32bit library on a 64 bit machine, you would have to pass the following arguments : ./configure --build=i686-pc-linux-gnu "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" Also, If you get an error that says : configure: error: C++ compiler cannot
nagios Nagios Bash script to monitor Domain Expiration This little script here, lets you use nagios to monitor domain name expiration and warn you ahead of time. You can also use it to just run some cron jobs, our extract the portion you need and use in other places : !/bin/bash #Author : Amit K Nepal domain=$1 if
Resize Partition with parted If you ever wanted to resize a partition to grow unfilled space, you can use parted to grow the partition size. parted /dev/sdx or parted /dev/mmcblk0 print Now note the size of the disk and the start of the partition that you want to resize. rm n=partition
Centos / Redhat 7 Switching back to iptables It may be frustrating to learn yet another firewall (firewalld) in Centos or RHEL 7 . Here is how you can switch back to the favorite IPTABLES. Stop firewalld and disable it to start at boot time : systemctl stop firewalld systemctl disable firewalld Now Initiate and enable Iptables (IP V4 ) and
selinux SELinux Tutorial Selinux is Security Enhanced Linux. I see that many administrators disable Selinux to ease administration, however it is a good idea to enable SELINUX. View Selinux Status: getenforce Disable SELinux : setenforce 0 Disable SeLinux Per Process: Apache: semange permissive -a httpd_t View Associated Ports SELinux semanage port -l Some
Apache New Apache : Authz_core:error Client Denied by Server Configuration The newer version of apache 2.4.6 that comes with Centos 7, seems to require some additional statement. If you are using htaccess , then you have to add the following keyword in order to fix the issue : Require all granted
Postfix Postfix - Sender address rejected: User unknown in virtual mailbox table Sometimes you may want to be able to send email from non existent email addresses on your own networks for notification purposes, you may get error “Sender address rejected: User unknown in virtual mailbox table”. In order to over come this issue, you have to disable this option : “smtpd_reject_
packet capture Filtering capture files with wire shark Filter by IP address, source and or destination IP Address ip.addr192.168.1.1 ip.src192.168.1.1 ip.dst192.168.1.1 (ip.src 192.168.1.1)||(ip.dst192.168.1.1) (ip.src192.168.1.1)&&(ip.dst==192.168.1.1) To
Postfix Postfix Spam Control Reject / Discard / Redirect emails based on header checks : vi /etc/postfix/main.cf header_checks = regexp:/etc/postfix/header_checks vi /etc/postfix/header_checks /^From: "Mechanic/ REJECT /^To: someone@example.com/ REDIRECT someone@example2.com /^To [someone@example2.com/%5ETo]: [bademail@example.com/ REJECT /^Subject](mailto:bademail@example.
Postfix Postfix Commands View Postfix Version : postconf -d | grep mail_version postconf -d mail_version
Samba Share Fedora 20 Install required packages : yum install samba samba-common samba-client cups-lib system-config-samba Make a shared Directory : In my case, I did mount an external hard drive at /mnt/usbDrive , which I wanted to be able to share to my Home Network. mkdir /mnt/usbDrive && cd /mnt/ Now, configure SELINUX so
Mounting NTFS Filesystem NTFS filesystem can be mounted on Linux systems by installing a kernel module that supports NTFS filesystem. A packate ntfs-3g can be used to installed such a module and ntfs utilities. yum install ntfs-3g If the repository cannot find the package, you might have to install epel repository. For Centos
ntp reflection attack NTP Reflection Attack In order to avoid NTP reflection attack , you need to disable the monlist command support or this can also be fixed by updating NTP to 4.2.7 vi /etc/ntp.conf restrict -4 default nomodify nopeer noquery notrap restrict -6 default nomodify nopeer noquery notrap # allow NTP messages from
vmware esxi VMware ESXI packet capture Packet capture for a port : tcpdump-uw -i vmk0 -s 1514 port 123 Increase the verbosity : tcpdump-uw -i vmk0 -s 1514 -vvv View traffic for a host : tcpdump-uw -i vmk0 -s 1514 host x.x.x.x Capture for specific port : tcpdump-uw -i vmk0 -s 1514 port not 21 and port