Skip to content

Latest commit

 

History

History
31 lines (17 loc) · 1.04 KB

README.textile

File metadata and controls

31 lines (17 loc) · 1.04 KB

Redcap

Redcap was written because I need to track SSH remote forwards by their process id, and all I have is the port they’re forwarding to. You can’t pair the two together unless you have root access, though – and that’s where Redcap comes in. You run Redcap as root, and then you can ask it to do the pairing for you.

Installation

gem install redcap

Usage

As a server, you’ll also want EventMachine installed:

gem install eventmachine

And then, the service must be run as root (so it can get all the requierd port and process information):

$ sudo redcap

And in code, as a client:

require 'rubygems'
require 'redcap'
Redcap.pid_for_port(10342) #=> 26151

Author

Pat Allan wrote this code in May 2011, but all the hard work for daemonising the process, logging, and a pid file was done in a gist by James Healy.

Licence

Released under the MIT Licence. Fork, contribute, re-use, whatever.