Posts tagged as:

linux

Poor man's VPN connection

by Tony Mattke on April 20, 2010



Have you ever needed to access a site that had an IP restriction, or one inside your remote network? Recently I need to access a customers remote monitoring site, but its restricted to a small subnet of IPs. They had no VPN setup for me, so I had to come up with something new…

The answer was creating an ssh connection to their network firewall, which happened to be a custom Linux box I had access to. The setup is actually quite simple, and requires no changes to the remote host. The following command will create a local proxy for your machine to use on port 8080.

hackpro:~# ssh -q2nCTN -D 8080 user@hostname

[ read more... ]

{ 1 comment }

Netcat – secret weapon

by Tony Mattke on April 19, 2010



Netcat or nc, is a forgotten tool in too many arsenals these days. It lays dormant waiting at the command line to make connections across the globe for you. Knowing how to use it, could ease many of your day to day tasks. Simply put, netcat creates a TCP socket either in listening mode (server) or a socket that is used to connect to a server (client).

One of the simplest examples is to use it for a chat server / client. Lets assume were starting the server on a host with an ip address of 198.19.6.8 and were going to use port 8888. The following example allows us to setup a connection between the two hosts and type messages back and forth using stdin.

server:~$ nc -lp 8888
... in a subnet far far away
client:~$ nc 198.19.6.8 8888

[ read more... ]

{ 2 comments }



Got a Mac ? Got a Linux box that you use as a file server on your home network? Sick of problems with samba? So was I, until today when I decided to figure out how to setup Apple Filing Protocol (AFP) and Bonjour under Linux, debian in my case. In the following tutorial, we’re going to install and configure, Netatalk and Avahi. I’m also going to show you how to create a TimeMachine backup location on your file server, and get your Mac to recognize / use it.

[ read more... ]

{ 12 comments }

Securing SSH against bruteforce attacks

by Tony Mattke on June 7, 2009



This is one of the methods I’ve used in the past to secure a Linux host against brute force ssh attacks. While its not a perfect method, it does a good job of preventing 100s of brute force entries in your syslog.

[ read more... ]

{ 3 comments }

Regular Expression Basics

by Tony Mattke on June 4, 2009



Before I even get started, I want to mention that not all regular expression metacharacters are supported in every application. Keep this in mind when building your matches.

Regular expressions are made up of normal characters and metacharacters. Normal characters include upper and lower case letters and numerals. The metacharacters have special meanings and can match any number of things.

In the simplest case, a regular expression looks like a standard search string. For example, the regular expression “test” contains no metacharacters. It will match “test” and “test123″ but it will not match “Testing123″. Metacharacters help solve these simple dilemas, here is a table of such characters.

[ read more... ]

{ 0 comments }

SSH Wrapper Script

by Tony Mattke on November 30, 2008



Ok — this is my first script that I’m posting here. Its a VERY simple ssh wrapper script that you can place in your path, preferably in ~/bin

#!/bin/bash
SSH="/usr/bin/ssh"

case "$*" in
 *'@'*)     $SSH $* ;;
 *' -l'*)     $SSH $* ;;
 *)         $SSH -l root $* ;;
 esac

What this allows us to do is ssh as root to another box w/o specifying a user. Very handy if you spend your life in a terminal as I do. This could also be easily modifed for use with SCP or anything you wish…

{ 0 comments }