I've got an EC2 instance running on an AWS VPC (free tier), on top of which I'm running a website.
I'm also using an RDS MySQL DB Instance for my database needs, and have set up security groups to allow the following:
EC2 Security Group - Inbound:
- Allows access to all HTTP traffic via port 80
- Allows access to SSH traffic from 2 IP adresses I usually sit in via port 22
- Allows access to all MySQL Traffic via port 3306
EC2 Security Group - Outbound:
- Allows access to all traffic from all ports
RDS Security Group - Inbound:
- Allows access to MySQL Traffic from my EC2 security group over port 3306
RDS Security Group - Outbound:
- Allows access to all traffic from all ports
Usually, when I sit outside of the 2 IPs I mentioned in the security groupt I create a new inbound rule in my default security group for the EC2 instance, which allows SSH access over port 22 from the IP in which I'm currently sitting.
Today, for some odd reason, I cannot connect over SSH to the EC2 Instance. I'm trying to from the public WiFi in the Cafe I'm sitting at. Tried various methods - PuTTY, Sublime SFTP, Filezilla. Nada.
I would love to know 2 things, really:
- What am I doing wrong? How to avoid this constant handling of security groups in AWS?
- What is the reason I'm not able to connect right now?
Important Note: The EC2 instance is up, and can be accessed over port 80 via HTTP - meaning I can go the URL of the site I set up, and everything is hunky-dory. Cleared cache - still loads perfectly.
Answer
You have the right idea in mind by limiting your ssh reachability - but you might be taking it too far.
You could have your SSH rule open to anywhere (0.0.0.0), but with some limitations to provide some security
Few good tips for securing your SSH:
- Change the default SSH port - This would throw off all those scanner bots who prowl the internet on port 22. This is by no means a security measure, but only a tool to reduce scanner abuse.
- Only allow public key authentication - This would kill any brute-force attempt in the first place
- Add 2-step verification - In cases you do want to be able to connect from a "guest" computer, where you don't have your private key, require an additional code for any password-enabled user.
This would be a good start that would eliminate basic threats to your SSH, while allowing proper usability.
Comments
Post a Comment