File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ You will need:
6
6
7
7
* A network domain
8
8
* A VLAN in that network domain (servers will be attached to this VLAN)
9
- * A firewall rule that permits SSH traffic from your (local) public IPv4 address to the VLAN's IPv4 network
9
+ * A firewall rule that permits SSH traffic from your (local) public IPv4 address to the VLAN's IPv4 network
10
+ Alternatively, you can use the ` --ddcloud-create-ssh-firewall-rule ` flag when creating your machine
10
11
11
12
The driver will allocate a public IP address and NAT rule for each machine that it creates.
12
13
@@ -49,6 +50,7 @@ Environment: `DD_COMPUTE_SSH_PORT`
49
50
* ` ddcloud-ssh-bootstrap-password ` - The initial SSH password used to bootstrap SSH key authentication.
50
51
This password is removed once the SSH key has been installed
51
52
Environment: ` DD_COMPUTE_SSH_BOOTSTRAP_PASSWORD `
53
+ * ` ddcloud-create-ssh-firewall-rule ` - Automatically create a firewall rule to enable inbound SSH to the target server?
52
54
53
55
## Installing the provider
54
56
Original file line number Diff line number Diff line change 9
9
"time"
10
10
)
11
11
12
- var firewallRuleNameSanitizer = strings .NewReplacer ("-" , "." , "_" , "." )
13
-
14
12
// Get the CloudControl API client used by the driver.
15
13
func (driver * Driver ) getCloudControlClient () (client * compute.Client , err error ) {
16
14
client = driver .client
@@ -461,7 +459,7 @@ func (driver *Driver) createSSHFirewallRule(clientPublicIPAddress string) error
461
459
)
462
460
463
461
ruleConfiguration := compute.FirewallRuleConfiguration {
464
- Name : firewallRuleNameSanitizer . Replace ( driver .MachineName ),
462
+ Name : driver .buildFirewallRuleName ( "SSH" ),
465
463
}
466
464
ruleConfiguration .Accept ()
467
465
ruleConfiguration .Enable ()
@@ -517,3 +515,13 @@ func (driver *Driver) deleteSSHFirewallRule() error {
517
515
518
516
return nil
519
517
}
518
+
519
+ // Name sanitiser for firewall rules.
520
+ var firewallRuleNameSanitizer = strings .NewReplacer ("-" , "." , "_" , "." )
521
+
522
+ // Build an acceptable name for a firewall rule.
523
+ func (driver * Driver ) buildFirewallRuleName (suffix string ) string {
524
+ return strings .ToLower (
525
+ firewallRuleNameSanitizer .Replace (driver .MachineName ) + "." + suffix ,
526
+ )
527
+ }
You can’t perform that action at this time.
0 commit comments