Browse code

Shorten PKI token logging

Log only the first 12 characters of auth-token for the Swift
API, since PKI based auth-tokens from keystone can huge (>> 2K).

Also tidy up a comment.

Change-Id: Ib784e8ecdcb7e371fe03458c7fd82b4460fa82b9
Signed-off-by: Peter Portante <peter.portante@redhat.com>

Peter Portante authored on 2013/11/21 04:33:16
Showing 1 changed files
... ...
@@ -96,6 +96,13 @@ SWIFT_PARTITION_POWER_SIZE=${SWIFT_PARTITION_POWER_SIZE:-9}
96 96
 SWIFT_REPLICAS=${SWIFT_REPLICAS:-1}
97 97
 SWIFT_REPLICAS_SEQ=$(seq ${SWIFT_REPLICAS})
98 98
 
99
+# Set ``SWIFT_LOG_TOKEN_LENGTH`` to configure how many characters of an auth
100
+# token should be placed in the logs. When keystone is used with PKI tokens,
101
+# the token values can be huge, seemingly larger the 2K, at the least. We
102
+# restrict it here to a default of 12 characters, which should be enough to
103
+# trace through the logs when looking for its use.
104
+SWIFT_LOG_TOKEN_LENGTH=${SWIFT_LOG_TOKEN_LENGTH:-12}
105
+
99 106
 # Set ``OBJECT_PORT_BASE``, ``CONTAINER_PORT_BASE``, ``ACCOUNT_PORT_BASE``
100 107
 # Port bases used in port number calclution for the service "nodes"
101 108
 # The specified port number will be used, the additinal ports calculated by
... ...
@@ -281,6 +288,9 @@ function configure_swift() {
281 281
         SWIFT_EXTRAS_MIDDLEWARE_LAST="${SWIFT_EXTRAS_MIDDLEWARE_LAST} ceilometer"
282 282
     fi
283 283
 
284
+    # Restrict the length of auth tokens in the swift proxy-server logs.
285
+    iniset ${SWIFT_CONFIG_PROXY_SERVER} filter:proxy-logging reveal_sensitive_prefix ${SWIFT_LOG_TOKEN_LENGTH}
286
+
284 287
     # By default Swift will be installed with keystone and tempauth middleware
285 288
     # and add the swift3 middleware if its configured for it. The token for
286 289
     # tempauth would be prefixed with the reseller_prefix setting `TEMPAUTH_` the
... ...
@@ -336,7 +346,7 @@ EOF
336 336
     cp ${SWIFT_DIR}/etc/swift.conf-sample ${SWIFT_CONF_DIR}/swift.conf
337 337
     iniset ${SWIFT_CONF_DIR}/swift.conf swift-hash swift_hash_path_suffix ${SWIFT_HASH}
338 338
 
339
-    # This function generates an object/account/proxy configuration
339
+    # This function generates an object/container/account configuration
340 340
     # emulating 4 nodes on different ports
341 341
     function generate_swift_config() {
342 342
         local swift_node_config=$1