Hi all,
I need to get kerberos working through Java. ( SSH using the kerberos
ticket)
Currently it works with the terminal ( ssh host command) using the
gssapi-with-mic
But I'm having trouble getting it working with the JSCH library in Java.
Here's the code snippet I tried. ( pastebin: http://pastebin.com/sX8pUQSq)
Any suggestion is highly appreciated ..!!
JSch jsch = new JSch();
jsch.setLogger(new MyLogger());
System.setProperty("java.security.krb5.conf",
"/Users/swithana/git/KerberosConnector/src/main/resources/krb5.conf");
System.setProperty("java.security.auth.login.config",
"/Users/swithana/git/KerberosConnector/src/main/resources/mylogin.conf");
System.setProperty("javax.security.auth.useSubjectCredsOnly",
"true");
try {
jsch.addIdentity(privateKey,paraphrase);
jsch.setKnownHosts("/Users/swithana/.ssh/known_hosts");
Session session = jsch.getSession(user, host, 22);
Properties config = new java.util.Properties();
config.put("StrictHostKeyChecking", "no");
config.put("PreferredAuthentications",
"gssapi-with-mic,publickey,password,keyboard-interactive");
session.setConfig(config);
session.connect(20000);
Channel channel = session.openChannel("exec");
((ChannelExec) channel).setCommand( command);
channel.setInputStream(null);
((ChannelExec) channel).setErrStream(System.err);
--
Thanks,
Sachith Withana
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users