Showing posts with label sftp. Show all posts
Showing posts with label sftp. Show all posts

Thursday, December 6, 2012

OSB-SFTP with FtpAdapter

http://docs.oracle.com/cd/E23943_01/integration.1111/e10231/adptr_file.htm#CACDFFFB

http://myexperienceswithsoa.blogspot.ch/2011/04/using-sftp-with-oracle-soa.html

http://erikwramner.wordpress.com/2010/02/15/configuring-the-oracle-ftp-adapter-for-sftp-with-ssh-dsa/




On Linux, sftp server runs on
/usr/libexec/openssh/sftp-server

man sftp-server is http://www.manpagez.com/man/8/sftp-server/

By default it logs only errors, and it runs on port 22
On Linux you must be root to change the log level or the port number (sftp-config)
Logs are in
less /var/log/messages
less /var/log/secure
Here http://www.cerberusftp.com/download/downloadnow.html download an excellent SFTP server for Windows. You should create a user with rename, delete, create directories privileges.


this is a typical session:


2012/12/06 12:28:00     [1]     Incoming connection request on SSH interface 2 at 10.240.11.111
2012/12/06 12:28:00     [1]     SSH FTP connection request accepted from 10.56.5.165
2012/12/06 12:28:00     [1]     Client Identification: SSH-2.0-J2SSH_Maverick_1.2.6_Oracle Corporation
2012/12/06 12:28:00     [1]     Algorithm negotiation complete: Proceeding with key exchange
2012/12/06 12:28:00     [1]     Kex: 'diffie-hellman-group1-sha1' Host Key: 'ssh-rsa' C2S : 'aes128-cbc, hmac-md5, none' S2C : 'aes128-cbc, hmac-md5, none'
2012/12/06 12:28:01     [1]     DH Key sizes: Server Public '1023', Private '1023', Client Public '1023'
2012/12/06 12:28:01     [1]     Authenticating password for user 'soa'
2012/12/06 12:28:01     [1]     Native user 'soa' authenticated
2012/12/06 12:28:01     [1]     Channel Open: 'session', Sender Channel: 0, Init Window Size: 131070, Max Packet Size: 34000
2012/12/06 12:28:01     [1]     Creating local channel: 32
2012/12/06 12:28:01     [1]     Channel Request: 'subsystem', Recipient Channel: 32, Subsystem Name: 'sftp', Reply: true
2012/12/06 12:28:01     [1]     Client SFTP version: 4
2012/12/06 12:28:01     [1]     Real Path for '.'
2012/12/06 12:28:01     [1]     Stat: /home/soa/pippo/environments/env-0/ave/tmp
2012/12/06 12:28:01     [1]     Request to close channel '32'
2012/12/06 12:28:01     [1]     Channel '32' removed
2012/12/06 12:28:11     [1]     Disconnect reason: The user disconnected the application
2012/12/06 12:28:11     [1]     The client closed the connection
2012/12/06 12:28:11     [1]     Connection terminated
2012/12/06 12:28:31     [2]     Incoming connection request on SSH interface 2 at 10.240.21.111
2012/12/06 12:28:31     [2]     SSH FTP connection request accepted from 10.56.5.165
2012/12/06 12:28:31     [2]     Client Identification: SSH-2.0-J2SSH_Maverick_1.2.6_Oracle Corporation
2012/12/06 12:28:31     [2]     Algorithm negotiation complete: Proceeding with key exchange
2012/12/06 12:28:31     [2]     Kex: 'diffie-hellman-group1-sha1' Host Key: 'ssh-rsa' C2S : 'aes128-cbc, hmac-md5, none' S2C : 'aes128-cbc, hmac-md5, none'
2012/12/06 12:28:31     [2]     DH Key sizes: Server Public '1023', Private '1023', Client Public '1024'
2012/12/06 12:28:31     [2]     Authenticating password for user 'soa'
2012/12/06 12:28:31     [2]     Native user 'soa' authenticated
2012/12/06 12:28:31     [2]     Channel Open: 'session', Sender Channel: 0, Init Window Size: 131070, Max Packet Size: 34000
2012/12/06 12:28:31     [2]     Creating local channel: 48
2012/12/06 12:28:31     [2]     Channel Request: 'subsystem', Recipient Channel: 48, Subsystem Name: 'sftp', Reply: true
2012/12/06 12:28:31     [2]     Client SFTP version: 4
2012/12/06 12:28:31     [2]     Real Path for '.'
2012/12/06 12:28:31     [2]     Stat: /home/soa/pippo/environments/env-0/ave/tmp
2012/12/06 12:28:31     [2]     Request to close channel '48'
2012/12/06 12:28:31     [2]     Channel '48' removed



