Jump to content

AutoSSH listen port?


dannymcc

Recommended Posts

Hi,

I've successfully configured an SSH relay server which my Pineapple is automatically logging in to.

I can connect from anywhere to my Pineapple over SSH:

~ : ssh root@relay.myrelayserver.com -p 2222


BusyBox v1.19.4 (2013-09-17 16:22:53 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __                          \
 |       |.-----.-----.-----.|  |  |  |.----.|  |_                      \  \
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|                   \  \  \
 |_______||   __|_____|__|__||________||__|  |____|   <,  .v ,  // ) ) )  )  )
          |__| W I R E L E S S   F R E E D O M         \\; \// //     /  /  /
 ATTITUDE ADJUSTMENT          (MK5 Ver. 1.0) ---------- ;\\|||//;       /  /
  * 1/4 oz Vodka      Pour all ingredients into mixing ,'<\/><\/`         /
  * 1/4 oz Gin        tin with ice, strain into glass.,.`X/\><\\>`
  * 1/4 oz Amaretto                                   ;>/>><\\><\/`
  * 1/4 oz Triple sec                                 |<\\>>X/<>/\|
  * 1/4 oz Peach schnapps                             `<\/><\/><\\;
  * 1/4 oz Sour mix                                    '/\<>/\<>/'
  * 1 splash Cranberry juice                             `<\/><;`
 -----------------------------------------------------WiFi_Pineapple MKV

At the moment my Pineapple's AutoSSH page is set as the following:

Host: pineapple@relay.myrelayserver.com
Port: 2222
Listen Port: 22

This works well and I can run command line tools remotely.

Is there any way of having access to the web GUI on port 1471? If I change the listed port to 1471, the SSH command returns 'connection refused'.

Any pointers would be appreciated!

Thanks,

Danny

Link to comment
Share on other sites

I'm glad to hear that you got this working. Is it automatically making the connection when the pineapple powers on? This is a problem for me, and I think I have read that its a problem for others.

As for local port forwarding, so that you can access the web gui. The command would look something like this when connecting to the remote server:

ssh -L 1471:localhost:1471 root@remoteserver -p "Listening port on the pineapple"

If you are using putty on windows. You have to configure the "tunnels" under the SSH section.

In your browser you would then go to "localhost:1471"

Edited by 514senica
Link to comment
Share on other sites

Thanks I've tried that command but when I visit http://172.16.42.1:1471 the page does not load.

Should I be trying to access the Pineapple on the 172.16.42.1:1471 address or a different one? Using your suggested SSH command the Pineapple login CLI displays correctly.

~ : ssh -L 1471:localhost:1471 root@relay.myrelayserver.com -p 2222


BusyBox v1.19.4 (2013-09-17 16:22:53 CEST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __                          \
 |       |.-----.-----.-----.|  |  |  |.----.|  |_                      \  \
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|                   \  \  \
 |_______||   __|_____|__|__||________||__|  |____|   <,  .v ,  // ) ) )  )  )
          |__| W I R E L E S S   F R E E D O M         \\; \// //     /  /  /
 ATTITUDE ADJUSTMENT          (MK5 Ver. 1.0) ---------- ;\\|||//;       /  /
  * 1/4 oz Vodka      Pour all ingredients into mixing ,'<\/><\/`         /
  * 1/4 oz Gin        tin with ice, strain into glass.,.`X/\><\\>`
  * 1/4 oz Amaretto                                   ;>/>><\\><\/`
  * 1/4 oz Triple sec                                 |<\\>>X/<>/\|
  * 1/4 oz Peach schnapps                             `<\/><\/><\\;
  * 1/4 oz Sour mix                                    '/\<>/\<>/'
  * 1 splash Cranberry juice                             `<\/><;`
 -----------------------------------------------------WiFi_Pineapple MKV

I've not yet tried to power down the Pineapple to see if the autossh comes back up - that's my next task!

Link to comment
Share on other sites

I'm glad to hear that you got this working. Is it automatically making the connection when the pineapple powers on? This is a problem for me, and I think I have read that its a problem for others.

As for local port forwarding, so that you can access the web gui. The command would look something like this when connecting to the remote server:

ssh -L 1471:localhost:1471 root@remoteserver -p "Listening port on the pineapple"

If you are using putty on windows. You have to configure the "tunnels" under the SSH section.

In your browser you would then go to "localhost:1471"

AutoSSH isn't working for me either, but as a temporary fix, I wrote this script:

#!/bin/bash
TEST=`ps -ea | grep "    ssh [-]fnNT"`
if [ "$TEST" = "" ]; then
   ssh -fnNT -R PORT:localhost:LISTENPORT USER@SERVER
fi

It's real dumb, but its been working flawlessly. It checks to see if a reverse shell is up (that's the grep line), if it is, it does nothing. If it's not up, it restarts it. I used the same names above as they did in the AutoSSH infusion (LISTENPORT is the port you'll forward, likely 22, and PORT is the port you'll use to connect to it on the remote server). Of course all the same stuff as AutoSSH applies (i.e. you have to have ssh keys set up, etc)

I call this via a Cron Job once a minute.

* * * * * /sd/static/keepUp.sh > /dev/null 2>&1

I've actually used this for a RPi I have deployed behind a firewall for months, and it hasn't let me down yet.

Edited by jdoe
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...