2017년 9월 7일 목요일

Ssh java send command example jcsh

예제 : http://www.jcraft.com/jsch/examples/Logger.java.html

JSch jsch=new JSch();
Session session=jsch.getSession(remoteHostUserName, RemoteHostName, 22);
session.setPassword(remoteHostpassword);
Properties config = new Properties();
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
session.connect();

ChannelExec channel=(ChannelExec) session.openChannel("exec");
BufferedReader in=new BufferedReader(new InputStreamReader(channel.getInputStream()));
channel.setCommand("pwd;");
channel.connect();

접속 하니 Algorithm negotiation fail 에러가 뜬다
에러 내용을 더 자세히 보기 위해
com.jcraft.jsch.Logger 를 임플리먼트 해서
Jcsh.setLogger 에 추가 해서 상세 내용을 본다

https://stackoverflow.com/questions/16468475/sending-commands-to-remote-server-through-ssh-by-java-with-jsch






결론은 jce.jar 강제 업데이트

By default, JCE policies -which come with your JDK or JRE- don't support such techniques for ciphering like (ase-256,.. etc).
For sure you MUST replace your current JCE jars (exist on $JAVA_HOME/jre/lib/security) with compatible Jave version you have from oracle website.
  • Download links:
스택 링크 https://stackoverflow.com/questions/17989883/the-cipher-aes256-cbc-is-required-but-it-is-not-available

ㅋㅋㅋ 아직 끝이 아님
UnknownHostKey 에러남https://stackoverflow.com/questions/2003419/com-jcraft-jsch-jschexception-unknownhostkey
java.util.Properties config = new java.util.Properties(); 
config.put("StrictHostKeyChecking", "no");
session.setConfig(config);
Aas

Jce 라이센스 내용 쿠바 이란 북한 이 아니어서 괜찮다

Background
From various Sun/Oracle license agreements:
The JCE architecture allows users to enforce restrictions regarding the cryptographic algorithms and maximum cryptographic strengths available to applets/applications in different jurisdiction contexts (locations).
Any such restrictions are specified in “jurisdiction policy files”.
Due to import control restrictions by the governments of a few countries, the jurisdiction policy files shipped specify that “strong” but limited cryptography may be used. An “unlimited strength” version of these files indicating no restrictions on cryptographic strengths is available for those living in eligible countries (which is most countries). But only the “strong” version can be imported into those countries whose governments mandate restrictions. The JCE framework will enforce the restrictions specified in the installed jurisdiction policy files.
Encryption software exports are also governed by the United States Department of Commerce’s Bureau of Industry and Security “Export Administration Regulations” (EARs). For example “15 CFR Supplement No. 1 to Part 740 – Country Groups” Country Group E:1currently lists Cuba, Iran, North Korea, Sudan and Syria as requiring special licenses for encryption software. More here.
The error messages you might get include this one:
ERROR [com.adobe.livecycle.encryption.client.EncryptionServiceException] ALC-ENC-100-019 ACRO_9 compatibility implies 256 bit AES encryption, which requires JCE unlimited strength jurisdiction policy files to be installed on the JVM
https://www.bis.doc.gov/index.php/documents/regulation-docs/452-supplement-no-1-to-part-740-country-groups/file
Korea South 는 A1 임 e1만 제한있음

E1 Country
Cuba Iran Korea, North Sudan  Syria


댓글 없음:

댓글 쓰기

3gb minning

비트코인 골드 -- 마이너 다운로드 :  https://www.bminercontent.com/releases/bminer-v6.0.0-d111154-amd64.zip -- vcruntime140.dll 다운로드  https://www.micr...