SAM: Add warning at startup if not bound to localhost

This commit is contained in:
zzz
2022-11-09 10:45:53 -05:00
parent d435e44e5f
commit 7b75ee5a0a

View File

@@ -216,6 +216,17 @@ public class SAMBridge implements Runnable, ClientApp {
* @since 0.9.6
*/
private void openSocket() throws IOException {
if (!DEFAULT_TCP_HOST.equals(_listenHost) &&
!"localhost".equals(_listenHost) &&
!"::1".equals(_listenHost) &&
!"0:0:0:0:0:0:0:1".equals(_listenHost) &&
!(_useSSL && Boolean.parseBoolean(i2cpProps.getProperty(SAMBridge.PROP_AUTH)))) {
String m = "SECURITY WARNING: SAM interface not restricted to localhost, and SSL and Authentication are not enabled.\n" +
"Remote access to local services may be possible.\n" +
"Please check command line and configuration.";
_log.logAlways(Log.WARN, m);
System.out.println(m);
}
if (_useSSL) {
SSLServerSocketFactory fact = SSLUtil.initializeFactory(i2cpProps);
InetAddress addr;