[ 
https://issues.apache.org/jira/browse/KARAF-5072?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15950512#comment-15950512
 ] 

Lukasz Lech commented on KARAF-5072:
------------------------------------

If the key is present but invalid it will be overwritten by default => There is 
a problem with current implementation which works that way. If the process of 
writing the generated key fails (and according to my analize, it will fail each 
time for PEM format => KARAF-5073), then the result will be the server 
generating new key on each start - hopefully not insecure 'throwaway' key as in 
current implementation).

My suggestion:

1) If generating key is off -> must have a valid key to start SSH Shell
2) If generating is on and host.key is not present -> generate new one, but 
MUST validate afterwards by trying to parse the written file
3) If key is invalid -> fail to start with precise error message in log

> Add setting to ssh server for forcing a provided key
> ----------------------------------------------------
>
>                 Key: KARAF-5072
>                 URL: https://issues.apache.org/jira/browse/KARAF-5072
>             Project: Karaf
>          Issue Type: Improvement
>          Components: karaf-shell
>    Affects Versions: 4.1.1
>            Reporter: Christian Schneider
>            Assignee: Christian Schneider
>             Fix For: 4.1.2
>
>
> If karaf does not find a server key in etc/hosts.key it will create one and 
> save it. 
> If the key is present but invalid it will be overwritten by default.
> If overwrite=false in the settings and the provided key is invalid then karaf 
> will create a key on every first ssh connect after a restart. 
> I think it would be better to have a setting to force the provided key to be 
> used and throw an exception if it is invalid.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to