Friday, November 23, 2012

OSB SFTP Business Service

http://hhendriks.wordpress.com/2012/08/13/create-a-sftp-polling-service-in-the-osb/

http://docs.oracle.com/cd/E17904_01/doc.1111/e15866/transport_level.htm#i1058815
102 and 200 are two hosts.

I have created a PV_POC_SFTP project on 102 7001, to transfer files to 200

on 200:

mkdir /home/soa/sftpdestination

/sbin/ifconfig

10.56.25.135

on 102:

cat /home/soa/.ssh/known_hosts | grep hqchpippo200

hqchpippo200,10.56.25.135 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6KpqfXWf6XdJBQFjYgc2rmapk2yba55BZrdLqbJjIIEb15Huc7zrIxAQeXJh8eohD5qCUGztOhJzmURuPP1oofxI1iERzp0QWED7ZnO1EPqMLp+FdLxTC03he1gn2Ng1ugYPZkpGrkaG/pYEs8LlTFadQ6ICa4fIAxQYNxa8R0MEkzxsCewP66ahzPTGVWp03QpPtUPQV0sOIOb7mZKPaxQ3JhxN+IFDDIKoWuiaz1B08oV51JtdBnQRR0JPIzx1EwwUL9x2tEKNKzcCzhFn8jwsxvKP882c5R6rWHDn1adS6F+rg3jPjmyV1h4J/CnAFmYlNMVdeLo7zhfh95JURw==

hqchpippo200.acme.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6KpqfXWf6XdJBQFjYgc2rmapk2yba55BZrdLqbJjIIEb15Huc7zrIxAQeXJh8eohD5qCUGztOhJzmURuPP1oofxI1iERzp0QWED7ZnO1EPqMLp+FdLxTC03he1gn2Ng1ugYPZkpGrkaG/pYEs8LlTFadQ6ICa4fIAxQYNxa8R0MEkzxsCewP66ahzPTGVWp03QpPtUPQV0sOIOb7mZKPaxQ3JhxN+IFsdDDoWuiaz1B08oV51JtdBnQRR0JPIzx1EwwUL9x2tEKNKzcCzhFn8jwsxvKP882c5R6rWHDn1adS6F+rg3jPjmyV1h4J/CnAFmYlNMVdeLo7zhfh95JURw==

(official Oracle doc is WRONG!  it’s not $DOMAIN_HOME/osb/transports/sftp but $DOMAIN_HOME/config/osb/transports/sftp !!!!!)


mkdir –p /opt/oracle/domains/osbdv2do/config/osb/transports/sftp

cd /opt/oracle/domains/osbdv2do/config/osb/transports/sftp

vi known_hosts

paste the result of cat /home/soa/.ssh/known_hosts | grep hqchpippo200
(it's above)

create Service Account

PV_POC_SFTP_SA

static

soa

#thepassword


create the BS

anyxml

protocol sftp

endpoint uri

sftp://hqchpippo200:22/sftpdestination 


press ADD

User Authentication =Username Password

attach service account


test

if you get this:

The invocation resulted in an error: com.sshtools.j2ssh.transport.InvalidHostFileException: known_hosts file does not exist or it does not have read permissions..

check that you put the known_hosts in the right place /opt/oracle/domains/osbdv2do/config/osb/transports/sftp


if you get this:

The invocation resulted in an error: com.sshtools.j2ssh.transport.TransportProtocolException: Key Mismatch for host hqchpippo200,10.56.25.135.

make sure you got the right ssh-rsa kkeys from the /home/soa/.ssh/known_hosts file


upon successful invokation of the service, on 200 in /home/soa/sftpdestination you should see a file

How to specify a destination filename, and how to put some content into it, who knows.... we shall discover



Linux SFTP openSSH server


cat /etc/ssh/sshd_config
cat: /etc/ssh/sshd_config: Permission denied



which sftp
/usr/bin/sftp


ps -ef | grep sshd
root      4891  6172  0 02:10 ?        00:00:00 sshd: soa [priv]
soa       4893  4891  0 02:10 ?        00:00:00 sshd: soa@pts/0
root      6172     1  0 Jun26 ?        00:00:00 /usr/sbin/sshd
soa       7158  4894  0 02:13 pts/0    00:00:00 grep sshd


ls -ltr /usr/libexec/openssh/sftp-server
-rwxr-xr-x 1 root root 53312 Jan 4 2012 /usr/libexec/openssh/sftp-server
ps -ef | grep sftp
soa      29622 26654  0 02:41 pts/0    00:00:00 grep sftp


man sshd and man sshd_config