2013-10-30 2 views
1

누구나 Camel SSH 구성 요소로 keyPairProvider 옵션을 지정하는 방법을 제안 할 수 있습니까?Camel SSH keyPairProvider 옵션

Camel SSH 구성 요소 및 KeyPairProvider 옵션을 사용하여 원격 SSH 서버에 연결하려고합니다. 문서는이 옵션을 사용하는 방법, 구문 또는 우리가 제공해야하는 값 등에 대해서는 명확하지 않습니다. classname, 전체 클래스 경로, 키 파일 이름 등을 제공하려고 시도했습니다. 아무 것도 작동하지 않습니다. 나는 항상 아래의 오류가 발생합니다. 내가 keyPairProvider을주고 암호를 사용하도록 경로를 변경하지 않으면

Caused by: java.lang.IllegalArgumentException: Could not find a suitable setter for property: keyPairProvider as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: org.apache.sshd.common.KeyPairProvider with value file:com.example.tree.custom.CustomFileKeyPairProvider 
    at org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:555) 
    at org.apache.camel.util.IntrospectionSupport.setProperty(IntrospectionSupport.java:565) 
    at org.apache.camel.util.IntrospectionSupport.setProperties(IntrospectionSupport.java:453) 
    at org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:249) 
    at org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:264) 
    at org.apache.camel.component.ssh.SshComponent.createEndpoint(SshComponent.java:47) 
    at org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:120) 
    at org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:508) 
    ... 18 more 

은 잘 작동, 내 경로

from("direct:sshroute") 
.to("ssh://[email protected]?keyPairProvider=com.example.tree.custom.CustomFileKeyPairProvider") 

입니다.

또한 내 자신의 SSHComponent를 만들고 CustomFileKeyPairProvider를 설정하고 CamelContext (테스트 패키지에 주어진대로)에 추가한다고 언급하고 싶습니다. 그러나 기본 Camel Component를 사용하는지 알고 싶다면이 옵션을 어떻게 사용하면됩니까?

감사 - 나는 또한 낙타 SFTP 경로를 통해 파일을 제공 할 수 있어야하기 때문에 라비

+0

이것에 대한 정보를 찾을 수 있었습니까? – Carlos

+0

불행히도 없습니다. – Ravi

+0

암호를 입력하지 않고 SSH 공개 키를 사용하여 원격 SSH에 로그온하려고합니까? 내가 그 일을 적극적으로하고 있기 때문에 이중 확인하고 싶다. – Carlos

답변

0

나는이에 대한 답을 마련하기 위해 노력 해왔다. 다행히도, 나는 어떤 것을 발견했습니다.

기본적으로해야 할 일은 공개 키가 아닌 개인 키를 카멜 경로에 제시하는 것입니다. 여기서 가정은 원격 SSH/SFTP 서버와 공유 할 공개 키를 생성하고 공개 키를 원격 사이트로 전달한 것입니다. 사용자 또는 원격 관리자가 원격 사이트의 "authorized_keys"컨테이너에 파일을 저장했습니다 .

말했다되고, 당신과 같은 당신의 낙타 SFTP 경로를 구성 :

11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> Connecting to 10.0.0.110 port 22 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> Connection established 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> Remote version string: SSH-2.0-OpenSSH_6.4 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> Local version string: SSH-2.0-JSCH-0.1.44 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> SSH_MSG_KEXINIT sent 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> SSH_MSG_KEXINIT received 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> kex: server->client aes128-ctr hmac-md5 none 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> kex: client->server aes128-ctr hmac-md5 none 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> SSH_MSG_KEXDH_INIT sent 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> expecting SSH_MSG_KEXDH_REPLY 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> ssh_rsa_verify: signature true 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> Host '10.0.0.110' is known and mathces the RSA host key 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> SSH_MSG_NEWKEYS sent 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> SSH_MSG_NEWKEYS received 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> SSH_MSG_SERVICE_REQUEST sent 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> SSH_MSG_SERVICE_ACCEPT received 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> Authentications that can continue: publickey,keyboard-interactive,password 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> Next authentication method: publickey 
11/27 23:35:03 INFO [aCamelQueue]] SftpOperations     - JSCH -> Authentication succeeded (publickey) 

:

<to uri="sftp://[email protected]_server_address/directoryname?privateKeyFile=/full/path/to/your/private_key/id_dsa&amp;knownHostsFile=/full/path/to/your/known_hosts" /> 

를이 주소로, 나는에 로그인하지 않고 내 원격 대상에 내 파일을 보낼 수 있었다 my website에 대한 결과에서 좀 더 자세하게 설명 하겠지만, 이것은 주요 jist입니다. 행운을 빕니다! 당신이 키 쌍을 사용하여 SSH 연결을 찾는 경우

+1

안녕하세요 Mastashake57, 답장을 보내 주셔서 감사합니다. 키 쌍을 사용하여 SSH 연결을 찾고 있습니다. SFTPComponent의 경우 이미 위에서 언급 한 방법을 사용하고 있습니다. SSHComponent의 문제점은 낙타 설명서가 inbuilt Camel SSH Component에 keyPairProvider 옵션을 사용하는 방법에 대한 예제를 제공하지 않는다는 것입니다. – Ravi

0

, 당신은 당신이 Prefix path with classpath:, file:, or http:.이 있지만 난 단지 해봤 할 수있는 문서에서 말했다 것

from("direct:sshroute") .to("ssh://[email protected]?certResource=file:path/to/your/private_key)

처럼 certResource 옵션으로 그것을 할 수 있습니다 file: 전용.

희망 하시길 바랍니다 ~