Skip to content

Commit d078da4

Browse files
committed
Updated to v2.18.0.0 - Added optional UseAgentCert flag. Fixed bug in openssl RSA.
1 parent 0fcc8c3 commit d078da4

13 files changed

Lines changed: 415 additions & 807 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Mac file system
2+
.DS_Store
3+
14
# Prerequisites
25
*.d
36

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,11 @@ __VirtualDirectory__ : <required> Set this to KeyfactorAgents if you are not usi
219219

220220
__TrustStore__ : <required> The location of additional certificates that are trusted by the Agent. This list is appended to the standard CA certificate store located in `/etc/ssl/certs/ca-certificates.crt` for Ubuntu.
221221

222-
__AgentCert__ : <required> The (eventual) location of the Agent's certificate. This is the certificate used by the Agent to call into the platform.
222+
__UseAgentCert__ : <optional> Defaults to true if not supplied. True = use an agent managed cert for mTLS. False = only use 1-way TLS for the agent. */
223223

224-
__AgentKey__ : <required> The (eventual) location of the Agent's private key. This is the key used by the Agent to call into the platform.
224+
__AgentCert__ : <optional/required> The (eventual) location of the Agent's certificate. This is the certificate used by the Agent to call into the platform.
225+
226+
__AgentKey__ : <optional/required> The (eventual) location of the Agent's private key. This is the key used by the Agent to call into the platform.
225227

226228
__AgentKeyPassword__ : <optional> An optional passphrase for decoding the Agent Key. Note, if a TPM, Secure Element, or secure area is used, this **must be defined**.
227229

agent.c

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
#include "config.h"
4747
#include "session.h"
4848
#include "global.h"
49-
#include "serialize.h"
5049
#include "fetchlogs.h"
5150
#include "utils.h"
5251

@@ -311,44 +310,6 @@ static ENGINE* initialize_engine( const char *engine_id )
311310
} /* initialize_engine */
312311
#endif /* __TPM__ */
313312

314-
/** */
315-
/* Serialize the AgentName and CSR Subject using a json file. In practice */
316-
/* this is a file that is held on a common data store (i.e. network drive) */
317-
/* @param : none */
318-
/* @return : success = 1 */
319-
/* : failure = 0 */
320-
/* */
321-
static int do_serialization( void )
322-
{
323-
struct SerializeData* serial = serialize_load(ConfigData->SerialFile);
324-
if(!serial) {
325-
log_error("%s::%s(%d) : Unable to load Serialization file: %s",
326-
LOG_INF,ConfigData->SerialFile);
327-
return 0;
328-
}
329-
log_trace("%s::%s(%d) : Freeing AgentName & CSRSubject", LOG_INF);
330-
free(ConfigData->AgentName);
331-
free(ConfigData->CSRSubject);
332-
ConfigData->AgentName = (char *)malloc(50);
333-
ConfigData->CSRSubject = (char *)malloc(50);
334-
if (!ConfigData->AgentName || !ConfigData->CSRSubject) {
335-
log_error("%s::%s(%d) : Out of memory", LOG_INF);
336-
return 0;
337-
}
338-
sprintf(ConfigData->AgentName, "%s-%d", serial->ModelName, serial->NextNumber);
339-
log_trace("%s::%s(%d) : ConfigData->AgentName set to: %s", LOG_INF,ConfigData->AgentName);
340-
sprintf(ConfigData->CSRSubject, "CN=%d", serial->NextNumber);
341-
log_trace("%s::%s(%d) : ConfigData->CSRSubject set to: %s", LOG_INF,ConfigData->CSRSubject);
342-
serial->NextNumber++;
343-
ConfigData->Serialize = false;
344-
config_save();
345-
if ( !(serialize_save(serial, ConfigData->SerialFile)) ) {
346-
log_error("%s::%s(%d) : Failed saving the serialization file", LOG_INF);
347-
return 0;
348-
}
349-
return 1;
350-
} /* do_serialization */
351-
352313
/******************************************************************************/
353314
/*********************** GLOBAL FUNCTION DEFINITIONS **************************/
354315
/******************************************************************************/
@@ -466,19 +427,6 @@ int init_platform( int argc, char* argv[] )
466427
}
467428
curlLoaded = true;
468429

469-
/**************************************************************************/
470-
/* 7. If required, serialize the agent */
471-
/**************************************************************************/
472-
if (ConfigData->Serialize) {
473-
log_trace("%s::%s(%d) : Serialize -> true", LOG_INF);
474-
int x = do_serialization();
475-
if ( !x )
476-
{
477-
log_error("%s::%s(%d) : Serialization failed", LOG_INF);
478-
return 0;
479-
}
480-
}
481-
482430
return 1;
483431
} /* init_platform */
484432

agent.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,16 @@ extern struct ScheduledJob* currentJob; /* Defined in schedule.c */
101101
/* 2.16.0.1 = Updated Makefile for OpenSSL v3.x */
102102
/* 2.16.1.0 = Modified agent to not send GUID capabilities. Compile bug fix */
103103
/* 2.17.0.0 = Modified agent to accept ECDSA as well as ECC for a keytype */
104-
#define AGENT_VERSION 0x0002001100000000
104+
/* 2.18.0.0 = Modified agent to skip using agent certificate & openssl fix */
105+
#define AGENT_MAJOR 2ULL
106+
#define AGENT_MINOR 18ULL
107+
#define AGENT_MICRO 0ULL
108+
#define AGENT_BUILD 0ULL
109+
110+
#define AGENT_VERSION \
111+
((AGENT_MAJOR << 48) | \
112+
(AGENT_MINOR << 32) | \
113+
(AGENT_MICRO << 16) | \
114+
(AGENT_BUILD))
105115

106116
#endif /* AGENT_H_ */

0 commit comments

Comments
 (0)