I have an applet which is available on the Internet which talks to an internal server via an SSH tunnel. The correct SSH credentials have to be available to the applet. It isn't very convenient to compile them into the applet; providing them as applet parameters in the HTML leaks them to the Internet; and having the applet download them from the applet host server ditto but less obviously. My question is, is there another way I haven't thought of whereby only the applet can get hold of the SSH credentials? I can probably get the applet to use the same session ID as the browser, in which case I can at least restrict it to authenticated users ... But I'd really like a more secure solution with no leaks.
Server stack has Tomcat, JSF, and Facelets. Apache server and FTP are also available.
EDIT: I should clarify that the internal service I am tunneling to is itself pretty safe apart from DoS, it's more the security of the inner host that I'm concerned with, and also not becoming a public tunnel to anywhere. The SSH PermitOpen config element is a lot of help there.