Skip to content
This repository has been archived by the owner on Apr 23, 2019. It is now read-only.

Added SSL certificates uploading. #164

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Added SSL certificates uploading. #164

wants to merge 6 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jan 21, 2015

As per #139 I removed the old approach of adding certificates as strings to node JSON file. Cookbook files are used instead.

# ssl_certificate(applications_root, name, app_info) # => /u/apps/my_app/shared/config/my_app.crt'
#
def ssl_certificate(applications_root, name, app_info)
Pathname.new(applications_root).join(name, 'shared', 'config', app_info["ssl_certificate"] || "#{name}.crt")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

"key": "<ssl key>",
"crt": "<ssl crt>"
},
"ssl_enabled": true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about adding this information back into a key value hash like this:

"ssl_info" : {
  "enabled": true
  "certificate": "The cert file",
  "certificate_key": "The key for the cert file"
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

# Check if the app config has ssl_info section
#
def ssl_info?(app_info)
app_info.key?('ssl_info')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@ghost
Copy link
Author

ghost commented Jan 24, 2015

@berkes could you please take a look at #164? Thanks

@@ -33,6 +33,7 @@

# Include library helpers
::Chef::Resource.send(:include, Rails::Helpers)
::Chef::Recipe.send(:include, Rails::Helpers)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for my curiosity: what does this do?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without this line, the following wouldn't work, method missing:

98: ssl_certificate_path = ssl_certificate(applications_root, app, app_info)

since it's a level of recipe, not resource such as:

cookbook_file pathname.to_s do
  ssl_certificate_path = ssl_certificate(applications_root, app, app_info)
end

@berkes
Copy link
Collaborator

berkes commented Jan 26, 2015

👍

We might need to deal with upgrades though. We don't want people who upgrade and have a config with the contents of the ssl-files (as was in the old situation) to suddenly break all their SSL on production (which won't really happen now, because you already raise an exception if the file is not found)

Either we make the option a little smarter and have it detect if it is a path to a file or the content of a cert.

Or we simply document and communicate this very well (as you already do with the raise).

@jvanbaarsen
Copy link
Contributor

What about we first go in a deprecation mode of the old way? So for this release we support both, and throw a big fat warning if people use the older version. And in the next release we remove the old way all together?

@ghost ghost added this to the 2.4.0 milestone Feb 2, 2015
@berkes
Copy link
Collaborator

berkes commented Oct 5, 2015

I'd still really love this feature to be in. The hardest part is to make it backwards compatible though.

@jvanbaarsen @michiels how about a 3.x version that contains all such larger changes.
We'd then not have to introduce all sorts of complexity to support many ways to do a thing (old, new etc) but rather One Way: the new way.

@jvanbaarsen
Copy link
Contributor

@berkes I have to take a good look at this PR, and also see how we can incorporate this in https://github.com/intercity/intercity (The main product we created this for). I think I can free some time for this next friday (I've put it on my todo list for that day)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants