DEV Community

ZIA Networks
ZIA Networks

Posted on

Network Security Basics Every Developer Should Know

Most developers spend their time on code, but a weak network can undo all of that work. A leaked port, an unpatched router, or a shared Wi-Fi password can give someone a way in, no matter how clean your app is.

Here are the network security basics every developer should have covered. At ZIA Networks, these are the first things we look at when reviewing a setup.

1. Know what is exposed

You can't protect what you can't see. On a network or machine you own, check which ports are open:

nmap -sV your-server-ip
Enter fullscreen mode Exit fullscreen mode

Only scan systems you own or have written permission to test. If you see a port open and you don't know why, that's your first thing to investigate.

2. Close everything you don't need

Default deny is a good rule. Allow only the traffic you actually use. On a Linux server with ufw:

sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 22/tcp
sudo ufw allow 443/tcp
sudo ufw enable
Enter fullscreen mode Exit fullscreen mode

Check the result with:

sudo ufw status verbose
Enter fullscreen mode Exit fullscreen mode

3. Lock down SSH

SSH is one of the most attacked services on the internet. A few small changes help a lot. In /etc/ssh/sshd_config:

PermitRootLogin no
PasswordAuthentication no
Enter fullscreen mode Exit fullscreen mode

Use key-based login instead of passwords, then restart the service:

sudo systemctl restart ssh
Enter fullscreen mode Exit fullscreen mode

Make sure your key login works in a second terminal before you close your current session, so you don't lock yourself out.

4. Keep everything updated

Operating systems, routers, firewalls, and packages all need regular updates. Many real attacks use bugs that already have a fix.

sudo apt update && sudo apt upgrade -y
Enter fullscreen mode Exit fullscreen mode

5. Don't trust the network by default

Use HTTPS everywhere, even on internal tools. Keep dev, staging, and production separate, and don't reuse the same credentials across them.

6. Keep secrets out of your code

API keys and passwords don't belong in your repo. Use environment variables or a secrets manager, and rotate keys if one is ever exposed.

7. Log and monitor

If nobody is watching, an attack can run for days. Keep logs, set alerts for unusual logins, and review them regularly.

8. Test your backups

A backup you've never restored is only a hope. Do a test restore from time to time.

Quick checklist

  • [ ] Open ports reviewed
  • [ ] Firewall set to deny by default
  • [ ] SSH uses keys, root login off
  • [ ] Updates applied
  • [ ] Secrets out of the repo
  • [ ] Logs and alerts on
  • [ ] Backup restore tested

Wrapping up

None of this is complicated, but it does need to be done consistently. If you'd rather have an expert look over your setup, ZIA Networks helps businesses build and maintain secure, reliable networks with clear advice and dependable support.

What's one network security habit you wish you'd started sooner? Share it in the comments. 👇

Top comments (0)