Closed (fixed)
Project:
Akamai
Version:
8.x-3.x-dev
Component:
Code
Priority:
Critical
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
2 Jun 2016 at 16:28 UTC
Updated:
10 Feb 2019 at 20:29 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
cameron tod commentedComment #3
naveenvalecha@Cameron Tod,
can we move the password storage to the settings.php instead of configuration ?
That way we can access it via Settings final class.
can we also show a warning on the status page i.e. hook_requirements if site is on http protocol.
Comment #4
cameron tod commentedI think we can offer that option, but to satisfy Akamai's concerns I think we'd still need to encrypt the value.
Comment #5
barrett commentedIt seems rather heavy handed to mandate the use of Field Encrypt (especially since their D8 is beta and their D7 is largely unsupported). What's the approach you have in mind for this?
When the issue has come up previously (see #2569845: Store akamai password encrypted for example), there have been some efforts at it but the consensus of users was that we needed Akamai to implement an API-key style authentication rather than username and password structures.
I am glad to see Akamai finally being active in regards to the module, though.
Comment #6
cameron tod commentedI would much prefer Akamai had an API key based auth, but I'd need to open a dialogue with them to understand if that is possible and/or on their roadmap.
My initial thoughts were to use the Key module, write a plugin that provided encrypted keys, and apply that to the user pass, using
$settings['drupal_hash_salt']as an encryption key. That is based on quick survey of what's available and stable in d8 rather than a rigorous analysis or PoC.If I can achieve 2 way encryption using native D8 code I think that's preferable, but I need to dig in to understand what's available. A quick look suggests maybe not.
Comment #7
synedra commentedThe credentials for the new OPEN versions of the API (including the one that you need to use for the fast invalidate) use the OPEN authentication mechanism, not a user/password. As with OAuth there are 4 pieces of information needed to make a successful call:
1) Hostname (different for each credential set)
2) Client token
3) Client secret
4) Access token
On a standard server setup, these are stored in an INI configuration file in the ~/.edgerc directory.
The edgegrid-php library uses these credentials appropriately. Davey Shafik is working on a similar Wordpress plugin which will do the same thing.
Thanks,
Kirsten
Comment #8
cameron tod commentedHere's a screenshot of the config screen. Everything in 8.x-3.x is based on the OPEN APIs (specifically https://github.com/akamai-open/AkamaiOPEN-edgegrid-php) We actually don't use Akamai user/pass at all which I didn't really pick up on as your primary concern earlier:
Is this still something you need encrypted/accessed only via HTTPs?
Comment #9
dshafik commentedGiven the difficulty of securing encryption keys for encrypted data, I think the best option is to allow the following mechanisms (which is my goal for WordPress also):
AKAMAI_EDGEGRID_HOSTAKAMAI_EDGEGRID_CLIENT_TOKENAKAMAI_EDGEGRID_CLIENT_SECRETAKAMAI_EDGEGRID_ACCESS_TOKENI think standardizing on this mechanism across multiple projects will be great for everyone.
Comment #10
dshafik commented@Cameron Tod
The API credentials should be treated the same as login credentials, see my previous comment on my recommendations for handling this.
Thanks,
Comment #11
cameron tod commentedIt's tough for us to require environment variables, as that breaks a Drupal principle of allowing people to admin sites on environments where they may not be able to create them for whatever reason (PaaS, shared hosting, lack of knowledge, etc). That's not to say its out of the question but I just need to think it through.
I've been playing around with https://github.com/defuse/php-encryption as a means to encrypt the credentials, but to encrypt securely we'd need to save a key somewhere. If that is not saved in private files, we're just moving the problem around (though we would have encrypted values in the DB, the key would be available over the public web). We could mandate use of private files, but in D8 that requires setting up some things on the server - at which point you might as well store the .edgerc directly, or even set envvars.
I am still evaluating - but thanks for all the suggestions so far!
Comment #12
cameron tod commentedCreated followup for upload of .edgerc files: #2744253: Allow users to upload .edgerc file to specify credentials
Comment #13
cameron tod commentedHere's where I'm at so far.
- Credentials are now provided by a plugin service
- Credentials are now encrypted using openssl, utilising a secure generated initialisation vector, Drupal's hash_salt (stored in code, not in the db), and AES-256-OFB.
If credentials are to be stored in code (settings.php), then there is a standalone credentials plugin for that.
Moving credentials to a plugin should make it easier to support different ways of supplying creds, like file or envvar based.
I just need to write some tests for the new plugins and alter the existing tests to supply credentials via the new approach.
Comment #14
cameron tod commentedWoops, need to inject this
Comment #15
cashwilliams commentedI feel like the solution should be to provide the ability to use the drupal.org/project/key module that is built to do exactly this type of thing. It is built so users can choose what storage method they'd like to store key, including the ability to store offsite using HSM etc.
Comment #16
cameron tod commentedI think that's probably best. Implementing my own encryption is asking for bugs down the road. I am also a bit reluctant to add so much extra code when its probably un-needed. I will take another look.
Comment #17
WidgetsBurritos commentedAt the very least this needs to be rerolled, but I'd be interested in testing out the Key module integration here as well.
Comment #18
WidgetsBurritos commentedHere is a proof of concept using the key module. Still need to figure out what to do from a testing perspective, but it at least shows what it would take to use the key module.
It is worth noting this issue with the key module: #2980072: Encrypt key value
We should probably help push that issue along as well.
Comment #20
WidgetsBurritos commentedHere is an updated patch that helps facilitate some of the optional dependency injection.
I haven't started to address any of the test failures yet.
Comment #22
WidgetsBurritos commentedThis patch takes the test out for the database method as we've removed it. I haven't added tests for the key integration yet. That probably should exist as either a Functional or Kernel test.
Comment #24
WidgetsBurritos commentedWow ignore that last patch. I had a rebase glitch there. Let's try that again.
Comment #25
WidgetsBurritos commentedComment #27
WidgetsBurritos commentedI believe this will resolve the remaining test errors. It required a bit of reworking of the AkamaiAuthentication class to inject the messenger and key repository services into them.
Comment #28
WidgetsBurritos commentedComment #29
WidgetsBurritos commentedBased on feedback during ContributionWeekend2019:
What about else here?
Instead of doing all this, let's create a custom service that can handle the optional service and the variety of options (e.g. edgerc or key module)
Comment #30
WidgetsBurritos commentedThis patch contains a new akamai.key_provider service which acts as a wrapper around the key module's key.repository service. It's not exactly what was suggested in #29.2, as the .edgerc handling is handled by the external akamai libraries, so I limited the scope of what I focused on to just creating a wrapper around the key.repository. In regard to #29.1, we don't actually need to worry about this case as $auth is just empty, but all the functionality fails gracefully already.
Comment #31
WidgetsBurritos commentedConsolidating multiple commits from #30
Comment #33
WidgetsBurritos commentedSwitching to composer-based test dependencies instead of info file.
Comment #34
rocketeerbkw commentedReviewed and discussed at 2019 Austin Contribution Weekend. Removing the built-in config store and allowing users to instead use they
keymodule to protect API keys seems like a good compromise approach. Latest patch LGTM.Comment #36
WidgetsBurritos commented