Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
packer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
packer
Commits
a0195750
Commit
a0195750
authored
Jun 23, 2015
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
helper/communicator: support disabling SSH agent
parent
32f469dc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
3 deletions
+15
-3
communicator/ssh/communicator.go
communicator/ssh/communicator.go
+8
-0
helper/communicator/config.go
helper/communicator/config.go
+1
-0
helper/communicator/step_connect_ssh.go
helper/communicator/step_connect_ssh.go
+4
-3
website/source/docs/templates/communicator.html.md
website/source/docs/templates/communicator.html.md
+2
-0
No files found.
communicator/ssh/communicator.go
View file @
a0195750
...
@@ -37,6 +37,9 @@ type Config struct {
...
@@ -37,6 +37,9 @@ type Config struct {
// Pty, if true, will request a pty from the remote end.
// Pty, if true, will request a pty from the remote end.
Pty
bool
Pty
bool
// DisableAgent, if true, will not forward the SSH agent.
DisableAgent
bool
}
}
// Creates a new packer.Communicator implementation over SSH. This takes
// Creates a new packer.Communicator implementation over SSH. This takes
...
@@ -287,6 +290,11 @@ func (c *comm) connectToAgent() {
...
@@ -287,6 +290,11 @@ func (c *comm) connectToAgent() {
return
return
}
}
if
c
.
config
.
DisableAgent
{
log
.
Printf
(
"[INFO] SSH agent forwarding is diabled."
)
return
}
// open connection to the local agent
// open connection to the local agent
socketLocation
:=
os
.
Getenv
(
"SSH_AUTH_SOCK"
)
socketLocation
:=
os
.
Getenv
(
"SSH_AUTH_SOCK"
)
if
socketLocation
==
""
{
if
socketLocation
==
""
{
...
...
helper/communicator/config.go
View file @
a0195750
...
@@ -22,6 +22,7 @@ type Config struct {
...
@@ -22,6 +22,7 @@ type Config struct {
SSHPrivateKey
string
`mapstructure:"ssh_private_key_file"`
SSHPrivateKey
string
`mapstructure:"ssh_private_key_file"`
SSHPty
bool
`mapstructure:"ssh_pty"`
SSHPty
bool
`mapstructure:"ssh_pty"`
SSHTimeout
time
.
Duration
`mapstructure:"ssh_timeout"`
SSHTimeout
time
.
Duration
`mapstructure:"ssh_timeout"`
SSHDisableAgent
bool
`mapstructure:"ssh_disable_agent"`
SSHHandshakeAttempts
int
`mapstructure:"ssh_handshake_attempts"`
SSHHandshakeAttempts
int
`mapstructure:"ssh_handshake_attempts"`
SSHBastionHost
string
`mapstructure:"ssh_bastion_host"`
SSHBastionHost
string
`mapstructure:"ssh_bastion_host"`
SSHBastionPort
int
`mapstructure:"ssh_bastion_port"`
SSHBastionPort
int
`mapstructure:"ssh_bastion_port"`
...
...
helper/communicator/step_connect_ssh.go
View file @
a0195750
...
@@ -161,6 +161,7 @@ func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, cancel <-chan stru
...
@@ -161,6 +161,7 @@ func (s *StepConnectSSH) waitForSSH(state multistep.StateBag, cancel <-chan stru
Connection
:
connFunc
,
Connection
:
connFunc
,
SSHConfig
:
sshConfig
,
SSHConfig
:
sshConfig
,
Pty
:
s
.
Config
.
SSHPty
,
Pty
:
s
.
Config
.
SSHPty
,
DisableAgent
:
s
.
Config
.
SSHDisableAgent
,
}
}
log
.
Println
(
"[INFO] Attempting SSH connection..."
)
log
.
Println
(
"[INFO] Attempting SSH connection..."
)
...
...
website/source/docs/templates/communicator.html.md
View file @
a0195750
...
@@ -77,6 +77,8 @@ The SSH communicator has the following options:
...
@@ -77,6 +77,8 @@ The SSH communicator has the following options:
*
`ssh_handshake_attempts`
(int) - The number of handshakes to attempt with
*
`ssh_handshake_attempts`
(int) - The number of handshakes to attempt with
SSH once it can connect. This defaults to 10.
SSH once it can connect. This defaults to 10.
*
`ssh_disable_agent`
(bool) - If true, SSH agent forwarding will be disabled.
*
`ssh_bastion_host`
(string) - A bastion host to use for the actual
*
`ssh_bastion_host`
(string) - A bastion host to use for the actual
SSH connection.
SSH connection.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment