Reverse SSH Tunnel

Blog tags: 

Recently went to setup a reverse SSH tunnel and had a few issues such as connections not being allowed, or otherwise. There is also a strong gotcha not documented clearly on the Internet, you can only have one connection per port on the intermediary host. If you want more than one host, you need to use multiple ports; sorry this is the way it is.

Before starting, make sure on BOTH hosts, install:

sudo apt-get install -y openssh-server

Quick and Dirty OpenYuma Build, Run and Test

Blog tags: 

Here is my guide for a quickstart instead of reading their documentation:

Install Prerequisites

# sudo apt-get update
# sudo apt-get install -y git autoconf gcc libtool libxml2-dev libssl-dev make libncurses5-dev libssh2-1-dev openssh-server build-essentials git

Reconfigure SSHD

Edit sshd_config and under the line Port 22, add the following two lines

# sudo vi /etc/ssh/sshd_config

# What ports, IPs and protocols we listen for
Port 22
Port 830
Subsystem netconf /usr/sbin/netconf-subsystem --ncxserver-sockname=830@/tmp/ncxserver.sock

Restart SSH with the following command

sudo service ssh restart

Download, build and install OpenYuma

GIT clone, make and install the following - netconfd will run with your current user

# git clone <a href=""></a> openYuma
# cd openYuma
# make
# sudo make install

# sudo cp /etc/yuma/netconfd-sample.conf /etc/yuma/netconfd.conf
# /usr/sbin/netconfd --superuser=`whoami`

Connecting with yangcli

Open a second terminal and run the command:

# yangcli

Something like the following should appear - note the YOURUSERNAME and YOURPASSWORD variables which need to be replaced with something more appropriate

yangcli> connect server=localhost user=YOURUSERNAME password=YOURPASSWORD
val->res is NO_ERR.

yangcli: Starting NETCONF session for rbrash on localhost

NETCONF session established for rbrash on localhost

Client Session Id: 2
Server Session Id: 1

Server Protocol Capabilities

Server Module Capabilities

Server Enterprise Capabilities

Protocol version set to: RFC 6241 (base:1.1)
Default target set to: <candidate>
Save operation mapped to: commit
Default with-defaults behavior: explicit
Additional with-defaults behavior: trim,report-all,report-all-tagged

Checking Server Modules...

Ubuntu SNMPD - Localhost MIB-IP and Statistics

Blog tags: 

As part of the processing of exploring some infrastructure for my thesis - I noticed that the SNMPD documentation needed some love despite the many eyes of the Internet. Here is how I set snmpd up in Ubuntu 15.10 for localhost access to IP-related information contained within the IP MIB.

Install the following:

sudo apt-get install snmp snmp-mibs-downloader snmpd libsnmp-dev

C UDP Client and Server example

Blog tags: 

I recently ran across some code for some students that was terribly written regarding sockets and upon helping them - I realized, that most examples just abhorrently throw all of the required code into the program with no function calls to help segment/make sense of it.

Here is my example programs - note that the actual socket code is wrapped up in socket.c & shared.h:

Quick and Simple Ubuntu DNSmasq & DHCP Router

Blog tags: 

While setting up a research network, I needed to setup a router/gateway machine between my network lab and the IT managed network; they require a static MAC and wall-port so they can mantain "security" on their network. To get around this (and is approved because of my lab's status) - I needed to setup a machine that would act as a router. Here is the short and simple method to getting Ubuntu and DNSmasq setup.

Modifying Linux ELF Binaries - Changing Callq Addresses

Blog tags: 

For awhile, I have wanted to write a simple tutorial of in-line patching of binaries and in particular, changing the assembly instructions and having a binary skip to whatever function we desire manually. This involves tweaking the callq instruction (call can be altered too, but it refers to a static address vs. a relative address).

Okay so lets get started - this tutorial is written to alter one specific thing and assumes that you have some basic knowledge of assembly & know how to compile basic programs. I am also assuming that you could find strings within binaries and know how to convert values in hexadecimal.

The example to be used in this test application contains a main function, and two functions (function1 and function2) which print different messages. The goal of this exercise is to modify the application AFTER it has been compiled so that function2() is executed instead of function1().

Ubuntu 14.01 Not Recognizing All-in-one SD Card reader

Blog tags: 

Interestingly enough, Ubuntu 14.01 was unable to recognize my all-in-one SD card reader (Nextech is the brand) despite working in Windows land. Dmesg output was stating errors and assuming that this is just a generic USB device, I wondered if there was something at play, such as SCSI. I was correct and here are the two changes that are needed to make it work.

sudo apt-get install udisks sg3-utils

Then add the following to /etc/modules.conf


Subscribe to RSS - Linux