Skip to content

Commit 3e502a3

Browse files
authored
Mitigations for Log4J CVE-2021-44228 (#209)
* Fix for Log4J CVE-2021-44228 - Global environment variable. As noted in https://www.sentinelone.com/blog/cve-2021-44228-staying-secure-apache-log4j-vulnerability/ Setting the enviroment variable LOG4J_FORMAT_MSG_NO_LOOKUPS to true. * Update Solr version with Log4J update. * Directly remove Jndi lookup class from Log4j core JAR files. * DOn't run JNDI fix on Solr 8.11.1 * Ignore errors removing JNDI class from Solr i.e., already done.
1 parent f38625e commit 3e502a3

File tree

6 files changed

+38
-4
lines changed

6 files changed

+38
-4
lines changed

bootstrap.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,14 @@
8383
when: defaultdir_exists.stat.exists == true
8484
become: yes
8585

86+
- name: populate /etc/environment
87+
lineinfile:
88+
dest: "/etc/environment"
89+
state: present
90+
regexp: "^{{ item.key }}="
91+
line: "{{ item.key }}={{ item.value}}"
92+
with_items: "{{ os_environment }}"
93+
8694
# Include install profile-specific variables
8795
- name: include Drupal install profile specific variables
8896
include_vars: "vars/{{ islandora_profile }}.yml"

inventory/vagrant/group_vars/all/main.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,8 @@ mysql_users:
3939
# Used by both the webserver and crayfish role for CentOS.
4040
php_enablerepo: "remi-php72"
4141
php_packages_state: "latest"
42+
43+
# Log4j
44+
os_environment:
45+
- key: LOG4J_FORMAT_MSG_NO_LOOKUPS
46+
value: true

inventory/vagrant/group_vars/solr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#solr_version: "7.7.3"
1+
solr_version: "8.11.1"
22

33
solr_cores:
44
- ISLANDORA

requirements.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
version: 1.4.3
3030

3131
- src: geerlingguy.solr
32-
version: 5.2.0
32+
version: 5.3.0
3333

3434
- src: geerlingguy.java
3535
version: 1.10.0

roles/internal/Islandora-Devops.tomcat8/tasks/main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
- tomcat9
1212
- tomcat9-install
1313

14-
- include: config.yml
15-
static: no
14+
- include_tasks: config.yml
1615
tags:
1716
- tomcat9
1817
- tomcat9-config

solr.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,25 @@
7070
retries: 20
7171
delay: 3
7272
tags: solr
73+
74+
# Log4j December 2021 vulnurability fix.
75+
- name: Install zip command
76+
apt:
77+
name: "zip"
78+
state: present
79+
cache_valid_time: 3600
80+
81+
- name: Find any instances of vulnurable Log4J core JAR file
82+
command: "find / -name log4j-core-2.1[0,1,2,3,4,5].?.jar"
83+
register: log4j_jars
84+
changed_when: false
85+
until: files_to_copy is not failed
86+
retries: 5
87+
tags: solr
88+
89+
- name: Delete Log4J JNDI class from JARs
90+
command: "zip -q -d {{ item }} org/apache/logging/log4j/core/lookup/JndiLookup.class"
91+
with_items:
92+
- "{{ log4j_jars.stdout_lines }}"
93+
ignore_errors: yes
94+
tags: solr

0 commit comments

Comments
 (0)