-
Notifications
You must be signed in to change notification settings - Fork 847
Plugin Certifier: Load, manage and/or dynamically generate certificates #3832
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| Certifier | ||
| This plugin performs two basic tasks - | ||
|
|
||
| Load SSL certificates from file storage on demand. The total number of loaded certificates can be configured. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"loaded certificates kept in memory"...
| @@ -0,0 +1,709 @@ | |||
| /** @file | |||
| A brief file description | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix this.
| /// Add a new ssl_data to dict if not exist | ||
| scoped_SslData scoped_ssl_data(new SslData); | ||
| ssl_data = scoped_ssl_data.get(); | ||
| ssl_data->commonName = commonName; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be good to std::move(commonName) and then use ssl_data->commonName later instead, avoiding a string duplication.
| size -= 1; | ||
| auto iter = cnDataMap.find(tail->commonName); | ||
| if (iter != cnDataMap.end()) { | ||
| local = std::move(iter->second); // copy ownership |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the point of this? Isn't the SslData in local lost anyway when this goes out of scope?
| return req; | ||
| } | ||
|
|
||
| // /// Local helper function that signs a X509 certificate with (CA) private key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this.
| } | ||
| } | ||
|
|
||
| // Registre plugin and create callback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Register"
| SSL_set_SSL_CTX(ssl, ref_ctx); | ||
| TSVConnReenable(ssl_vc); | ||
| } | ||
| /// For queued up connections, the schduled continuation will handle the reenabling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"scheduled"
|
This has a couple of clang-analyzer errors, see e.g. https://ci.trafficserver.apache.org/clang-analyzer/github/3832/2018-06-15-211301-11710-1/ |
|
Yes, @dyrock is working on them. I'm waiting for those fixes before I do another pass. |
shinrich
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
|
At some point we should remove the |
| TSCont cb_shadow = nullptr; | ||
| info.plugin_name = "certifier"; | ||
| info.vendor_name = "Oath"; | ||
| info.support_email = "zeyuany@oath.com"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be dev@trafficserver.apache.org.
| TSPluginRegistrationInfo info; | ||
| TSCont cb_shadow = nullptr; | ||
| info.plugin_name = "certifier"; | ||
| info.vendor_name = "Oath"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be "Apache Software Foundation"
| ssl_data->commonName = std::move(commonName); | ||
| ssl_data->vconnQ.push(edata); | ||
|
|
||
| auto &target_data = cnDataMap[ssl_data->commonName]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a bit odd - why not just cnDatamap[ssl_data->commonName] = std::move(scoped_ssl_data);?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since we want to first check if it exists at all? In case we lose the old pointer by replacing it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to generate the debug message? In that case you'd do better to use find, it's cleaner.
| { | ||
| TSMutexLock(list_mutex); | ||
| std::unique_ptr<SslData> local = nullptr; | ||
| if (data != nullptr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not call remove to remove the item, then always insert at the front?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the remove method does removal of both list node and dict node. Here in prepend the first part is only removing from list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be possible to write a method/function that just did the part of remove that's common to both.
|
Plus, please squash these commits. |
This plugin performs two basic tasks -