Skip to content

Conversation

@dyrock
Copy link
Contributor

@dyrock dyrock commented Jun 14, 2018

This plugin performs two basic tasks -

  1. Load SSL certificates from file storage on demand. The total number of loaded certificates can be configured.
  2. Generates SSL certificates on demand. Generated certificates can be written to file storage for later retrieval.

Certifier
This plugin performs two basic tasks -

Load SSL certificates from file storage on demand. The total number of loaded certificates can be configured.
Copy link
Member

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
Copy link
Member

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;
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

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
Copy link
Member

Choose a reason for hiding this comment

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

"scheduled"

@zwoop
Copy link
Contributor

zwoop commented Jun 16, 2018

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/

@SolidWallOfCode
Copy link
Member

Yes, @dyrock is working on them. I'm waiting for those fixes before I do another pass.

shinrich
shinrich previously approved these changes Jun 21, 2018
Copy link
Member

@shinrich shinrich left a 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.

@SolidWallOfCode
Copy link
Member

At some point we should remove the ssl_cert_loader example plugin, this replaces that. Plus, @dyrock needs to squash the commits.

TSCont cb_shadow = nullptr;
info.plugin_name = "certifier";
info.vendor_name = "Oath";
info.support_email = "zeyuany@oath.com";
Copy link
Member

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";
Copy link
Member

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];
Copy link
Member

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);?

Copy link
Contributor Author

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.

Copy link
Member

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) {
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

@SolidWallOfCode
Copy link
Member

Plus, please squash these commits.

@dyrock dyrock force-pushed the plugin_certifier branch from 78fbc08 to 1154be9 Compare July 3, 2018 20:14
@SolidWallOfCode SolidWallOfCode merged commit 7190c1c into apache:master Jul 10, 2018
@bryancall bryancall modified the milestones: 9.0.0, 8.0.1 Oct 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants