1
1
# Bastion server
2
2
3
- * FQDN: ` bastion.infra.rust-lang.org `
4
- * [ Ansible playbook] [ ansible ] to deploy this server.
5
- * [ Terraform configuration] [ terraform ] to create AWS resources.
6
- * [ Instance metrics] [ grafana ] (only available to infra team members).
3
+ - FQDN: ` bastion.infra.rust-lang.org `
4
+ - [ Ansible playbook] [ ansible ] to deploy this server.
5
+ - [ Terraform configuration] [ terraform ] to create AWS resources.
6
+ - [ Instance metrics] [ grafana ] (only available to infra team members).
7
7
8
8
## Logging into servers through the bastion
9
9
@@ -12,20 +12,28 @@ directly to a production server with SSH. Instead, all connections must come
12
12
from a small server called the "bastion", which only allows connections from a
13
13
few whitelisted networks and logs any connection attempt.
14
14
15
- To log into a server through the bastion you can use SSH's ` -J ` flag :
15
+ To log into a server through the bastion, use one of the following methods :
16
16
17
- ```
18
- ssh -J bastion.infra.rust-lang.org servername.infra.rust-lang.org
19
- ```
17
+ - Use SSH's ` -J ` flag:
20
18
21
- It's also possible to configure SSH to always jump through the bastion when
22
- connecting to a host. Add this snippet to your SSH configuration file (usually
23
- located in ` ~/.ssh/config ` ):
19
+ ```
20
+ ssh -J <username>@bastion.infra.rust-lang.org <username>@servername.infra.rust-lang.org
21
+ ```
24
22
25
- ```
26
- Host servername.infra.rust-lang.org
27
- ProxyJump bastion.infra.rust-lang.org
28
- ```
23
+ - Configure your SSH client to always jump through the bastion when connecting to a host:
24
+
25
+ - Add this snippet to your SSH configuration file (usually located in ` ~/.ssh/config ` ):
26
+
27
+ ```
28
+ Host servername.infra.rust-lang.org
29
+ ProxyJump <username>@bastion.infra.rust-lang.org
30
+ ```
31
+
32
+ - Use SSH:
33
+
34
+ ```
35
+ ssh <username>@servername.infra.rust-lang.org
36
+ ```
29
37
30
38
Please remember the bastion server only allows connections from a small list of
31
39
IP addresses. Infra team members with AWS access can change the whitelist, but
@@ -71,17 +79,21 @@ When running the following commands, replace `USERNAME` and `IP_ADDRESS` with th
71
79
### Updating a whitelisted IP
72
80
73
81
1. Run:
82
+
74
83
```
75
84
aws ssm put-parameter --overwrite --type String --name "/prod/bastion/allowed-ips/USERNAME" --value "IP_ADDRESS/32" --region us-west-1
76
85
```
86
+
77
87
2. [apply the Terraform configuration][terraform-apply].
78
88
79
89
### Removing a whitelisted IP
80
90
81
91
1. Run:
92
+
82
93
```
83
94
aws ssm delete-parameter --name "/prod/bastion/allowed-ips/USERNAME" --region us-west-1
84
95
```
96
+
85
97
2. Remove the username from the list in
86
98
[`terraform/bastion/firewall.tf`][allowed-ips] (local variable
87
99
`allowed_users`).
0 commit comments