AWS lightsail: SSH port 22 restricted by default on Lightsail blueprints
Summary
Updates the CLI tutorial for Lightsail-packaged blueprints, showing restricted default SSH access and how to explicitly open port 22 for a specific IP.
Security assessment
The diff replaces an SSH example exposed to 0.0.0.0/0 and ::/0 with restricted Lightsail connection aliases, and documents opening port 22 only for a specific IP. This addresses the weakness of publicly exposed SSH.
Evidence
+Blueprints packaged by Lightsail restrict port 22 on launch. By default, port 22 allows connections only from the browser-based SSH client in the Lightsail console and from Lightsail setup features, such as HTTPS setup for WordPress. To connect with your own SSH client, use the following command to allow SSH connections from your IP address, replacing the IP address with your own.
Diff
diff --git a/lightsail/latest/userguide/getstarted-awscli.md b/lightsail/latest/userguide/getstarted-awscli.md index 75fef4f..f3b1f57 100644 --- a//lightsail/latest/userguide/getstarted-awscli.md +++ b//lightsail/latest/userguide/getstarted-awscli.md @@ -105 +105 @@ The following command creates a new WordPress instance using the `nano_3_0` bund - --availability-zone ${AWS_REGION}a --blueprint-id wordpress \ + --availability-zone ${AWS_REGION}a --blueprint-id wordpress_ls_1_0 \ @@ -146 +146 @@ Once your instance is created, you can retrieve its details using the following - "blueprintId": "wordpress", + "blueprintId": "wordpress_ls_1_0", @@ -196 +196 @@ Once your instance is created, you can retrieve its details using the following - "accessFrom": "Anywhere (0.0.0.0/0 and ::/0)", + "accessFrom": "Custom", @@ -200,7 +200,8 @@ Once your instance is created, you can retrieve its details using the following - "cidrs": [ - "0.0.0.0/0" - ], - "ipv6Cidrs": [ - "::/0" - ], - "cidrListAliases": [] + "cidrs": [], + "ipv6Cidrs": [], + "cidrListAliases": [ + "lightsail-connect", + "lightsail-connect-ipv6", + "lightsail-setup-ipv4", + "lightsail-setup-ipv6" + ] @@ -230 +231 @@ Once your instance is created, you can retrieve its details using the following - "username": "bitnami", + "username": "admin", @@ -247,0 +249,8 @@ After creating your instance, you can connect to it using SSH with the key pair +###### Example– Open port 22 for your IP address + +Blueprints packaged by Lightsail restrict port 22 on launch. By default, port 22 allows connections only from the browser-based SSH client in the Lightsail console and from Lightsail setup features, such as HTTPS setup for WordPress. To connect with your own SSH client, use the following command to allow SSH connections from your IP address, replacing the IP address with your own. + + + $ aws lightsail open-instance-public-ports --instance-name cli-tutorial \ + --port-info fromPort=22,protocol=TCP,toPort=22,cidrs=198.51.100.1/32 + @@ -253 +262 @@ Use the following command to connect to your instance via SSH, replacing the IP - $ ssh -i ~/.ssh/cli-tutorial-keys.pem [email protected] + $ ssh -i ~/.ssh/cli-tutorial-keys.pem [email protected] @@ -262,11 +271 @@ Use the following command to connect to your instance via SSH, replacing the IP - ___ _ _ _ - | _ |_) |_ _ _ __ _ _ __ (_) - | _ \ | _| ' \/ _` | ' \| | - |___/_|\__|_|_|\__,_|_|_|_|_| - - *** Welcome to the Bitnami package for WordPress 6.7.2 *** - *** Documentation: https://docs.bitnami.com/general/apps/wordpress/ *** - *** https://docs.bitnami.com/general/ *** - *** Bitnami Forums: https://github.com/bitnami/vms/ *** - - bitnami@ip-172-26-6-136:~$ df + admin@ip-172-26-6-136:~$ df