Skip to content

Commit ffc9510

Browse files
authored
Add hash to configuration change events (#208)
1 parent 5d32c32 commit ffc9510

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

sysmonforlinux.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,14 @@ void telemetryReady()
199199
if( OPT_SET( ConfigDefault ) ) {
200200
SendConfigEvent( "Defaults", NULL );
201201
} else if( configFile ) {
202-
SendConfigEvent( configFile, NULL );
202+
ULONG hashType = SysmonCryptoCurrent(); // Default is sha256;
203+
if(OPT_SET( HashAlgorithms )) {
204+
unsigned int *hashTypePtr = OPT_VALUE( HashAlgorithms );
205+
hashType = *hashTypePtr;
206+
}
207+
TCHAR buff[256];
208+
LinuxGetFileHash(hashType, configFile, buff, _countof(buff));
209+
SendConfigEvent( configFile, buff );
203210
} else {
204211
SendConfigEvent( GetCommandLine(), NULL );
205212
}
@@ -1121,7 +1128,14 @@ void configChange()
11211128
//
11221129
// Send config change event
11231130
//
1124-
SendConfigEvent( configFile, NULL );
1131+
ULONG hashType = SysmonCryptoCurrent(); // Default is sha256;
1132+
if(OPT_SET( HashAlgorithms )) {
1133+
unsigned int *hashTypePtr = OPT_VALUE( HashAlgorithms );
1134+
hashType = *hashTypePtr;
1135+
}
1136+
TCHAR buff[256];
1137+
LinuxGetFileHash(hashType, configFile, buff, _countof(buff));
1138+
SendConfigEvent( configFile, buff );
11251139

11261140
fflush(NULL);
11271141
}
@@ -1357,7 +1371,6 @@ main(
13571371
}
13581372
}
13591373
else {
1360-
13611374
if (!copyConfigFile(configFile)) {
13621375
fprintf(stderr, "Cannot copy the config file\n");
13631376
return ERROR_INVALID_PARAMETER;

0 commit comments

Comments
 (0)