Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bind IntelliJ IDEA random open ports to localhost only?

When I run IntelliJ IDEA 2021.1.2 (Ultimate or Community edition) on macOS, I observe that 3 random ports are open on all network interfaces (eth0, lo, ...). One random port is open by the idea process and the two other ports are open by a different java process launched by IntelliJ IDEA.

I've removed the only plugin I've explicitly installed which is SonarLint.

The debugger which is running on port 63342 is bind to localhost and this can be configured in the Preferences menu.

Here is the relevant part of the output of lsof -i | grep LISTEN :

    idea   3328    orto  187u  IPv4 0x3c332685aa6872fd   0t0  TCP localhost:6942 (LISTEN)
    idea   3328    orto  686u  IPv4 0x3c332685aa623815   0t0  TCP localhost:63342 (LISTEN)
    idea   3328    orto  752u  IPv4 0x3c332685aa676de5   0t0  TCP *:53212 (LISTEN)
    java   3341    orto   33u  IPv6 0x3c332685aa5f899d   0t0  TCP *:61070 (LISTEN)
    java   3341    orto   77u  IPv6 0x3c332685b9885edd   0t0  TCP *:53210 (LISTEN)

As asked, here is the relevant part of ps -ef | grep 3341 (it's a RemoteMavenServer):

/Applications/IntelliJ IDEA.app/Contents/jdk/Contents/Home/jre/bin/java -d64 -Djava.awt.headless=true -Didea.version==2017.1.1 -Xmx768m -Didea.maven.embedder.version=3.3.9 -Dfile.encoding=UTF-8 -classpath /Applications/IntelliJ IDEA.app/Contents/lib/resources_en.jar:/Applications/IntelliJ IDEA.app/Contents/lib/log4j.jar:/Applications/IntelliJ IDEA.app/Contents/lib/snappy-in-java-0.5.1.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jna.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jna-platform.jar:/Applications/IntelliJ IDEA.app/Contents/lib/annotations.jar:/Applications/IntelliJ IDEA.app/Contents/lib/oromatcher.jar:/Applications/IntelliJ IDEA.app/Contents/lib/trove4j.jar:/Applications/IntelliJ IDEA.app/Contents/lib/util.jar:/Applications/IntelliJ IDEA.app/Contents/lib/jdom.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/lucene-core-2.4.1.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven-server-api.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3-server-common.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3-server-lib/archetype-catalog-2.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3-server-lib/archetype-common-2.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3-server-lib/maven-dependency-tree-1.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3-server-lib/nexus-indexer-3.0.4.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3-server-lib/nexus-indexer-artifact-1.0.1.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3-server-impl.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/aether-api-1.0.2.v20150114.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/aether-connector-basic-1.0.2.v20150114.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/aether-impl-1.0.2.v20150114.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/aether-spi-1.0.2.v20150114.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/aether-transport-wagon-1.0.2.v20150114.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/aether-util-1.0.2.v20150114.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/aopalliance-1.0.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/cdi-api-1.0.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/commons-cli-1.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/commons-io-2.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/commons-lang-2.6.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/commons-lang3-3.4.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/guava-18.0.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/guice-4.0-no_aop.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/javax.inject-1.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/jsoup-1.7.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/jsr250-api-1.0.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-aether-provider-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-artifact-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-builder-support-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-compat-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-core-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-embedder-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-model-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-model-builder-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-plugin-api-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-repository-metadata-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-settings-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/maven-settings-builder-3.3.9.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/org.eclipse.sisu.inject-0.3.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/org.eclipse.sisu.plexus-0.3.2.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/plexus-cipher-1.7.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/plexus-component-annotations-1.6.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/plexus-interpolation-1.21.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/plexus-sec-dispatcher-1.3.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/plexus-utils-3.0.22.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/slf4j-api-1.7.5.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/slf4j-simple-1.7.5.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/wagon-file-2.10.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/wagon-http-2.10-shaded.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/wagon-http-shared-2.10.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/lib/wagon-provider-api-2.10.jar:/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds-2.5.2.jar org.jetbrains.idea.maven.server.RemoteMavenServer

How to bind these three random open ports to localhost?

Notes

like image 584
Ortomala Lokni Avatar asked Apr 11 '17 20:04

Ortomala Lokni


1 Answers

IntelliJ IDEA doesn't bind any ports on the wildcard interface by default, except for the UDP concurrent licensing check (only for Ultimate). All the ports used for internal needs (Netty library initialization, exclusive folders lock, built-in web server, debugger, compiler/maven/gradle/running process IPC) are open on the localhost (127.0.0.1) interface:

ports

like image 59
CrazyCoder Avatar answered Oct 14 '22 03:10

CrazyCoder