File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed
x-pack/platform/plugins/shared/fleet/server/services/agent_policies Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -1322,6 +1322,40 @@ ssl.test: 123
13221322 ` ) ;
13231323 } ) ;
13241324
1325+ it ( 'should not override advanced yaml ssl fields for logstash output type' , ( ) => {
1326+ const policyOutput = transformOutputToFullPolicyOutput (
1327+ {
1328+ id : 'id123' ,
1329+ hosts : [ 'host.fr:3332' ] ,
1330+ is_default : false ,
1331+ is_default_monitoring : false ,
1332+ name : 'test output' ,
1333+ type : 'logstash' ,
1334+ config_yaml : 'ssl:\n verification_mode: "none" ' ,
1335+ ssl : {
1336+ certificate : '' ,
1337+ certificate_authorities : [ ] ,
1338+ } ,
1339+ } ,
1340+ undefined ,
1341+ false
1342+ ) ;
1343+
1344+ expect ( policyOutput ) . toMatchInlineSnapshot ( `
1345+ Object {
1346+ "hosts": Array [
1347+ "host.fr:3332",
1348+ ],
1349+ "ssl": Object {
1350+ "certificate": "",
1351+ "certificate_authorities": Array [],
1352+ "verification_mode": "none",
1353+ },
1354+ "type": "logstash",
1355+ }
1356+ ` ) ;
1357+ } ) ;
1358+
13251359 it ( 'should work with kafka output' , ( ) => {
13261360 const policyOutput = transformOutputToFullPolicyOutput ( {
13271361 id : 'id123' ,
Original file line number Diff line number Diff line change @@ -480,10 +480,15 @@ export function transformOutputToFullPolicyOutput(
480480 ...kafkaData ,
481481 ...( ! isShipperDisabled ? generalShipperData : { } ) ,
482482 ...( ca_sha256 ? { ca_sha256 } : { } ) ,
483- ...( ssl ? { ssl } : { } ) ,
484483 ...( secrets ? { secrets } : { } ) ,
485484 ...( ca_trusted_fingerprint ? { 'ssl.ca_trusted_fingerprint' : ca_trusted_fingerprint } : { } ) ,
486485 } ;
486+ if ( ( output . type === outputType . Kafka || output . type === outputType . Logstash ) && ssl ) {
487+ newOutput . ssl = {
488+ ...newOutput . ssl ,
489+ ...ssl ,
490+ } ;
491+ }
487492
488493 if ( proxy ) {
489494 newOutput . proxy_url = proxy . url ;
You can’t perform that action at this time.
0 commit comments