Skip to content

Commit c0aa79e

Browse files
mshuleraweisberg
authored andcommitted
CVE-2017-5929 Security vulnerability and redefine default log rotation policy.
Patch by Michael Shuler; Reviewed by Ariel Weisberg for CASSANDRA-14183
1 parent 44ce953 commit c0aa79e

File tree

11 files changed

+39
-21
lines changed

11 files changed

+39
-21
lines changed

CHANGES.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
4.0
2+
* CVE-2017-5929 Security vulnerability and redefine default log rotation policy (CASSANDRA-14183)
23
* Use JVM default SSL validation algorithm instead of custom default (CASSANDRA-13259)
34
* Better document in code InetAddressAndPort usage post 7544, incorporate port into UUIDGen node (CASSANDRA-14226)
45
* Fix sstablemetadata date string for minLocalDeletionTime (CASSANDRA-14132)

build.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,8 +383,8 @@
383383
<dependency groupId="org.slf4j" artifactId="slf4j-api" version="1.7.25"/>
384384
<dependency groupId="org.slf4j" artifactId="log4j-over-slf4j" version="1.7.25"/>
385385
<dependency groupId="org.slf4j" artifactId="jcl-over-slf4j" version="1.7.25" />
386-
<dependency groupId="ch.qos.logback" artifactId="logback-core" version="1.1.3"/>
387-
<dependency groupId="ch.qos.logback" artifactId="logback-classic" version="1.1.3"/>
386+
<dependency groupId="ch.qos.logback" artifactId="logback-core" version="1.2.3"/>
387+
<dependency groupId="ch.qos.logback" artifactId="logback-classic" version="1.2.3"/>
388388
<dependency groupId="org.codehaus.jackson" artifactId="jackson-core-asl" version="1.9.2"/>
389389
<dependency groupId="org.codehaus.jackson" artifactId="jackson-mapper-asl" version="1.9.2"/>
390390
<dependency groupId="com.googlecode.json-simple" artifactId="json-simple" version="1.1"/>

conf/logback.xml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ In order to disable debug.log, comment-out the ASYNCDEBUGLOG
2222
appender reference in the root level section below.
2323
-->
2424

25-
<configuration scan="true">
25+
<configuration scan="true" scanPeriod="60 seconds">
2626
<jmxConfigurator />
2727

2828
<!-- No shutdown hook; we run it ourselves in StorageService after shutdown -->
@@ -34,14 +34,14 @@ appender reference in the root level section below.
3434
<level>INFO</level>
3535
</filter>
3636
<file>${cassandra.logdir}/system.log</file>
37-
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
38-
<fileNamePattern>${cassandra.logdir}/system.log.%i.zip</fileNamePattern>
39-
<minIndex>1</minIndex>
40-
<maxIndex>20</maxIndex>
37+
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
38+
<!-- rollover daily -->
39+
<fileNamePattern>${cassandra.logdir}/system.log.%d{yyyy-MM-dd}.%i.zip</fileNamePattern>
40+
<!-- each file should be at most 50MB, keep 7 days worth of history, but at most 5GB -->
41+
<maxFileSize>50MB</maxFileSize>
42+
<maxHistory>7</maxHistory>
43+
<totalSizeCap>5GB</totalSizeCap>
4144
</rollingPolicy>
42-
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
43-
<maxFileSize>20MB</maxFileSize>
44-
</triggeringPolicy>
4545
<encoder>
4646
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
4747
</encoder>
@@ -51,14 +51,14 @@ appender reference in the root level section below.
5151

5252
<appender name="DEBUGLOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
5353
<file>${cassandra.logdir}/debug.log</file>
54-
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
55-
<fileNamePattern>${cassandra.logdir}/debug.log.%i.zip</fileNamePattern>
56-
<minIndex>1</minIndex>
57-
<maxIndex>20</maxIndex>
54+
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
55+
<!-- rollover daily -->
56+
<fileNamePattern>${cassandra.logdir}/debug.log.%d{yyyy-MM-dd}.%i.zip</fileNamePattern>
57+
<!-- each file should be at most 50MB, keep 7 days worth of history, but at most 5GB -->
58+
<maxFileSize>50MB</maxFileSize>
59+
<maxHistory>7</maxHistory>
60+
<totalSizeCap>5GB</totalSizeCap>
5861
</rollingPolicy>
59-
<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
60-
<maxFileSize>20MB</maxFileSize>
61-
</triggeringPolicy>
6262
<encoder>
6363
<pattern>%-5level [%thread] %date{ISO8601} %F:%L - %msg%n</pattern>
6464
</encoder>

lib/logback-classic-1.1.3.jar

-274 KB
Binary file not shown.

lib/logback-classic-1.2.3.jar

284 KB
Binary file not shown.

lib/logback-core-1.1.3.jar

-444 KB
Binary file not shown.

lib/logback-core-1.2.3.jar

461 KB
Binary file not shown.

src/java/org/apache/cassandra/cql3/functions/ThreadAwareSecurityManager.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ public static void install()
8888
// To work around this, a custom ReconfigureOnChangeFilter is installed, that simply
8989
// prevents this configuration file check and possible reload of the configration,
9090
// while executing sandboxed UDF code.
91+
//
92+
// NOTE: this is obsolte with logback versions (at least since 1.2.3)
9193
Logger l = LoggerFactory.getLogger(ThreadAwareSecurityManager.class);
9294
ch.qos.logback.classic.Logger logbackLogger = (ch.qos.logback.classic.Logger) l;
9395
LoggerContext ctx = logbackLogger.getLoggerContext();
@@ -110,6 +112,9 @@ public static void install()
110112
/**
111113
* The purpose of this class is to prevent logback from checking for config file change,
112114
* if the current thread is executing a sandboxed thread to avoid {@link AccessControlException}s.
115+
*
116+
* This is obsolete with logback versions that replaced {@link ReconfigureOnChangeFilter}
117+
* with {@link ch.qos.logback.classic.joran.ReconfigureOnChangeTask} (at least logback since 1.2.3).
113118
*/
114119
private static class SMAwareReconfigureOnChangeFilter extends ReconfigureOnChangeFilter
115120
{

test/conf/logback-test.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
under the License.
1818
-->
1919

20-
<configuration debug="false" scan="true">
20+
<configuration debug="false" scan="true" scanPeriod="60 seconds">
2121
<!-- Shutdown hook ensures that async appender flushes -->
2222
<shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
2323

test/unit/org/apache/cassandra/config/DatabaseDescriptorRefTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ protected Class<?> findClass(String name) throws ClassNotFoundException
218218
method.invoke(null);
219219

220220
if ("clientInitialization".equals(methodName) &&
221-
threadCount + 1 == threads.getThreadCount())
221+
threadCount + 2 == threads.getThreadCount())
222222
{
223-
// ignore the "AsyncAppender-Worker-ASYNC" thread
224-
threadCount++;
223+
// ignore the "AsyncAppender-Worker-ASYNC" and "logback-1" threads
224+
threadCount = threadCount + 2;
225225
}
226226

227227
if (threadCount != threads.getThreadCount())

0 commit comments

Comments
 (0)