You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by c031917 <pe...@knorr-bremse.com> on 2012/11/08 10:15:36 UTC

Remote Shell via AMQ possible ?

I need shell access to a remote, mobile broker/router with dynamic IP
adresses.

On the backend side there is a second broker/router, creating a network of
brokers.

XMPP + Jabber examples only talk to the broker itself, not the OS behind it.

Would it be possible to get a remote shell, using messaging as a transparent
layer ?

Peter



--
View this message in context: http://activemq.2283324.n4.nabble.com/Remote-Shell-via-AMQ-possible-tp4659008.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Remote Shell via AMQ possible ?

Posted by Geurt Schimmel <GS...@schubergphilis.com>.
Enable the Stomp listener in activemq.xml, fetch your message with a Stomp client (perl, python, ruby, php) and pass it subsequently to ssh.

Sent from my iPhone

On 9 nov. 2012, at 18:15, "c031917" <pe...@knorr-bremse.com> wrote:

> I don't understand how this could work in an interactive session. 
> 
> It is not a programmatic approach, it must be an interactive console
> 
> as if I'm connecting to a server directly with ssh, but it is transported
> over JMS.
> 
> 
> 
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Remote-Shell-via-AMQ-possible-tp4659008p4659133.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Remote Shell via AMQ possible ?

Posted by c031917 <pe...@knorr-bremse.com>.
I don't understand how this could work in an interactive session. 

It is not a programmatic approach, it must be an interactive console

as if I'm connecting to a server directly with ssh, but it is transported
over JMS.



--
View this message in context: http://activemq.2283324.n4.nabble.com/Remote-Shell-via-AMQ-possible-tp4659008p4659133.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Remote Shell via AMQ possible ?

Posted by Claus Ibsen <cl...@gmail.com>.
On Fri, Nov 9, 2012 at 9:24 AM, c031917 <pe...@knorr-bremse.com> wrote:
> Hi,
>
> yes, we use Camel / AMQ and honestly I missed the existence of the
> camel-exec component.
>
> Still impressive to find out the capabilities of Camel !
>
> Security won't be an issue hopefully, as the two brokers talk only via
> two-way certificate ssl link.
>
> Reading the doc it looks like only predefined commands can be executed.
>

See this FAQ
http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html

But the exec component allows you to define the command to execute as
a header to override the command in the uri configuration, using this
key for  the command: ExecBinding.EXEC_COMMAND_EXECUTABLE
And other header for the arguments.



> That will help a little, but may be too inflexible.
>
> I'm behind a full duplex terminal session, running over messages, similar to
> the Jabber example
>
> in the AMQ book.
>
> Or could I connect to something like:
> http://code.google.com/p/xmpp-ssh/downloads/list
> <http://code.google.com/p/xmpp-ssh/downloads/list>   ?
>
> Preferred client would be stuff like PuTTY. On the other side I don't have a
> clue what's necessary,
> but probably you don't get away with what's available on a standard Linux
> (debian in our case).
>
> Any ideas ?
>
>
>
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/Remote-Shell-via-AMQ-possible-tp4659008p4659096.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

RE: Remote Shell via AMQ possible ?

Posted by Geurt Schimmel <GS...@schubergphilis.com>.
Format of my message:
nagios update test.rrd -t Duration N:714 

 <route>
      <description>RRD processing</description>
      <from uri="activemq:queue:LOCAL.RRD.hosta"/>
      <recipientList>
        <simple>exec:///opt/tools/sysadmin/bin/rrdtool_wrapper.sh?args=${body}</simple>
      </recipientList>
    </route>

rrdtool_wrapper.sh:

>cat rrdtool_wrapper.sh
#!/bin/sh
args=$*
set $args
user=$1
shift
/bin/su - $user -c "/usr/bin/rrdtool.bin $*"

As a result, the Exec-component will eventually execute
/bin/su - nagios -c "/usr/bin/rrdtool.bin update test.rrd -t Duration N:714"

But as Raoul stated - be careful, as it's very easy to piggy-back commands. A shell-script is in fact not a good idea at all, but it gives you an idea.

Have fun,
Geurt

-----Original Message-----
From: c031917 [mailto:peter.marx@knorr-bremse.com] 
Sent: Friday, November 09, 2012 9:25 AM
To: users@activemq.apache.org
Subject: Re: Remote Shell via AMQ possible ?

Hi,

yes, we use Camel / AMQ and honestly I missed the existence of the camel-exec component.

Still impressive to find out the capabilities of Camel !

Security won't be an issue hopefully, as the two brokers talk only via two-way certificate ssl link.

Reading the doc it looks like only predefined commands can be executed. 

That will help a little, but may be too inflexible. 

I'm behind a full duplex terminal session, running over messages, similar to the Jabber example

in the AMQ book.

Or could I connect to something like:  
http://code.google.com/p/xmpp-ssh/downloads/list
<http://code.google.com/p/xmpp-ssh/downloads/list>   ?

Preferred client would be stuff like PuTTY. On the other side I don't have a clue what's necessary, but probably you don't get away with what's available on a standard Linux (debian in our case).

Any ideas ?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Remote-Shell-via-AMQ-possible-tp4659008p4659096.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Remote Shell via AMQ possible ?

Posted by c031917 <pe...@knorr-bremse.com>.
Hi,

yes, we use Camel / AMQ and honestly I missed the existence of the
camel-exec component.

Still impressive to find out the capabilities of Camel !

Security won't be an issue hopefully, as the two brokers talk only via
two-way certificate ssl link.

Reading the doc it looks like only predefined commands can be executed. 

That will help a little, but may be too inflexible. 

I'm behind a full duplex terminal session, running over messages, similar to
the Jabber example

in the AMQ book.

Or could I connect to something like:  
http://code.google.com/p/xmpp-ssh/downloads/list
<http://code.google.com/p/xmpp-ssh/downloads/list>   ?

Preferred client would be stuff like PuTTY. On the other side I don't have a
clue what's necessary,
but probably you don't get away with what's available on a standard Linux
(debian in our case).

Any ideas ?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Remote-Shell-via-AMQ-possible-tp4659008p4659096.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Remote Shell via AMQ possible ?

Posted by Raul Kripalani <ra...@evosent.com>.
Hi,

Not sure if you're familiar with Apache Camel [1], but you could create a
simple Camel route that does the following:

1) reads from a JMS queue (using the camel-jms or activemq-camel components)
2) executes the body of the JMS message as a shell command using the
camel-exec [2] component

Probably an interesting project, despite the obvious security concerns such
a mechanism raises ;)

[1] http://camel.apache.org
[2] http://camel.apache.org/exec.html

Regards,

*Raúl Kripalani*
Apache Camel Committer
Enterprise Architect, Program Manager, Open Source Integration specialist
http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani
http://blog.raulkr.net | twitter: @raulvk <http://twitter.com/raulvk>

On Thu, Nov 8, 2012 at 9:15 AM, c031917 <pe...@knorr-bremse.com> wrote:

> I need shell access to a remote, mobile broker/router with dynamic IP
> adresses.
>
> On the backend side there is a second broker/router, creating a network of
> brokers.
>
> XMPP + Jabber examples only talk to the broker itself, not the OS behind
> it.
>
> Would it be possible to get a remote shell, using messaging as a
> transparent
> layer ?
>
> Peter
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Remote-Shell-via-AMQ-possible-tp4659008.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>