-
Notifications
You must be signed in to change notification settings - Fork 304
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
HPCC-30259 Use secrets for dafilesrv client connections #17821
HPCC-30259 Use secrets for dafilesrv client connections #17821
Conversation
ssock.setown(createSecureSocket(socket.getClear(), nullptr)); | ||
// instead of creating CRemoteFile/CRemoteBase with a secret, it could instead lookup, and create the ISecureSocketContext and pass that | ||
// into the ctor. That would avoid having to look the secret up, extract the certs and recreate the context on each connection. | ||
// The context would be 'owned' by the hook, and would expire when the mappings are removed (when removeMappedDafileSrvSecrets is called). |
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.
NB: @ghalliday @mckellyln - in a subsequent PR I will be refactoring the below so that it uses the new ISecret interface and caching the security contexts
https://track.hpccsystems.com/browse/HPCC-30259 |
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.
@jakesmith a couple of minor bits of code to delete.
Would make sense to delete them, but would merge as-is.
I suspect the code will be much simpler if it unconditionally checks for secrets...
for (auto &dafileSrvEp: dafileSrvEndpoints) | ||
queryDaFileSrvHook()->addSecretUrl(dafileSrvEp.c_str()); | ||
} | ||
void removeMappedDafileSrvSecrets() |
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.
As discussed - it may be simpler to avoid this code and always search for a secret, but for a follow up PR.
fs/dafsclient/rmtclient.cpp
Outdated
@@ -969,6 +992,10 @@ CRemoteBase::CRemoteBase(const SocketEndpoint &_ep, const char * _filename) | |||
: filename(_filename) | |||
{ | |||
ep = _ep; | |||
|
|||
StringBuffer endpointStr; |
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.
Unsued afaics
fs/dafsclient/rmtfile.cpp
Outdated
@@ -244,6 +247,16 @@ class CDaliServixIntercept: public CInterface, implements IDaFileSrvHook | |||
virtual IFile * createIFile(const RemoteFilename & filename) | |||
{ | |||
SocketEndpoint ep = filename.queryEndpoint(); | |||
|
|||
StringBuffer endpointStr; |
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.
Unused afaics
@ghalliday - 2nd commit removes the unused code you spotted. |
Signed-off-by: Jake Smith <[email protected]>
e86fa42
to
637050c
Compare
bool doConnect = true; | ||
if (connectMethod == SSLFirst || connectMethod == UnsecureFirst) | ||
if (storageSecret) | ||
connectSocket(tep, 0, INFINITE, true); |
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.
Should timeout be INFINITE or 0 (to use configured default) ?
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.
timeout is 0.
retries is INFINITE.
void connectSocket(SocketEndpoint &ep, unsigned connectTimeoutMs=0, unsigned connectRetries=INFINITE, bool secure=false);
Same as defaults, just explicit now.
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.
ok, sorry I read the args wrong.
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, just one question about setting timeout to INFINITE instead of 0 in two locations.
@mckellyln - please see reply, It should be the same as before connectTimeoutMs=0, connectRetries=INFINITE - same as defaults, as before, just explicit. |
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.
Approved
2c10656
into
hpcc-systems:candidate-9.4.x
Type of change:
Checklist:
Smoketest:
Testing: