[JIRA] (JENKINS-56927) Request: EC2 plugin should use SSH keys via credentials plugin

15 views
Skip to first unread message

acquiredmankind@gmail.com (JIRA)

unread,
Apr 7, 2019, 3:00:03 PM4/7/19
to jenkinsc...@googlegroups.com
Kinnaird McQuade created an issue
 
Jenkins / New Feature JENKINS-56927
Request: EC2 plugin should use SSH keys via credentials plugin
Issue Type: New Feature New Feature
Assignee: FABRIZIO MANFREDI
Components: ec2-plugin
Created: 2019-04-07 18:59
Environment: EC2 plugin: 1.4.2
Jenkins: 2.150.3
Priority: Major Major
Reporter: Kinnaird McQuade

The Ec2 plugin currently requires that you insert SSH private key manually, so it shows up in the UI, which is a security concern. The EC2 plugin should support the use of the credentials plugin so the SSH private key does not need to be exposed to viewers of the "Configure System" page.

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

acquiredmankind@gmail.com (JIRA)

unread,
Apr 12, 2019, 7:35:02 PM4/12/19
to jenkinsc...@googlegroups.com

fabrizio.manfredi@gmail.com (JIRA)

unread,
May 2, 2019, 9:21:03 AM5/2/19
to jenkinsc...@googlegroups.com
FABRIZIO MANFREDI started work on New Feature JENKINS-56927
 
Change By: FABRIZIO MANFREDI
Status: Open In Progress

fabrizio.manfredi@gmail.com (JIRA)

unread,
May 17, 2019, 5:21:02 AM5/17/19
to jenkinsc...@googlegroups.com

I will put in the backlog for the 1.45, if you have time to provide a pull request for that I will be happy to review it

bochenski.kuba+jenkins@gmail.com (JIRA)

unread,
May 30, 2019, 8:53:02 AM5/30/19
to jenkinsc...@googlegroups.com

Also if you want to use JCasC it will force you to enter the ssh key in plaintext in JCasC yaml

acquiredmankind@gmail.com (JIRA)

unread,
May 30, 2019, 12:45:04 PM5/30/19
to jenkinsc...@googlegroups.com

FABRIZIO MANFREDI - any updates on this? This is a pretty serious security issue.

Jakub Bochenski - we do check in our JCasC to Git, but the SSH key isn't rendered when it's in Git. We followed this approach:

  • Terraform generates the SSH key
  • JCasC is in a templates/jcasc.yml file
  • Terraform uses the `template_file` data source to inject parameters into the template file
  • Private key is loaded into the build file properly using `jsonencode` and `chomp` Terraform functions
  • aws_s3_object is used to take the rendered template and load it to a locked down S3 bucket.
  • We used [my-bloody-jenkins](https://github.com/odavid/my-bloody-jenkins) and passed in the S3 object key location into the container via environment variables. This container runs on AWS ECS with a Task role that is permitted to access the S3 bucket. This way, it can grab it at launch.
    • Additionally, all secrets are set via AWS Parameter store, so they are accessible as environment variables on the container, which JCasC then reads.

It's a sound approach, but still, the private key is still embedded in the JCasC at some point. At least in this case, the private key is not checked into Git, but it's still stored as part of the JCasC file in S3. They need to fix this ASAP.

acquiredmankind@gmail.com (JIRA)

unread,
May 30, 2019, 12:46:02 PM5/30/19
to jenkinsc...@googlegroups.com
Kinnaird McQuade edited a comment on New Feature JENKINS-56927
[~thoulen] - any updates on this? This is a pretty serious security issue.

[~jbochenski] - we do check in our JCasC to Git, but the SSH key isn't rendered when it's in Git. We followed this approach:
* Terraform generates the SSH key
* JCasC is in a templates/jcasc.yml file
* Terraform uses the `template_file` data source to inject parameters into the template file
* Private key is loaded into the build file properly using `jsonencode` and `chomp` Terraform functions
* aws_s3_object is used to take the rendered template and load it to a locked down S3 bucket.
* We used [my-bloody-jenkins]([https://github.com/odavid/my-bloody-jenkins]) and passed in the S3 object key location into the container via environment variables. This container runs on AWS ECS with a Task role that is permitted to access the S3 bucket. This way, it can grab it at launch.
** Additionally, all secrets are set via AWS Parameter store, so they are accessible as environment variables on the container, which JCasC then reads.

It's a sound
approach workaround , but still, the private key is still embedded in the JCasC at some point. At least in this case, the private key is not checked into Git, but it's still stored as part of the JCasC file in S3. They need to fix this ASAP.

acquiredmankind@gmail.com (JIRA)

unread,
May 30, 2019, 12:47:02 PM5/30/19
to jenkinsc...@googlegroups.com

I don't have the expertise to make this kind of modifications, unfortunately. Also don't have the time to do it.

bochenski.kuba+jenkins@gmail.com (JIRA)

unread,
May 31, 2019, 10:30:01 AM5/31/19
to jenkinsc...@googlegroups.com

Kinnaird McQuade thanks for sharing your workaround. I think you'll agree that having credentials plugin support would make be better than jumping all those hoops?

fabrizio.manfredi@gmail.com (JIRA)

unread,
Aug 10, 2019, 3:58:01 PM8/10/19
to jenkinsc...@googlegroups.com

With the new release the private key is no longer visible. For the integration with secret manager i don't have an ETA

damian@jesionek.dev (JIRA)

unread,
Mar 19, 2020, 12:25:04 PM3/19/20
to jenkinsc...@googlegroups.com

I added a PR that fixes this issue on github.

Please review carefully as this is my first contribution to a jenkins plugin

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages