IBM Sterling B2B: Criando um SFTP Server Adapter: Difference between revisions

From Wiki
Line 81: Line 81:
[[File:sftp_adapter_config2.png]]
[[File:sftp_adapter_config2.png]]


== Testando ==
== Testando o SFTP Server Adapter==


1) Abrir um terminal
1) Abrir um terminal
Line 92: Line 92:


  '''sftp -P 5022 <nowiki><user_at_sterling>@<sfg_b2b_hostname></nowiki>'''
  '''sftp -P 5022 <nowiki><user_at_sterling>@<sfg_b2b_hostname></nowiki>'''
Aceite a nova chave:


  sftp -P 5022 <nowiki>[email protected]</nowiki>
  sftp -P 5022 <nowiki>[email protected]</nowiki>
Line 98: Line 100:
  RSA key fingerprint is MD5:4a:dd:62:72:db:65:ac:17:26:0f:34:1e:56:a0:e8:46.
  RSA key fingerprint is MD5:4a:dd:62:72:db:65:ac:17:26:0f:34:1e:56:a0:e8:46.
  Are you sure you want to continue connecting (yes/no)? '''yes'''
  Are you sure you want to continue connecting (yes/no)? '''yes'''
Informe a senha:


  Warning: Permanently added '[10.0.0.1]:5022' (RSA) to the list of known hosts.
  Warning: Permanently added '[10.0.0.1]:5022' (RSA) to the list of known hosts.
Line 104: Line 108:
  Connected to 10.0.0.1.
  Connected to 10.0.0.1.


Listando o diretório remoto:
sftp> pwd
Remote working directory: /
  sftp> ls
  sftp> ls
  sub1  sub2  sub3   
  sub1  sub2  sub3   
sftp> pwd
 
Remote working directory: /
Listando o diretório local:
 
  sftp>  
  sftp>  
  sftp> lcd /tmp  
  sftp> lcd /tmp  
Line 114: Line 122:
  sftp> lls
  sftp> lls
  example.txt
  example.txt
 
Enviando o arquivo:
 
  sftp> put example.txt
  sftp> put example.txt
  Uploading example.txt to /example.txt
  Uploading example.txt to /example.txt
  example.txt    100%  0 0.0KB/s 00:00
  example.txt    100%  0 0.0KB/s 00:00
Encerrando a conexão:
                                                                                                                                                                        
                                                                                                                                                                        
  sftp> quit
  sftp> quit

Revision as of 15:51, 14 October 2020

Abaixo descrevo como configurar um SFTP Server Adapter

Dica:

Ao criar um recurso no B2Bi tente definir uma nomenclatura que te auxilie a encontrar e exportar os dados. Como:

<Empresa>_<Projeto/Serviço>_<Tipo do Server Adapter>_serveradapter_<PORTA> 

Neste exemplo utilizo o seguinte

customer_projectx_sftp_serveradapter_5022


Procedimento

Configurar o SSH Host Key

1) No Dashboard do B2Bi, clique no menu Deployment > SSH Host Identity Key

2) Em Create, clique no botão Go!

3) Informe os dados e clique em Next

  • Host Name: customer_sfgb2b_production_hostkey
  • Key Type: ssh-rsa
  • Key Length: 2048
  • Key Comment: hostkey for production environment
  • Enabled: selecionar

Figura ilustrativa:

4) Confirme os dados e clique em Finish

Figura ilustrativa:

Configurar o Service Adapter

1) No Dashboard do B2Bi, clique no menu Deployment > Services > Configuration

2) Em Select Service type, informe abaixo e clique em Next

  • Service Type: SFTP Server Adapter 2.0

3) Em SFTP Server Adapter: Name, informe abaixo e clique em Next

  • Name: customer_projectx_sftp_serveradapter_5022
  • Description: SFTP Server for ProjectX
  • Environment: node1
  • Select a group: Create a Group e customer_sftp_sa_group

4) Em customer_projectx_sftp_serveradapter_5022: Configuration, informe abaixo e clique em Next

  • Perimeter Server: node1 & local
  • Enabled Protocols: SFTP and SCP
  • Host Identity Key: <INFORMAR_A_HOST_IDENTITY_KEY_CRIADO_ANTERIORMENTE>
  • SFTP Server Listen Port: 5022
  • Payload Repository: Mailbox

5) Em customer_projectx_sftp_serveradapter_5022: Configuration: Document Storage, informe abaixo e clique em Next

  • Document Storage: File System
  • Support for concurrent duplicate-named file transfers: Limited

6) Em customer_projectx_sftp_serveradapter_5022: Add Policies, clique em Next

7) Em projectx_sftp_server: Configuration, informe abaixo e clique em Next

  • Should the adapter be restricted to a certain group of users?: No
  • Should users start in the directory that matches their user name upon logon?: Yes

8) Em customer_projectx_sftp_serveradapter_5022: Extractability, clique em Next

9) Confirme os dados e clique em Finish

Figura Ilustrativa:

Testando o SFTP Server Adapter

1) Abrir um terminal

2) Criar um arquivo de exemplo

touch example.txt

3) Conectando ao nosso adapter e submetendo um arquivo

sftp -P 5022 <user_at_sterling>@<sfg_b2b_hostname>

Aceite a nova chave:

sftp -P 5022 [email protected]
The authenticity of host '[10.0.0.1]:5022 ([10.0.0.1]:5022)' can't be established.
RSA key fingerprint is SHA256:1u/hMWA4C/YF9o2CUUUhdAc1rzPL9/IxZYUnGhnon3c.
RSA key fingerprint is MD5:4a:dd:62:72:db:65:ac:17:26:0f:34:1e:56:a0:e8:46.
Are you sure you want to continue connecting (yes/no)? yes

Informe a senha:

Warning: Permanently added '[10.0.0.1]:5022' (RSA) to the list of known hosts.
SSH Server supporting SFTP only
[email protected]'s password: 
Connected to 10.0.0.1.

Listando o diretório remoto:

sftp> pwd
Remote working directory: /
sftp> ls
sub1  sub2  sub3  

Listando o diretório local:

sftp> 
sftp> lcd /tmp 

sftp> lls
example.txt

Enviando o arquivo:

sftp> put example.txt
Uploading example.txt to /example.txt
example.txt     100%  0 0.0KB/s 00:00

Encerrando a conexão:

sftp> quit

Ver também