Security

Port Knocking

What is Port Knocking? Port knocking is a method by which you can dynamically open ports on your server to a single IP address. Port knocking allows you to transparently run a service on your server without exposing the services of that port to all IP addresses. In practice, it is very similar to having […]

Read More
Linux

MySQL Not Listening On A Public IP

By default, MySQL (on Debian) doesn’t listen on the public interface: #netstat -l tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 1768/mysqld In /etc/mysql/my.cnf, comment out the bind line: #bind-address = 127.0.0.1 And restart MySQL. Then it will listen on the public interface, and you should be able to connect. #netstat -l tcp 0 0 0.0.0.0:3306 0.0.0.0:* […]

Read More
Scripting

Mass setting user passwords

Every need to change (or set) passwords for a large number of users? Something like this code snippet may help. # find all the usernames with bash logins usernames=$(cat /etc/passwd | grep bash | sed ‘s/:.*//g) for i in $usernames; do echo “somepassword” | passwd –stdin $i done

Read More
Linux

nslookup-scan of IP-range/subnet

#!/bin/bash # nslookup-scan of IP-range # It’s possible to add more networks separated with space NETS=”192.168.0″ IPRange=”1 254″ for NET in $NETS; do for n in $(seq $IPRange); do ADDR=${NET}.${n} echo “${ADDR},`nslookup ${ADDR} | awk -F “=” ‘{ print $2 }’|sed ‘s/^[ t]*//’ | sed ‘/^$/d’ | |sed ‘s/.$//’`” done done Result 192.168.0.1,cba.infra.no 192.168.0.2,bca.infra.no 192.168.0.3,abc.infra.no […]

Read More