Am 07.11.18 um 01:26 schrieb Russell Wheeler:
> Hey, thanks for chipping in, some very useful info there.
>
> First, let me discuss the SSL/TLS stuff. If you have a few mins, and are
> better at Googling than me, I'd love to see something that doesn't
> involve https.
>
> At the very least, I see that you need to have a certificate backed by a
> trusted keystore, like verisign or letsencrypt.
That depends. If you control both ends of the exchange, you can tell
them to trust whatever root certificate you want. Essentially you build
a root certificate, add it to the Java truststore on both sides, and all
is fine.
There's a lot of detail involved, and you'll have to fiddle a lot to get
it right - and I can't provide all of them because I just work with a
similar infrastructures set up by others, I don't do the nitty-gritty
details.
I don't know about that domain name vs. ip address difference. I have
never used IP addresses.
OTOH if you code you probably can tell the SSL library what domain name
each side is going to fake.
OT3H IP address isn't as unique as you likely assume. Machines have
multiple IPs: One for ethernet, one for Wifi, and possibly one for the
unused chipset Wifi; if you have Virtualbox, at least(!) one for the
virtual network interface. Even when filtering out the obviously
uninteresting IP addresses, my at-work laptop had three publicly visible
IP addresses. Well, not public but external - behind a NAT firewall, the
IP address is lost anyway.
Unless you have full control over IP addresses, it's best to stick with
some other naming scheme. If you code both client and server, I'd expect
that you can choose whatever you want for both sides, possibly even the
user name.
The trusted root certificate is important if you want to run a website
that is considered trustworthy by all browsers, no more. And no less, of
course - being accepted by all browsers gives you a vast potential
audience, that's why everybody and their teapot wants one.
> I think verisign costs
> money and lets encrypt only let you use domain names not IP addresses,
> and domain names are more money :(
Domain names are cheap.
Single-digit cost per month, and if you go even cheaper, it might even
go below one dollar.
You're paying more money for the electricity.
> Then I'm not sure how I can even talk to my server app. If it's via http
> calls, and I do it in Java, I need apache/nginx to route the traffic
> then tomcat to again route the calls to the java lines of code.
You really need to learn a lot.
Apache is a web server. It routes incoming calls to directories, or to
plugins that know how to generate a webpage, most prominent those that
start a "web language" interpreter and run some Perl, PHP, Ruby, or
whatever code.
You need none of that. You can use Tomcat as a full replacement,
provided you're willing to let all URLs go through your code.
For development, use Jetty to test stuff (Jetty is unrelated to Tomcat,
but it does as much as is needed for development).
Also, give Spring Boot a try. It comes with Jetty embedded, and if it
finds it started outside of Tomcat it will automatically fire up Jetty.
Or some other web servicing framework if you reconfigure it, but you
don't want or need to do that at your current expertise, you'll be
pretty intense about getting your HTTP connections to run.
You can do Kryonet, but if you want encryption, stick with HTTPS; you'd
have to do a lot on your own, and you need to get experience with
networking basics before delving into the details of crypto.
> So I think I'm going to be an idiot/pigheaded call it what you will and
> plough on with my original idea! Not that I'm not grateful, but mainly
> because I'm kinda intrigued to go it my own way (because I feel very
> clever/arrogant for coming up with my own way and I want to see it
> through)
Don't. Or do it, but don't plan to ever use it in production.
Even experienced engineers usually fail miserably if they roll their own
crypto.
The basic problem here is that you never find out if you failed in your
testing phase. You don't even find out in production. You find out when
you are in production AND your user base is so large that you have
become an interesting target - and at that point, you're stuck with your
code, you'd need to rewrite everything (because adding security as an
afterthought is an exercize in whack-a-mole and will eat your developer
time like nothing, without you getting anywhere really useful).
> and also because I've got the kryonet talking back and forth
> part all done, all be it without the all important encryption part. To
> tear all that down and to try and read a load more tutorials on SSL/TLS
> etc, feels like a lot of work (and I'm nothing if not lazy!)
Then doing your own crypto is even less of an option.
If you're lazy, go by the Spring Boot route.
Use HTTPS as a transport.
KryoNet isn't for getting a secure connection, it's geared towards
small, specialized use cases where you control the network.
> My app is probably so small that no-one would even think of hacking it,
> so fingers crossed this is enough anyway. Hell, I could probably not
> encrypt any of it, but I feel passing/storing passwords etc in plaintext
> is wrong even on my little app.
Actually that's a relatively useful option: publish the public key in
the app and keep the private key in the server.
The network will be 100% compromised if somebody hacks the server (and
somebody will). You should warn your users that they should not use your
app if they are under threat from state-level agencies (secret services,
police, or the mafia) because, because these are going to break into the
server if they want to (they won't break the crypto but simply hack the
server, or possibly subpoena you, or make "an offer you can't deny").
> Thanks for all your help, and feel free to tear into my latest hair
> brained idea! I've got no-one else to keep me from doing stupid things!
:-)
Oh, it's "hare-brained" BTW, but "hair-brained" will work ;-P
Regards,
Jo