Monday, September 17, 2007

How to create a reverse ssh tunnel

Say you have a customer that has a firewall, but you need to ssh into their box and you can't mess with firewall (poking holes through it, etc.) If you can convince them to run a script you email to them or get to them someway, you can get a shell easily.

definitions:

local: (the customer's machine, which is behind the firewall)
remote: a box you have a shell on already

requirements:

both the local and remote computers must be running sshd (ports do not matter, but you will need root to listen on a port lower than 1024)

here is the line to execute on the local computer:

ssh -nNT -R 1100:local:22 remote

explanation:

you are ssh'ing from the local computer, past the firewall and into the computer you control. The 'n' option tells ssh to disregard stuff that comes in on stdin (we won't be sending local stdin over the wire, thus send it to /dev/null. The 'N' tells ssh to setup the tunnel but do not associate it with a command stream. 'T' means "do not give me a tty on the remote end". When the above command is run from a shell on the local computer, the shell will hang (after asking for login credentials) and no just a tunnel for other ssh sessions coming in from the other end. It will need to run during the entire session. Now from the remote computer you can simply ssh as such:

ssh localhost -p 1100 -l username

now you should have a shell on the local computer and have essentially defeated the firewall. For those of you reading this and wondering "Wow, someone can generate syn packets into my network, by tricking a user into executing some code, thus defeating my outer defenses.", you would be correct!

Sunday, June 3, 2007

I always forget this, how to place a process in the background after it is already running

So you started this process in your terminal and it is taking a really long time to complete. You want that terminal back but it seems too late to kill the process and rerun it with the '&' to detach it into the background. Well there is hope. You can complete the following to place the process in the background and get your terminal back.

1. From the terminal in question, the one where you do not have a prompt because the application is still running, hit Ctrl-z (this signals the process to pause, but not stop, it can be picked up again right where it left off)
2. Then type 'jobs', if you only have one job on that terminal (you most likely do), then this stopped job will be '1'.
3. Then type 'bg 1' or whatever the jobs output was. Blamo, you have restarted your process into the background.
update:
4. If you logout of the terminal (pty) which launched the process, you are essentially orphaning the process. This will cause the process to zombie (which means the process will never end/die because it is waiting on a signal from the parent that it received its result code) when the process finally does end. Also, if the process outputs to stdout/stderr, then there will be no pty parent associated with it, so Linux will cleanup this process.
5. Thanks to Charles Jones for pointing out that you can issue a 'disown %1' where 1 is the job number.

Reimplementation is back on!

Exciting news over the past week. I have been given the opportunity to lead the IT department at the company I work for. This is good news because it gives me a chance to take the department in the direction I want (which includes updating the suite of tools.) I am excited about this because because Jade Meskill is finally free to fully devote his time to his own company, Integrum.

Monday, May 28, 2007

Looks like the reimplementation is off

Looks like the company that employs me has decided not to upgrade the software they use. This is unfortunate. I will need to reevaluate how this book might get written. There will be no empirical data to include for the domain of the book.

Saturday, May 12, 2007

socialDrinkr

We just started on a new beer rating site. By we, I mean myself and 3 other people from work. Socialdrinkr is an experiment for those who love beer and would like to share their thoughts about the brews they love. We hope to make it useful for anyone. This is definitely a labor of love. All four of the developers have keen domain knowledge as well the knowledge to build the site. Alright time to get back hacking on socialdrinkr.

Friday, May 11, 2007

Writing a book!

I have been given a great opportunity to write a book. My employer is giving me the opportunity to implement enterprise-level software using Ruby on Rails. I am very fortunate to be a part of this plan. Rails is new and exciting, but needs to be proven. We need to prove concepts like REST (representational state transfer) can work running a multiple million dollar operation. We need to implement a distributed database. Most importantly, we need Rails to work with legacy systems and data. This book will be a practicum of sorts, chronically the entire process from bidding the system to the client through to the "maintenance phase".

Sunday, May 6, 2007

Going to Rails Conf!

Excited = 'Yes'. I would really like to hear David A. Black speak as well as Dave Thomas (no not the Wendys guy), the Ruby guy. Myself and 6 others from Integrum will be going on May 16th. This should be a good time and a chance to show Integrum's colors in Planet Argon's backyard.