You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2007/08/10 07:54:01 UTC

DO NOT REPLY [Bug 43083] New: - [SUBMIT] sshsession task

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43083>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43083

           Summary: [SUBMIT] sshsession task
           Product: Ant
           Version: 1.7Alpha (nightly)
          Platform: All
        OS/Version: other
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Optional Tasks
        AssignedTo: dev@ant.apache.org
        ReportedBy: djohnson@desknetinc.com


Sshsession is a container task which establishes an SSH connection,
and optionally any number of local or remote tunnels over that connection, 
then executes any nested tasks before taking down the connection. 

My purpose in writing it is that we use cvs, and secure all access by only 
allowing cvs connections from localhost, which are tunneled over SSH
connections.  Establishing those connections is the only manual step in an  
otherwise automated build process.    

While I could use exec to issue the putty command (this is done on  
windoze) conditionally if a server is not already accessible at localhost  
port 2401, it gets more complicated with a passphrase on the keypair being  
used. 
  
Furthermore, there was no way to ensure that an existing connection is the 
connection we should be using, and no way to bring the connection down 
once we are done with it. 
 
So I wrote SSHSession, extending SSHBase.  The sshsession task establishes an
SSH connection with a remote machine running SSH daemon, optionally establishes
any number of local or remote tunnels over that connection, then executes any
nested tasks before taking down the connection.

SSHSession is adapted from SSHExec, though all the command execution 
related properties and logic were removed.  I added support for defining  
the tunnels via properties and/or nested elements.  I only needed local  
port forwarding, but added remote port forwarding for completeness.    

Using SSHSession with a local tunnel (2401:localhost:2401) and nested CVS  
commands does exactly what we need.  Other uses could involve anything  
needing to make a TCP connection to a server not otherwise accessible  
through a firewall, e.g. HTTP <get>, SMTP <mail>, JDBC <sql>...  

Because I've utilized the existing authentication and connection logic 
from SSHExec and SSHBase, the new task is as reliable in that regard as 
SSHExec. I've personally tested only the keypair with passphrase method of 
authentication, but I tested both local and remote port forwarding. 
I have no server setup to accomodate testing the other authentication  
options.

In the attached svn diff, please find SSHSession.java,   
sshsession.html, and mods to defaults.properties and optionaltasklist.html

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 43083] - [SUBMIT] sshsession task

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43083>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43083





------- Additional Comments From djohnson@desknetinc.com  2007-08-22 08:54 -------
Can someone who makes decisions such as when a newer version of jsch can be
required weigh in on requiring JSch 0.1.32 or later?  Unless it is decided that
it is fine to require JSch 0.1.32, I will assume that sshsession is to go in as
provided in the attached diff, with the discussed enhancement taking advantage
of dynamic local port assignment for local tunnels recorded as a TODO for future
enhancement.

I don't want to delay the acceptance of sshsession by building in a requirement
for upgrade of JSch.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 43083] - [SUBMIT] sshsession task

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43083>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43083


peterreilly@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mike.elmsly@ihug.co.nz




------- Additional Comments From peterreilly@apache.org  2007-08-19 10:47 -------
*** Bug 30582 has been marked as a duplicate of this bug. ***

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 43083] - [SUBMIT] sshsession task

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43083>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43083





------- Additional Comments From ymnk@jcraft.com  2007-08-16 19:49 -------
(In reply to comment #3)
> That way, each <localtunnel> could have EITHER an lport or an lportproperty, 
> and the propertyname could be different for each localtunnel.  Does that 
work?

I agree with you.  That must be better.

By the way, as I wrote in the previous comment, that functionality requires
the upgrade of the jsch version and it may not be acceptable in this timming.
If so, it should be postponed to be added and added to the TODO list.


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 43083] - [SUBMIT] sshsession task

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43083>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43083





------- Additional Comments From ymnk@jcraft.com  2007-08-16 01:00 -------
Since JSch 0.1.32, jsch will assign the local TCP port dynamically if "0" is
given as the local TCP port number for the local port-forwarding, 
and you can easily get the assigned TCP number by using jsch API.  

So, will it be nice that sshsession allows us to write following task setting,

  <sshsession host="somehost"
    username="dude"
    password="yo"
    localtunnels=":localhost:2401"
    localport="local.port"
    >
    <sequential>
      <cvs command="update ${cvs.parms} ${module}"
        cvsRoot="${cvs.root}"
        dest="${local.root}"
        port="${local.port}"
        failonerror="true"
      />
    </sequential>
  </sshsession>



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 43083] - [SUBMIT] sshsession task

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43083>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43083





------- Additional Comments From djohnson@desknetinc.com  2007-08-16 12:53 -------
I think some accommodation for jsch's dynamically assigning the local port in a
local tunnel makes sense.  I would do it via the <localtunnel> embedded element,
however, because the localtunnels parameter is actually a list, so an
accompanying localport parameter would be inadequate.  I would suggest something
more like:
  <sshsession host="somehost"
    username="dude"
    password="yo"
  >
    <localtunnel lportproperty="local.port" rhost="localhost" rport="2401"/>
    <sequential>
      <cvs  command="update ${cvs.parms} ${module}"
        cvsRoot="${cvs.root}"
        dest="${local.root}"
        port="${local.port}"
        failonerror="true"
    />
    </sequential>
  </sshsession>

That way, each <localtunnel> could have EITHER an lport or an lportproperty, and
the propertyname could be different for each localtunnel.  Does that work?

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


DO NOT REPLY [Bug 43083] - [SUBMIT] sshsession task

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=43083>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=43083





------- Additional Comments From djohnson@desknetinc.com  2007-08-09 22:55 -------
Created an attachment (id=20634)
 --> (http://issues.apache.org/bugzilla/attachment.cgi?id=20634&action=view)
SVN Diff providing sshsession task implementation and documentation


-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org