B4J Question How to react to spam?

LucaMs

Expert
Licensed User
Longtime User
If you have a B4J web server, anyone who knows the IP address can perform millions of connection attempts; this results in the creation of millions of instances of websocket handler classes (and websocket objects).

Using MQTT, creating an own broker, it may happen the same thing, maybe even having less control.


What to do?
 

KMatle

Expert
Licensed User
Longtime User
Hosting B4J on your own (at home): Bad idea

Hosting B4J on a hosted server: Ask your provider which possibilities they offer. They will have a strong infrastructure to protect your server (as far as it is technically possible).

Whenever possible:

- check the ip addresses (requests per time > x -> don't react anymore)
- use a login / password protection (wrong pw > x times -> don't react anymore for 1 hour or so)
- use API-Keys (like in Firebase messaging) and check it
- use encryption

Use another frontend:

- Though B4J is excellent and does a good job serving requests, but... There is a reason why the world is using Apache/Tomcat, etc. They have experienced the same situations and have solutions for that. B4J can work in the background and let the dirty work be done by Apache.

- My apps use Google FireBase messaging for push notofications (so Google has to deal with it). All other parts use php/MySQL via Apache hosted by my provider. An attacker has to get through Google, my provider, Apache, some php logic, encryption, passwords, ip address checks, etc.

One day I had a typo in a pw when testing. After 3 tries my provider blocked my ip address completely (I was wondering why my HttpUtils job did not get any respond from my server anymore). Took me some time but: Good job!

After all: A flooding is hard to protect from.
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
I'm pretty sure :D that I would not be able to use Apache for my purpose (though I have used wampp for other reasons).

Hosting B4J on your own (at home): Bad idea
It's not my idea.

Hosting B4J on a hosted server: Ask your provider which possibilities they offer. They will have a strong infrastructure to protect your server (as far as it is technically possible).
So I think I have to hope in the "ability" of my (future) hosting.

Thank you for your answer, Klaus.
 
Upvote 0
Top