Skip to content

Commit

Permalink
Fixes #18140: Remove syslog-related config from webapp
Browse files Browse the repository at this point in the history
  • Loading branch information
fanf committed Jul 21, 2021
1 parent 9b6e0e0 commit 8af3979
Show file tree
Hide file tree
Showing 37 changed files with 35 additions and 499 deletions.
11 changes: 0 additions & 11 deletions webapp/sources/api-doc/components/schemas/settings.yml
Expand Up @@ -81,17 +81,6 @@ settings:
- SYSLOG
example: "HTTPS"
description: Default reporting protocol used
syslog_protocol_disabled:
type: boolean
description: Completely disable syslog protocol
example: true
rsyslog_reporting_protocol:
type: string
enum:
- "TCP"
- "UDP"
example: "UDP"
description: Protocol used for syslog communication between node and server
reporting_mode:
type: string
enum:
Expand Down
Expand Up @@ -336,13 +336,6 @@ objectClass: organizationalUnit
objectClass: top
ou: Application Properties

dn: propertyName=rudder_syslog_protocol,ou=Application Properties,cn=rudder-
configuration
objectClass: property
objectClass: top
propertyName: rudder_syslog_protocol
propertyValue: UDP

dn: propertyName=api_compatibility_mode,ou=Application Properties,cn=rudder-configuration
objectClass: property
objectClass: top
Expand Down Expand Up @@ -373,10 +366,4 @@ objectClass: top
propertyName: rudder_report_protocol_default
propertyValue: HTTPS

dn: propertyName=rudder_syslog_protocol_disabled,ou=Application Properties,c
n=rudder-configuration
objectClass: property
objectClass: top
propertyName: rudder_syslog_protocol_disabled
propertyValue: true

