© 2023 PodTECH IO
All rights reserved.

Get in Touch

Apache UNIX

Block IPs by country – Apache

Step 1 If you are using debian or ubuntu, install the mod-geoip package. sudo apt-get install libapache2-mod-geoip   Step 2 Enable GeoIPEnable, edit geoip.conf /etc/apache2/mods-enabled/geoip.conf GeoIPEnable On   Step 3 Find Country Code Lookup: https://en.wikipedia.org/wiki/ISO_3166-1 In Apache vhosts file, outside of the </Directory> tags: <Location /> ##ISO 3166 Country Codes ## Block China ## Block Costa […]

UNIX

Linux – if anyone logs in notify SSH

Put the following in /etc/profile: The script /etc/profile is executed at every login (for bash shell users).   if [ -n “$SSH_CLIENT” ]; then TEXT=”$(date): ssh login to ${USER}@$(hostname -f)” TEXT=”$TEXT from $(echo $SSH_CLIENT|awk ‘{print $1}’)” echo $TEXT|mail -s “ssh login” you@your.domain aFrom:youradd@email.com fi   If you have issues delivering mail to a GMAIL inbox, […]

UNIX

Fix Open Postfix Relay – Unauthenticated Email

If your mail server is left open, anyone can use your SMTP service to send mail, and spammers will use it. This can result in your server being blacklisted and extraneous use of system resources that neither benefit you nor your users. Postfix logoTo secure Postfix, there are a number of functions you can add […]

Programming UNIX

UNIX – Fork Explained

Mr. Peabody Explains fork() Introduction How Windows Does It How Unix Does It So Why Do People Want the Unix Way? How does it work in Perl? Introduction UNIX – Fork Explained Say, Mr Peabody. I was just reading through the Perl 5.6 release notes and noticed that a new function called fork() is now […]

UNIX

Ubuntu – Which Process is Using a port?

Ubuntu – Which Process is Using a port? 1- Find what application/process is using the pro, type: sudo netstat -lpn |grep :8080 and press Enter. You will get an output similar to this one tcp6       0      0 :::8080                 :::*                    LISTEN      6782/java 2- I have got the process Id, which is 6782, now this is the […]

Security UNIX

Heart Bleed – Exploit Example Code

Heart Bleed – Exploit Example Code If you need to test your server for the vulnerability, here is a simple Python script… [python] #!/usr/bin/python import sys import struct import socket import time import select import re from optparse import OptionParser options = OptionParser(usage=’%prog server [options]’, description=’Test for SSL heartbeat vulnerability (CVE-2014-0160)’) options.add_option(‘-p’, ‘–port’, type=’int’, default=443, […]