JSch Disable specific Ciphers without changing code
I work with a number of financial institutions, and one of them requested that we disable some of our ciphers used to connect to them. Specifically, they requested hmac-md5
and aes128-ctr
be removed, and they recommended we remove aes128-cbc
due to them being less secure.
Is there a way, either through command line switches, or maybe the Java security file, to easily remove these ciphers?
Looking at some of the examples, it looks like I would have to build the list of the ones I want without the above three (poor example copied from the AES example):
session.setConfig("cipher.s2c", "aes128-cbc,3des-cbc,blowfish-cbc");
session.setConfig("cipher.c2s", "aes128-cbc,3des-cbc,blowfish-cbc");
session.setConfig("CheckCiphers", "aes128-cbc");
Obviously, if they remove them on the server side, my client won't use them, but I could see this becoming more common. I don't really want to go through a code change at the moment.
Snippet from the debug log:
INFO: Remote version string: SSH-2.0-WS_FTP-SSH_8.5.0
INFO: Local version string: SSH-2.0-JSCH-0.1.54
INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: SSH_MSG_KEXINIT sent
INFO: SSH_MSG_KEXINIT received
INFO: kex: server: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group-exchange-sha256
INFO: kex: server: ssh-dss,ssh-rsa
INFO: kex: server: aes256-ctr,aes192-ctr,aes128-ctr,3des-cbc,blowfish-cbc,aes256-cbc,aes128-cbc
INFO: kex: server: aes256-ctr,aes192-ctr,aes128-ctr,3des-cbc,blowfish-cbc,aes256-cbc,aes128-cbc
INFO: kex: server: hmac-sha1,hmac-md5,hmac-sha2-256,hmac-sha2-384,hmac-sha2-512
INFO: kex: server: hmac-sha1,hmac-md5,hmac-sha2-256,hmac-sha2-384,hmac-sha2-512
INFO: kex: server: none
INFO: kex: server: none
INFO: kex: server:
INFO: kex: server:
INFO: kex: client: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: none
INFO: kex: client: none
INFO: kex: client:
INFO: kex: client:
INFO: kex: server->client aes128-ctr hmac-md5 none
INFO: kex: client->server aes128-ctr hmac-md5 none
java ssh java-8 jsch
add a comment |
I work with a number of financial institutions, and one of them requested that we disable some of our ciphers used to connect to them. Specifically, they requested hmac-md5
and aes128-ctr
be removed, and they recommended we remove aes128-cbc
due to them being less secure.
Is there a way, either through command line switches, or maybe the Java security file, to easily remove these ciphers?
Looking at some of the examples, it looks like I would have to build the list of the ones I want without the above three (poor example copied from the AES example):
session.setConfig("cipher.s2c", "aes128-cbc,3des-cbc,blowfish-cbc");
session.setConfig("cipher.c2s", "aes128-cbc,3des-cbc,blowfish-cbc");
session.setConfig("CheckCiphers", "aes128-cbc");
Obviously, if they remove them on the server side, my client won't use them, but I could see this becoming more common. I don't really want to go through a code change at the moment.
Snippet from the debug log:
INFO: Remote version string: SSH-2.0-WS_FTP-SSH_8.5.0
INFO: Local version string: SSH-2.0-JSCH-0.1.54
INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: SSH_MSG_KEXINIT sent
INFO: SSH_MSG_KEXINIT received
INFO: kex: server: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group-exchange-sha256
INFO: kex: server: ssh-dss,ssh-rsa
INFO: kex: server: aes256-ctr,aes192-ctr,aes128-ctr,3des-cbc,blowfish-cbc,aes256-cbc,aes128-cbc
INFO: kex: server: aes256-ctr,aes192-ctr,aes128-ctr,3des-cbc,blowfish-cbc,aes256-cbc,aes128-cbc
INFO: kex: server: hmac-sha1,hmac-md5,hmac-sha2-256,hmac-sha2-384,hmac-sha2-512
INFO: kex: server: hmac-sha1,hmac-md5,hmac-sha2-256,hmac-sha2-384,hmac-sha2-512
INFO: kex: server: none
INFO: kex: server: none
INFO: kex: server:
INFO: kex: server:
INFO: kex: client: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: none
INFO: kex: client: none
INFO: kex: client:
INFO: kex: client:
INFO: kex: server->client aes128-ctr hmac-md5 none
INFO: kex: client->server aes128-ctr hmac-md5 none
java ssh java-8 jsch
add a comment |
I work with a number of financial institutions, and one of them requested that we disable some of our ciphers used to connect to them. Specifically, they requested hmac-md5
and aes128-ctr
be removed, and they recommended we remove aes128-cbc
due to them being less secure.
Is there a way, either through command line switches, or maybe the Java security file, to easily remove these ciphers?
Looking at some of the examples, it looks like I would have to build the list of the ones I want without the above three (poor example copied from the AES example):
session.setConfig("cipher.s2c", "aes128-cbc,3des-cbc,blowfish-cbc");
session.setConfig("cipher.c2s", "aes128-cbc,3des-cbc,blowfish-cbc");
session.setConfig("CheckCiphers", "aes128-cbc");
Obviously, if they remove them on the server side, my client won't use them, but I could see this becoming more common. I don't really want to go through a code change at the moment.
Snippet from the debug log:
INFO: Remote version string: SSH-2.0-WS_FTP-SSH_8.5.0
INFO: Local version string: SSH-2.0-JSCH-0.1.54
INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: SSH_MSG_KEXINIT sent
INFO: SSH_MSG_KEXINIT received
INFO: kex: server: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group-exchange-sha256
INFO: kex: server: ssh-dss,ssh-rsa
INFO: kex: server: aes256-ctr,aes192-ctr,aes128-ctr,3des-cbc,blowfish-cbc,aes256-cbc,aes128-cbc
INFO: kex: server: aes256-ctr,aes192-ctr,aes128-ctr,3des-cbc,blowfish-cbc,aes256-cbc,aes128-cbc
INFO: kex: server: hmac-sha1,hmac-md5,hmac-sha2-256,hmac-sha2-384,hmac-sha2-512
INFO: kex: server: hmac-sha1,hmac-md5,hmac-sha2-256,hmac-sha2-384,hmac-sha2-512
INFO: kex: server: none
INFO: kex: server: none
INFO: kex: server:
INFO: kex: server:
INFO: kex: client: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: none
INFO: kex: client: none
INFO: kex: client:
INFO: kex: client:
INFO: kex: server->client aes128-ctr hmac-md5 none
INFO: kex: client->server aes128-ctr hmac-md5 none
java ssh java-8 jsch
I work with a number of financial institutions, and one of them requested that we disable some of our ciphers used to connect to them. Specifically, they requested hmac-md5
and aes128-ctr
be removed, and they recommended we remove aes128-cbc
due to them being less secure.
Is there a way, either through command line switches, or maybe the Java security file, to easily remove these ciphers?
Looking at some of the examples, it looks like I would have to build the list of the ones I want without the above three (poor example copied from the AES example):
session.setConfig("cipher.s2c", "aes128-cbc,3des-cbc,blowfish-cbc");
session.setConfig("cipher.c2s", "aes128-cbc,3des-cbc,blowfish-cbc");
session.setConfig("CheckCiphers", "aes128-cbc");
Obviously, if they remove them on the server side, my client won't use them, but I could see this becoming more common. I don't really want to go through a code change at the moment.
Snippet from the debug log:
INFO: Remote version string: SSH-2.0-WS_FTP-SSH_8.5.0
INFO: Local version string: SSH-2.0-JSCH-0.1.54
INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: SSH_MSG_KEXINIT sent
INFO: SSH_MSG_KEXINIT received
INFO: kex: server: diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group-exchange-sha256
INFO: kex: server: ssh-dss,ssh-rsa
INFO: kex: server: aes256-ctr,aes192-ctr,aes128-ctr,3des-cbc,blowfish-cbc,aes256-cbc,aes128-cbc
INFO: kex: server: aes256-ctr,aes192-ctr,aes128-ctr,3des-cbc,blowfish-cbc,aes256-cbc,aes128-cbc
INFO: kex: server: hmac-sha1,hmac-md5,hmac-sha2-256,hmac-sha2-384,hmac-sha2-512
INFO: kex: server: hmac-sha1,hmac-md5,hmac-sha2-256,hmac-sha2-384,hmac-sha2-512
INFO: kex: server: none
INFO: kex: server: none
INFO: kex: server:
INFO: kex: server:
INFO: kex: client: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1
INFO: kex: client: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
INFO: kex: client: aes128-ctr,aes128-cbc,3des-ctr,3des-cbc,blowfish-cbc,aes192-ctr,aes192-cbc,aes256-ctr,aes256-cbc
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: hmac-md5,hmac-sha1,hmac-sha2-256,hmac-sha1-96,hmac-md5-96
INFO: kex: client: none
INFO: kex: client: none
INFO: kex: client:
INFO: kex: client:
INFO: kex: server->client aes128-ctr hmac-md5 none
INFO: kex: client->server aes128-ctr hmac-md5 none
java ssh java-8 jsch
java ssh java-8 jsch
edited Nov 21 '18 at 7:28
Martin Prikryl
87.9k22171370
87.9k22171370
asked Nov 20 '18 at 18:06
MikeMike
2,84621624
2,84621624
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
JSch does not load the default configuration from anywhere, by default.
So there's no way to change the configuration, unless your code is explicitly ready for that.
There's an easy way to implement this though. You can use OpenSSHConfig
class that is able to parse a file with a syntax of common OpenSSH ssh_config
file.
OpenSSHConfig config = new OpenSSHConfig();
config.parse("/some/path/ssh_config-like-file");
JSch.setConfigRepository(config);
The ssh_config
-like file can then contain:
Ciphers aes128-cbc,3des-cbc,blowfish-cbc
Having that said, it really makes no sense for them to ask you to remove the ciphers. It's their job not to allow the ciphers on their server.
Agreed, which was essentially the response I gave them. I suspect it was supposed to be more of a heads up email that they were removing them from their server, and to check it, so the connection wouldn't just stop working one day...
– Mike
Nov 21 '18 at 17:45
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53398963%2fjsch-disable-specific-ciphers-without-changing-code%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
JSch does not load the default configuration from anywhere, by default.
So there's no way to change the configuration, unless your code is explicitly ready for that.
There's an easy way to implement this though. You can use OpenSSHConfig
class that is able to parse a file with a syntax of common OpenSSH ssh_config
file.
OpenSSHConfig config = new OpenSSHConfig();
config.parse("/some/path/ssh_config-like-file");
JSch.setConfigRepository(config);
The ssh_config
-like file can then contain:
Ciphers aes128-cbc,3des-cbc,blowfish-cbc
Having that said, it really makes no sense for them to ask you to remove the ciphers. It's their job not to allow the ciphers on their server.
Agreed, which was essentially the response I gave them. I suspect it was supposed to be more of a heads up email that they were removing them from their server, and to check it, so the connection wouldn't just stop working one day...
– Mike
Nov 21 '18 at 17:45
add a comment |
JSch does not load the default configuration from anywhere, by default.
So there's no way to change the configuration, unless your code is explicitly ready for that.
There's an easy way to implement this though. You can use OpenSSHConfig
class that is able to parse a file with a syntax of common OpenSSH ssh_config
file.
OpenSSHConfig config = new OpenSSHConfig();
config.parse("/some/path/ssh_config-like-file");
JSch.setConfigRepository(config);
The ssh_config
-like file can then contain:
Ciphers aes128-cbc,3des-cbc,blowfish-cbc
Having that said, it really makes no sense for them to ask you to remove the ciphers. It's their job not to allow the ciphers on their server.
Agreed, which was essentially the response I gave them. I suspect it was supposed to be more of a heads up email that they were removing them from their server, and to check it, so the connection wouldn't just stop working one day...
– Mike
Nov 21 '18 at 17:45
add a comment |
JSch does not load the default configuration from anywhere, by default.
So there's no way to change the configuration, unless your code is explicitly ready for that.
There's an easy way to implement this though. You can use OpenSSHConfig
class that is able to parse a file with a syntax of common OpenSSH ssh_config
file.
OpenSSHConfig config = new OpenSSHConfig();
config.parse("/some/path/ssh_config-like-file");
JSch.setConfigRepository(config);
The ssh_config
-like file can then contain:
Ciphers aes128-cbc,3des-cbc,blowfish-cbc
Having that said, it really makes no sense for them to ask you to remove the ciphers. It's their job not to allow the ciphers on their server.
JSch does not load the default configuration from anywhere, by default.
So there's no way to change the configuration, unless your code is explicitly ready for that.
There's an easy way to implement this though. You can use OpenSSHConfig
class that is able to parse a file with a syntax of common OpenSSH ssh_config
file.
OpenSSHConfig config = new OpenSSHConfig();
config.parse("/some/path/ssh_config-like-file");
JSch.setConfigRepository(config);
The ssh_config
-like file can then contain:
Ciphers aes128-cbc,3des-cbc,blowfish-cbc
Having that said, it really makes no sense for them to ask you to remove the ciphers. It's their job not to allow the ciphers on their server.
edited Nov 21 '18 at 10:12
answered Nov 21 '18 at 7:27
Martin PrikrylMartin Prikryl
87.9k22171370
87.9k22171370
Agreed, which was essentially the response I gave them. I suspect it was supposed to be more of a heads up email that they were removing them from their server, and to check it, so the connection wouldn't just stop working one day...
– Mike
Nov 21 '18 at 17:45
add a comment |
Agreed, which was essentially the response I gave them. I suspect it was supposed to be more of a heads up email that they were removing them from their server, and to check it, so the connection wouldn't just stop working one day...
– Mike
Nov 21 '18 at 17:45
Agreed, which was essentially the response I gave them. I suspect it was supposed to be more of a heads up email that they were removing them from their server, and to check it, so the connection wouldn't just stop working one day...
– Mike
Nov 21 '18 at 17:45
Agreed, which was essentially the response I gave them. I suspect it was supposed to be more of a heads up email that they were removing them from their server, and to check it, so the connection wouldn't just stop working one day...
– Mike
Nov 21 '18 at 17:45
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53398963%2fjsch-disable-specific-ciphers-without-changing-code%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown