Few decades ago, i first installed linux.. and me being the dumbo i was, went online and on a few IRC channels. No firewall, didnt really know what that was back then and it was a bit of a guru/grey area anyways, and yeah i got hacked. I had a lot of unpatched raw services running too and that didnt help the cause.
Long story short, you learn from your mistakes, wipe the sweat from your brow, and rebuild better every subsequent time. Been like that for me with regards to open source servers and desktops and networks in general, and even my web apps.
These days i tend to prepare projects with mostly foresight, as opposed to referencing hindsight, but its there nonetheless.
Add a code snippet to your website: www.paste.org