diff --git a/REMOTE_SETUP.md b/REMOTE_SETUP.md index ea2f94f..a901cbf 100644 --- a/REMOTE_SETUP.md +++ b/REMOTE_SETUP.md @@ -151,6 +151,81 @@ After a couple of minutes, a comment should appear and indicate that the operati +## Register your IP address + +In order to further improve the security of your VM, it has been configured to refuse incoming SSH connections unless from registered IP addresses. + +Let's register your IP address to allow SSH access to your VM from your current location. + +In order to move forwards, you will need to use: +- The alias provided to you by Le Wagon +- Your **public** IP address (**NOT** the **VM** IP address provided to you by Le Wagon) + +
+ + 🤔 How does my public IP address differ from my VM IP address ? + + Your **public** IP address is the address from which you are accessing the network. It changes whenever you change locations or if you switch your means of connecting to the Internet. + + This IP address is coined as public since it is the address any website or application sees when you connect to it. It is the IP address we need the VM to accept connections from. + + Your **public** IP address identifies the location from which you connect. + + The **VM** IP address identifies the machine you want to connect to. + + In order to connect to your VM using SSH you need to both: + - Connect from a known location, identified by a registered **public** IP address + - Connect using a known user, identified by the registered **public** SSH key +
+ + +Retrieve your public IP address: + +
+ Windows + +```bash +curl -s ifconfig.me && echo +``` +
+ +
+ MacOS & Linux + +``` bash +curl -s ifconfig.me && echo +``` +
+ +
+ Browser alternative + +Open https://ifconfig.me in your browser and copy the IP shown. + +![](images/vm_retrieve_ip.png) +
+ + +Copy your public IP address. + +Now let's register your public IP address: +- Go to https://github.com/lewagon/remote-setup/issues +- Click on **New issue** +- Select **Register IP address** +- Enter your alias +- Enter your public IP address +- Validate with **Create** + +![](images/register_ip_address.png) + +👉 Your public IP address is being allowed so you can SSH to your virtual machine from your location + +After a couple of minutes, a comment should appear and indicate that the operation is complete. If the registration fails, ask a teacher for help 🙋 + +![](images/register_ip_complete.png) + + + ## Let's start your VM for the first time Your virtual machine is like any regular computer. You will not be able to access and use it unless it is started. To conserve energy, it should be turned off whenever it is not in use 💡 @@ -211,8 +286,7 @@ ssh -i 👉PATH_TO_YOUR_PRIVATE_KEY👈 lewagon@👉YOUR_IP_ADDRESS👈 ssh -i ~/.ssh/id_ed25519 lewagon@34.52.208.105 ssh: connect to host 34.52.208.105 port 22: Operation timed out ``` - - The virtual machine is not started, ask a teacher for help 🙋 + The virtual machine is not started OR your IP address is not registered, ask a teacher for help 🙋 diff --git a/_partials/vm_ip.md b/_partials/vm_ip.md new file mode 100644 index 0000000..f91c29c --- /dev/null +++ b/_partials/vm_ip.md @@ -0,0 +1,73 @@ + +## Register your IP address + +In order to further improve the security of your VM, it has been configured to refuse incoming SSH connections unless from registered IP addresses. + +Let's register your IP address to allow SSH access to your VM from your current location. + +In order to move forwards, you will need to use: +- The alias provided to you by Le Wagon +- Your **public** IP address (**NOT** the **VM** IP address provided to you by Le Wagon) + +
+ + 🤔 How does my public IP address differ from my VM IP address ? + + Your **public** IP address is the address from which you are accessing the network. It changes whenever you change locations or if you switch your means of connecting to the Internet. + + This IP address is coined as public since it is the address any website or application sees when you connect to it. It is the IP address we need the VM to accept connections from. + + Your **public** IP address identifies the location from which you connect. + + The **VM** IP address identifies the machine you want to connect to. + + In order to connect to your VM using SSH you need to both: + - Connect from a known location, identified by a registered **public** IP address + - Connect using a known user, identified by the registered **public** SSH key +
+ + +Retrieve your public IP address: + +
+ Windows + +```bash +curl -s ifconfig.me && echo +``` +
+ +
+ MacOS & Linux + +``` bash +curl -s ifconfig.me && echo +``` +
+ +
+ Browser alternative + +Open https://ifconfig.me in your browser and copy the IP shown. + +![](images/vm_retrieve_ip.png) +
+ + +Copy your public IP address. + +Now let's register your public IP address: +- Go to https://github.com/lewagon/remote-setup/issues +- Click on **New issue** +- Select **Register IP address** +- Enter your alias +- Enter your public IP address +- Validate with **Create** + +![](images/register_ip_address.png) + +👉 Your public IP address is being allowed so you can SSH to your virtual machine from your location + +After a couple of minutes, a comment should appear and indicate that the operation is complete. If the registration fails, ask a teacher for help 🙋 + +![](images/register_ip_complete.png) diff --git a/_partials/vm_test.md b/_partials/vm_test.md index a5f0757..ecf9260 100644 --- a/_partials/vm_test.md +++ b/_partials/vm_test.md @@ -39,7 +39,11 @@ ssh -i 👉PATH_TO_YOUR_PRIVATE_KEY👈 lewagon@👉YOUR_IP_ADDRESS👈 ssh: connect to host 34.52.208.105 port 22: Operation timed out ``` + {%- if ip_filtering %} + The virtual machine is not started OR your IP address is not registered, ask a teacher for help 🙋 + {%- else %} The virtual machine is not started, ask a teacher for help 🙋 + {%- endif %} diff --git a/builds/REMOTE_SETUP.yml b/builds/REMOTE_SETUP.yml index 8739d72..66cfe41 100644 --- a/builds/REMOTE_SETUP.yml +++ b/builds/REMOTE_SETUP.yml @@ -8,8 +8,11 @@ partials: vars: key_name: ds-bootcamp - vm_register + - vm_ip - vm_start - - vm_test + - name: vm_test + vars: + ip_filtering: true - de_setup/win_vscode - name: de_setup/vscode_remote_ssh vars: