Skip to content
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

Enable SCC access logging if scc_access_logging variable is set #1519

Merged
merged 13 commits into from
Mar 4, 2024
1 change: 1 addition & 0 deletions modules/server/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ module "server" {
java_salt_debugging = var.java_salt_debugging
skip_changelog_import = var.skip_changelog_import
create_first_user = var.create_first_user
scc_access_logging = var.scc_access_logging
mgr_sync_autologin = var.mgr_sync_autologin
create_sample_channel = var.create_sample_channel
create_sample_activation_key = var.create_sample_activation_key
Expand Down
5 changes: 5 additions & 0 deletions modules/server/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,11 @@ variable "traceback_email" {
default = null
}

variable "scc_access_logging" {
description = "enable logging for SCC access through taskomatic and tomcat"
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
default = true
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
}

variable "swap_file_size" {
description = "Swap file size in MiB, or 0 for none"
default = 0
Expand Down
1 change: 1 addition & 0 deletions modules/server_containerized/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ module "server_containerized" {
database_disk_size = var.database_disk_size
skip_changelog_import = var.skip_changelog_import
create_first_user = var.create_first_user
scc_access_logging = var.scc_access_logging
mgr_sync_autologin = var.mgr_sync_autologin
create_sample_channel = var.create_sample_channel
create_sample_activation_key = var.create_sample_activation_key
Expand Down
5 changes: 5 additions & 0 deletions modules/server_containerized/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ variable "traceback_email" {
default = null
}

variable "scc_access_logging" {
description = "enable logging for SCC access through taskomatic and tomcat"
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
default = true
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
}

variable "smt" {
description = "URL to an SMT server to get packages from"
default = null
Expand Down
14 changes: 13 additions & 1 deletion salt/server/taskomatic.sls
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% if grains.get('java_debugging') or grains.get('java_hibernate_debugging') %}
include:
- server
{% if grains.get('java_debugging') or grains.get('java_hibernate_debugging') %}
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
- server.rhn
{% endif %}

Expand Down Expand Up @@ -33,6 +34,17 @@ taskomatic_hibernate_debug_log:
- sls: server.rhn
{% endif %}

{% if grains.get('scc_access_logging') %}
taskomatic_scc_access_logging:
file.line:
- name: /usr/share/rhn/classes/log4j2.xml
- content: ' <Logger name="com.suse.scc.client.SCCWebClient" level="info" />'
- after: "<Loggers>"
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
- mode: ensure
- require:
- sls: server
{% endif %}
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved

taskomatic:
service.running:
- watch:
Expand Down
18 changes: 17 additions & 1 deletion salt/server/tomcat.sls
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{% if grains.get('java_debugging') or grains.get('java_salt_debugging') %}
include:
- server
{% if grains.get('java_debugging') or grains.get('java_salt_debugging') %}
- server.rhn
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
{% endif %}

Expand Down Expand Up @@ -32,6 +33,21 @@ salt_server_action_service_debug_log:
- sls: server.rhn
{% endif %}

{% if grains.get('scc_access_logging') %}
{% set tomcat_log4j2_xml_path = "/usr/share/susemanager/www/tomcat/webapps/rhn/WEB-INF/classes/log4j2.xml" %}
{% if __salt__["file.exists"]("/srv/tomcat/webapps/rhn/WEB-INF/classes/log4j2.xml") %}
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
set tomcat_log4j2_xml_path = "/srv/tomcat/webapps/rhn/WEB-INF/classes/log4j2.xml"
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
{% endif %}
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
tomcat_scc_access_logging:
file.line:
- name: {{tomcat_log4j2_xml_path}}
- content: ' <Logger name="com.suse.scc.client.SCCWebClient" level="info" />'
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
- after: "<Loggers>"
- mode: ensure
- require:
- sls: server
{% endif %}
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved

{% if grains.get('login_timeout') %}
extend_tomcat_login_timeout:
file.replace:
Expand Down
4 changes: 4 additions & 0 deletions salt/server_containerized/init.sls
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,7 @@ include:
- server_containerized.initial_content
- server_containerized.testsuite
- server_containerized.large_deployment
{% if grains.get('scc_access_logging') %}
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
- server_containerized.taskomatic
- server_containerized.tomcat
{% endif %}
11 changes: 11 additions & 0 deletions salt/server_containerized/taskomatic.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include:
- server_containerized
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved

taskomatic_scc_access_logging:
file.line:
- name: /usr/share/rhn/classes/log4j2.xml
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
- content: ' <Logger name="com.suse.scc.client.SCCWebClient" level="info" />'
- after: "<Loggers>"
- mode: ensure
- require:
- sls: server_containerized
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
11 changes: 11 additions & 0 deletions salt/server_containerized/tomcat.sls
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
include:
- server_containerized
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved

tomcat_scc_access_logging:
file.line:
- name: /usr/share/susemanager/www/tomcat/webapps/rhn/WEB-INF/classes/log4j2.xml
mtravitzky marked this conversation as resolved.
Show resolved Hide resolved
- content: ' <Logger name="com.suse.scc.client.SCCWebClient" level="info" />'
- after: "<Loggers>"
- mode: ensure
- require:
- sls: server_containerized
Loading