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
01abbc44
Commit
01abbc44
authored
Sep 03, 2014
by
Mitchell Hashimoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
common/ssh: error if encrypted key is used
parent
76a82216
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
CHANGELOG.md
CHANGELOG.md
+2
-0
common/ssh/key.go
common/ssh/key.go
+14
-0
No files found.
CHANGELOG.md
View file @
01abbc44
...
...
@@ -20,6 +20,8 @@ IMPROVEMENTS:
BUG FIXES:
*
core: nicer error message if an encrypted private key is used for
SSH. [GH-1445]
*
builder/amazon-chroot: Can properly build HVM images now. [GH-1360]
*
builder/amazon-chroot: Fix crash in root device check. [GH-1360]
*
builder/amazon-instance: Fix deprecation warning for
`ec2-bundle-vol`
...
...
common/ssh/key.go
View file @
01abbc44
package
ssh
import
(
"encoding/pem"
"fmt"
"io/ioutil"
"os"
...
...
@@ -21,6 +22,19 @@ func FileSigner(path string) (ssh.Signer, error) {
return
nil
,
err
}
// We parse the private key on our own first so that we can
// show a nicer error if the private key has a password.
block
,
_
:=
pem
.
Decode
(
keyBytes
)
if
block
==
nil
{
return
nil
,
fmt
.
Errorf
(
"Failed to read key '%s': no key found"
,
path
)
}
if
block
.
Headers
[
"Proc-Type"
]
==
"4,ENCRYPTED"
{
return
nil
,
fmt
.
Errorf
(
"Failed to read key '%s': password protected keys are
\n
"
+
"not supported. Please decrypt the key prior to use."
,
path
)
}
signer
,
err
:=
ssh
.
ParsePrivateKey
(
keyBytes
)
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"Error setting up SSH config: %s"
,
err
)
...
...
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