K
K
kasti2018-06-27 16:38:31
Java
kasti, 2018-06-27 16:38:31

How to prevent server plugins from occupying ports?

Hello.
Is it possible with some launch arguments to prohibit a process from occupying more than one port?
For example, the server itself, starting up, occupies port 25565, and starting to run a plugin, some plugin tries to occupy port 80 and it does not work out. I understand that in fact the plugin is a separate application, but still, suddenly there is an option. Exactly by way of JAVA arguments (flags, or as they are called) of launch. We know how to implement this on linux itself, it’s just possible that this is thought out in java itself.
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2018-06-27
@kasti

When starting the JVM, pass the parameter -Djava.security.policy=server.policy, and write in the server.policy file

grant {
    permission java.net.SocketPermission "127.0.0.1:25565", "connect,accept,resolve";
};

The JVM will not allow programs to occupy ports other than those specified in the policy. True, it will prohibit a lot of things, and most likely you will have to figure out for a long time and painstakingly what other rights your server needs for normal operation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question