builder/triton: Add support to Skip TLS Verification of Triton URL

In order to allow Packer to connect to Private Triton installations
we now expose `insecure_skip_tls_verify` which, if set to true, will
allow the user to make requests to Triton installations that use a
certificate not signed by a trusted root CA
This commit is contained in:
stack72 2018-03-20 22:10:12 +02:00
parent e222d60b5a
commit c877312a4d
2 changed files with 23 additions and 7 deletions

View File

@ -17,11 +17,12 @@ import (
// AccessConfig is for common configuration related to Triton access
type AccessConfig struct {
Endpoint string `mapstructure:"triton_url"`
Account string `mapstructure:"triton_account"`
Username string `mapstructure:"triton_user"`
KeyID string `mapstructure:"triton_key_id"`
KeyMaterial string `mapstructure:"triton_key_material"`
Endpoint string `mapstructure:"triton_url"`
Account string `mapstructure:"triton_account"`
Username string `mapstructure:"triton_user"`
KeyID string `mapstructure:"triton_key_id"`
KeyMaterial string `mapstructure:"triton_key_material"`
InsecureSkipTLSVerify bool `mapstructure:"insecure_skip_tls_verify"`
signer authentication.Signer
}
@ -131,12 +132,14 @@ func (c *AccessConfig) CreateTritonClient() (*Client, error) {
}
return &Client{
config: config,
config: config,
insecureSkipTLSVerify: c.InsecureSkipTLSVerify,
}, nil
}
type Client struct {
config *tgo.ClientConfig
config *tgo.ClientConfig
insecureSkipTLSVerify bool
}
func (c *Client) Compute() (*compute.ComputeClient, error) {
@ -145,6 +148,10 @@ func (c *Client) Compute() (*compute.ComputeClient, error) {
return nil, errwrap.Wrapf("Error Creating Triton Compute Client: {{err}}", err)
}
if c.insecureSkipTLSVerify {
computeClient.Client.InsecureSkipTLSVerify()
}
return computeClient, nil
}
@ -154,6 +161,10 @@ func (c *Client) Network() (*network.NetworkClient, error) {
return nil, errwrap.Wrapf("Error Creating Triton Network Client: {{err}}", err)
}
if c.insecureSkipTLSVerify {
networkClient.Client.InsecureSkipTLSVerify()
}
return networkClient, nil
}

View File

@ -95,6 +95,11 @@ builder.
- `triton_user` (string) - The username of a user who has access to your Triton
account.
- `insecure_skip_tls_verify` - (bool) This allows skipping TLS verification of
the Triton endpoint. It is useful when connecting to a temporary Triton
installation such as Cloud-On-A-Laptop which does not generally use a
certificate signed by a trusted root CA. The default is `false`.
- `source_machine_firewall_enabled` (boolean) - Whether or not the firewall of
the VM used to create an image of is enabled. The Triton firewall only