Expand Up @@ -115,11 +115,6 @@ class SystemVariableSpecServiceImpl extends SystemVariableSpecService {
, multivalued = false
, constraint = Constraint(mayBeEmpty=true)
)
, SystemVariableSpec(
"SYSLOGPORT" , "Port to use for rsyslog (used by reports)"
, multivalued = false
, constraint = Constraint(typeName = IntegerVType())
)
, SystemVariableSpec(
"CONFIGURATION_REPOSITORY_FOLDER" , "The path to the configuration repository folder"
, multivalued = false
Expand Down Expand Up @@ -352,15 +347,6 @@ class SystemVariableSpecServiceImpl extends SystemVariableSpecService {
"REPORTING_PROTOCOL" , "Protocol used by agent to send reports (HTTPS or SYSLOG)"
, multivalued = false
)
, SystemVariableSpec(
"RUDDER_SYSLOG_PROTOCOL" , "Protocol ued by syslog (TCP or UDP)"
, multivalued = false
)
, SystemVariableSpec(
"SYSLOG_PROTOCOL_DISABLED" , "Syslog protocol totally disabled"
, multivalued = false
, constraint = Constraint(typeName = BooleanVType, default=Some("false"))
)
, SystemVariableSpec(
"SERVER_VERSION" , "Version of rudder server webapp, as displayed in the UI (not the package version)"
, multivalued = false
Expand Down
Expand Up @@ -158,41 +158,6 @@ class AgentRunIntervalServiceImpl (

import ca.mrvisser.sealerate.values

sealed trait SyslogProtocol {
def value : String
}

object SyslogProtocol {
def apply(value: String): Box[SyslogProtocol] = {
value match {
case SyslogTCP.value => Full(SyslogTCP)
case SyslogUDP.value => Full(SyslogUDP)
case _ => Failure(s"Invalid syslog protocol: *{value}")
}
}

def allProtocols: Set[SyslogProtocol] = values[SyslogProtocol]

def parse(value: String): Either[RudderError, SyslogProtocol] = {
allProtocols.find {
_.value == value.toUpperCase()
} match {
case None =>
Left(Unexpected(s"Unable to parse syslog protocol mame '${value}'. was expecting ${allProtocols.map(_.value).mkString("'", "' or '", "'")}."))
case Some(protocol) =>
Right(protocol)
}
}

}

final case object SyslogTCP extends SyslogProtocol {
val value = "TCP"
}

final case object SyslogUDP extends SyslogProtocol {
val value = "UDP"
}

sealed trait AgentReportingProtocol {
def value : String
Expand All @@ -202,15 +167,11 @@ final case object AgentReportingHTTPS extends AgentReportingProtocol {
val value = "HTTPS"
}

final case object AgentReportingSyslog extends AgentReportingProtocol {
val value = "SYSLOG"
}

object AgentReportingProtocol {
def apply(value: String): Box[AgentReportingProtocol] = {
value match {
case AgentReportingHTTPS.value => Full(AgentReportingHTTPS)
case AgentReportingSyslog.value => Full(AgentReportingSyslog)
case _ => Failure(s"Invalid reporting protocol: *{value}")
}
}
Expand Down
Expand Up @@ -122,7 +122,6 @@ class SystemVariableServiceImpl(
, webdavPassword : String
, reportsDbUri : String
, reportsDbUser : String
, syslogPort : Int
, configurationRepository : String
, serverRoles : Seq[RudderServerRole]
, serverVersion : String
Expand All @@ -137,8 +136,6 @@ class SystemVariableServiceImpl(
, getCfengineOutputsTtl : () => Box[Int]
, getStoreAllCentralizedLogsInFile: () => Box[Boolean]
, getSendMetrics : () => Box[Option[SendMetrics]]
, getSyslogProtocol : () => Box[SyslogProtocol]
, getSyslogProtocolDisabled : () => Box[Boolean]
, getReportProtocolDefault : () => Box[AgentReportingProtocol]
, getRudderVerifyCertificates : () => Box[Boolean]
) extends SystemVariableService with Loggable {
Expand All @@ -159,7 +156,6 @@ class SystemVariableServiceImpl(
val varSharedFilesFolder = systemVariableSpecService.get("SHARED_FILES_FOLDER" ).toVariable(Seq(sharedFilesFolder))
val varPolicyDistribCfenginePort = systemVariableSpecService.get("COMMUNITYPORT" ).toVariable(Seq(policyDistribCfenginePort.toString))
val varPolicyDistribHttpsPort = systemVariableSpecService.get("HTTPS_POLICY_DISTRIBUTION_PORT" ).toVariable(Seq(policyDistribHttpsPort.toString))
val syslogPortConfig = systemVariableSpecService.get("SYSLOGPORT" ).toVariable(Seq(syslogPort.toString))
val configurationRepositoryFolder = systemVariableSpecService.get("CONFIGURATION_REPOSITORY_FOLDER").toVariable(Seq(configurationRepository))

// Compute the values for rudderServerRoleLdap, rudderServerRoleDb and rudderServerRoleRelayTop
Expand All @@ -185,14 +181,11 @@ class SystemVariableServiceImpl(

val modifiedFilesTtl = getProp("MODIFIED_FILES_TTL" , getModifiedFilesTtl)
val cfengineOutputsTtl = getProp("CFENGINE_OUTPUTS_TTL" , getCfengineOutputsTtl)
val reportProtocol = getProp("RUDDER_SYSLOG_PROTOCOL", () => getSyslogProtocol().map(_.value))

val relaySyncMethod = getProp("RELAY_SYNC_METHOD" , () => getSyncMethod().map(_.value))
val relaySyncPromises = getProp("RELAY_SYNC_PROMISES" , getSyncPromises)
val relaySyncSharedFiles = getProp("RELAY_SYNC_SHAREDFILES", getSyncSharedFiles)

val syslogProtocolDisabled = getProp("SYSLOG_PROTOCOL_DISABLED", getSyslogProtocolDisabled)

val rudderVerifyCertificates = getProp("RUDDER_VERIFY_CERTIFICATES", getRudderVerifyCertificates)

val varServerVersion = systemVariableSpecService.get("SERVER_VERSION").toVariable(Seq(serverVersion))
Expand All @@ -217,7 +210,6 @@ class SystemVariableServiceImpl(
varPolicyDistribHttpsPort ::
varWebdavUser ::
varWebdavPassword ::
syslogPortConfig ::
configurationRepositoryFolder ::
denyBadClocks ::
skipIdentify ::
Expand All @@ -228,8 +220,6 @@ class SystemVariableServiceImpl(
cfengineOutputsTtl ::
storeAllCentralizedLogsInFile ::
varSendMetrics ::
syslogProtocolDisabled ::
reportProtocol ::
rudderVerifyCertificates ::
varServerVersion ::
Nil
Expand Down Expand Up @@ -585,16 +575,14 @@ class SystemVariableServiceImpl(
// - agent is DSC < 6.1
val onlySyslogSupported = nodeInfo.agentsName.find { agent => versionHasSyslogOnly(agent.version, agent.agentType) }

getSyslogProtocolDisabled().flatMap { syslogDisabled => (syslogDisabled, onlySyslogSupported) match {
case (true , Some(agentInfo) ) =>
(onlySyslogSupported match {
case Some(agentInfo) =>
// If HTTPS is used on a node that does support it, we fails.
// Also, special case root, because not having root cause strange things.
if(nodeInfo.id == Constants.ROOT_POLICY_SERVER_ID) getReportProtocolDefault()
if(nodeInfo.id == Constants.ROOT_POLICY_SERVER_ID) Full(AgentReportingHTTPS)
else failure(nodeInfo, agentInfo)
case (true , None ) => Full(AgentReportingHTTPS)
case (false, Some(x)) => Full(AgentReportingSyslog)
case (false, None ) => getReportProtocolDefault()
} }.map { reportingProtocol =>
case None => Full(AgentReportingHTTPS)
}).map { reportingProtocol =>
val v = systemVariableSpecService.get("REPORTING_PROTOCOL").toVariable(Seq(reportingProtocol.value))
(v.spec.name, v)
}
Expand Down
Expand Up @@ -35,8 +35,7 @@ bundle common rudder_roles
"reports_disabled_mode" expression => strcmp("full-compliance", "reports-disabled");
"changes_only" expression => "changes_only_mode.!force_full_compliance";
"reports_disabled" expression => "reports_disabled_mode.!force_full_compliance";
"rudder_reporting_https" expression => strcmp("SYSLOG", "HTTPS");
"rsyslog_disabled" expression => strcmp("false", "true");
"rudder_reporting_https" expression => strcmp("HTTPS", "HTTPS");

"rudder_global_audit_mode" not => strcmp("audit", "enforce");

Expand Down Expand Up @@ -291,8 +290,6 @@ bundle agent check_log_system
"syslog_ng_conf_proto" string => "${syslogng_rule_prefix}";
"syslog_ng_conf_start" string => "(\"";
"syslog_ng_conf_port" string => "\" port (";
"syslog_ng_conf_portno" string => "514";
"syslog_ng_conf_suffix" string => "));};log {source(${syslog_ng_source});filter(f_local_rudder);destination(rudder_loghost);";
"syslog_ng_conf_final" string => "flags(final);};";

"syslog_ng_conf" string => concat("${syslog_conf_comment}", "${syslog_ng_conf_prefix}", "${syslog_ng_conf_proto}", "${syslog_ng_conf_start}", "${server_info.policy_server}", "${syslog_ng_conf_port}", "${syslog_ng_conf_portno}", "${syslog_ng_conf_suffix}", "${syslog_ng_conf_final}");
Expand All @@ -311,9 +308,6 @@ bundle agent check_log_system
"syslogng_conffile_present" expression => fileexists("${syslogng_conffile}"), scope => "namespace";
"syslogd_conffile_present" expression => fileexists("${syslog_conffile}"), scope => "namespace";

"use_udp" expression => strcmp("UDP", "UDP");
"use_tcp" expression => strcmp("UDP", "TCP");

"pass3" expression => "pass2";
"pass2" expression => "pass1";
"pass1" expression => "any";
Expand Down

Large diffs are not rendered by default.

Expand Up @@ -35,8 +35,7 @@ bundle common rudder_roles
"reports_disabled_mode" expression => strcmp("full-compliance", "reports-disabled");
"changes_only" expression => "changes_only_mode.!force_full_compliance";
"reports_disabled" expression => "reports_disabled_mode.!force_full_compliance";
"rudder_reporting_https" expression => strcmp("SYSLOG", "HTTPS");
"rsyslog_disabled" expression => strcmp("false", "true");
"rudder_reporting_https" expression => strcmp("HTTPS", "HTTPS");

"rudder_global_audit_mode" not => strcmp("audit", "enforce");

Expand Down Expand Up @@ -291,8 +290,6 @@ bundle agent check_log_system
"syslog_ng_conf_proto" string => "${syslogng_rule_prefix}";
"syslog_ng_conf_start" string => "(\"";
"syslog_ng_conf_port" string => "\" port (";
"syslog_ng_conf_portno" string => "514";
"syslog_ng_conf_suffix" string => "));};log {source(${syslog_ng_source});filter(f_local_rudder);destination(rudder_loghost);";
"syslog_ng_conf_final" string => "flags(final);};";

"syslog_ng_conf" string => concat("${syslog_conf_comment}", "${syslog_ng_conf_prefix}", "${syslog_ng_conf_proto}", "${syslog_ng_conf_start}", "${server_info.policy_server}", "${syslog_ng_conf_port}", "${syslog_ng_conf_portno}", "${syslog_ng_conf_suffix}", "${syslog_ng_conf_final}");
Expand All @@ -311,9 +308,6 @@ bundle agent check_log_system
"syslogng_conffile_present" expression => fileexists("${syslogng_conffile}"), scope => "namespace";
"syslogd_conffile_present" expression => fileexists("${syslog_conffile}"), scope => "namespace";

"use_udp" expression => strcmp("UDP", "UDP");
"use_tcp" expression => strcmp("UDP", "TCP");

"pass3" expression => "pass2";
"pass2" expression => "pass1";
"pass1" expression => "any";
Expand Down
Expand Up @@ -18,7 +18,7 @@
"RELAY_SYNC_METHOD":"classic",
"RELAY_SYNC_PROMISES":"false",
"RELAY_SYNC_SHAREDFILES":"false",
"REPORTING_PROTOCOL":"SYSLOG",
"REPORTING_PROTOCOL":"HTTPS",
"RUDDER_COMPLIANCE_MODE":"audit",
"RUDDER_DIRECTIVES_INPUTS":[
"\"Create_file/1.0/rudder_reporting.cf\",\n\"Create_file/1.0/Create_file.cf\",\n\"packageManagement/1.0/packageManagement.cf\","
Expand All @@ -30,7 +30,6 @@
"RUDDER_NODE_GROUPS_VARS":"\"by_uuid[special:all_exceptPolicyServers]\" string => \"special:all_exceptPolicyServers\",\n meta => { \"inventory\", \"attribute_name=rudder_groups\" };\n\"by_uuid[special:all]\" string => \"special:all\",\n meta => { \"inventory\", \"attribute_name=rudder_groups\" };",
"RUDDER_REPORT_MODE":"full-compliance",
"RUDDER_SERVER_ROLES":"",
"RUDDER_SYSLOG_PROTOCOL":"UDP",
"RUDDER_SYSTEM_DIRECTIVES_INPUTS":"\"common/1.0/common.cf\",\n\"common/1.0/cf-serverd.cf\",\n\"rudder-directives.cf\",\n\"rudder-system-directives.cf\",\n\"common/1.0/rudder-parameters.cf\",\n\"common/1.0/rudder-groups.cf\",\n\"common/1.0/hooks.cf\",\n\"common/1.0/cron-setup.cf\",\n\"common/1.0/site.cf\",\n\"common/1.0/update.cf\",\n\"common/1.0/monitoring.cf\",\n\"common/1.0/restart-services.cf\",\n\"common/1.0/internal-security.cf\",\n\"common/1.0/environment-variables.cf\",\n\"common/1.0/properties.cf\",\n\"common/1.0/reporting-http.cf\",\n\"inventory/1.0/fusionAgent.cf\",",
"RUDDER_SYSTEM_DIRECTIVES_SEQUENCE":" \"Rudder system policy: daily inventory/Inventory\" usebundle => set_dry_run_mode(\"false\");\n \"Rudder system policy: daily inventory/Inventory\" usebundle => run_inventory_all;",
"RUDDER_VERIFY_CERTIFICATES":"false",
Expand All @@ -39,7 +38,5 @@
"SHARED_FILES_FOLDER":"/var/rudder/configuration-repository/shared-files",
"SKIPIDENTIFY":"false",
"STORE_ALL_CENTRALIZED_LOGS_IN_FILE":"true",
"SYSLOGPORT":"514",
"SYSLOG_PROTOCOL_DISABLED":"false",
"TOOLS_FOLDER":"tools_folder"
}
Expand Up @@ -35,8 +35,7 @@ bundle common rudder_roles
"reports_disabled_mode" expression => strcmp("full-compliance", "reports-disabled");
"changes_only" expression => "changes_only_mode.!force_full_compliance";
"reports_disabled" expression => "reports_disabled_mode.!force_full_compliance";
"rudder_reporting_https" expression => strcmp("SYSLOG", "HTTPS");
"rsyslog_disabled" expression => strcmp("false", "true");
"rudder_reporting_https" expression => strcmp("HTTPS", "HTTPS");

"rudder_global_audit_mode" not => strcmp("audit", "enforce");

Expand Down Expand Up @@ -291,8 +290,6 @@ bundle agent check_log_system
"syslog_ng_conf_proto" string => "${syslogng_rule_prefix}";
"syslog_ng_conf_start" string => "(\"";
"syslog_ng_conf_port" string => "\" port (";
"syslog_ng_conf_portno" string => "514";
"syslog_ng_conf_suffix" string => "));};log {source(${syslog_ng_source});filter(f_local_rudder);destination(rudder_loghost);";
"syslog_ng_conf_final" string => "flags(final);};";

"syslog_ng_conf" string => concat("${syslog_conf_comment}", "${syslog_ng_conf_prefix}", "${syslog_ng_conf_proto}", "${syslog_ng_conf_start}", "${server_info.policy_server}", "${syslog_ng_conf_port}", "${syslog_ng_conf_portno}", "${syslog_ng_conf_suffix}", "${syslog_ng_conf_final}");
Expand All @@ -311,9 +308,6 @@ bundle agent check_log_system
"syslogng_conffile_present" expression => fileexists("${syslogng_conffile}"), scope => "namespace";
"syslogd_conffile_present" expression => fileexists("${syslog_conffile}"), scope => "namespace";

"use_udp" expression => strcmp("UDP", "UDP");
"use_tcp" expression => strcmp("UDP", "TCP");

"pass3" expression => "pass2";
"pass2" expression => "pass1";
"pass1" expression => "any";
Expand Down
Expand Up @@ -18,7 +18,7 @@
"RELAY_SYNC_METHOD":"classic",
"RELAY_SYNC_PROMISES":"false",
"RELAY_SYNC_SHAREDFILES":"false",
"REPORTING_PROTOCOL":"SYSLOG",
"REPORTING_PROTOCOL":"HTTPS",
"RUDDER_COMPLIANCE_MODE":"audit",
"RUDDER_DIRECTIVES_INPUTS":[
"\"genericVariableDefinition/2.0/genericVariableDefinition.cf\","
Expand All @@ -30,7 +30,6 @@
"RUDDER_NODE_GROUPS_VARS":"\"by_uuid[special:all_exceptPolicyServers]\" string => \"special:all_exceptPolicyServers\",\n meta => { \"inventory\", \"attribute_name=rudder_groups\" };\n\"by_uuid[special:all]\" string => \"special:all\",\n meta => { \"inventory\", \"attribute_name=rudder_groups\" };",
"RUDDER_REPORT_MODE":"full-compliance",
"RUDDER_SERVER_ROLES":"",
"RUDDER_SYSLOG_PROTOCOL":"UDP",
"RUDDER_SYSTEM_DIRECTIVES_INPUTS":"\"common/1.0/common.cf\",\n\"common/1.0/cf-serverd.cf\",\n\"rudder-directives.cf\",\n\"rudder-system-directives.cf\",\n\"common/1.0/rudder-parameters.cf\",\n\"common/1.0/rudder-groups.cf\",\n\"common/1.0/hooks.cf\",\n\"common/1.0/cron-setup.cf\",\n\"common/1.0/site.cf\",\n\"common/1.0/update.cf\",\n\"common/1.0/monitoring.cf\",\n\"common/1.0/restart-services.cf\",\n\"common/1.0/internal-security.cf\",\n\"common/1.0/environment-variables.cf\",\n\"common/1.0/properties.cf\",\n\"common/1.0/reporting-http.cf\",\n\"inventory/1.0/fusionAgent.cf\",",
"RUDDER_SYSTEM_DIRECTIVES_SEQUENCE":" \"Rudder system policy: daily inventory/Inventory\" usebundle => set_dry_run_mode(\"false\");\n \"Rudder system policy: daily inventory/Inventory\" usebundle => run_inventory_all;",
"RUDDER_VERIFY_CERTIFICATES":"false",
Expand All @@ -39,7 +38,5 @@
"SHARED_FILES_FOLDER":"/var/rudder/configuration-repository/shared-files",
"SKIPIDENTIFY":"false",
"STORE_ALL_CENTRALIZED_LOGS_IN_FILE":"true",
"SYSLOGPORT":"514",
"SYSLOG_PROTOCOL_DISABLED":"false",
"TOOLS_FOLDER":"tools_folder"
}

0 comments on commit 8af3979

Please sign in to comment.