OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 set -e | 7 set -e |
8 | 8 |
9 # Product ID in crash report | 9 # Product ID in crash report |
10 CHROMEOS_PRODUCT=ChromeOS | 10 CHROMEOS_PRODUCT=ChromeOS |
(...skipping 28 matching lines...) Expand all Loading... |
39 | 39 |
40 # File whose existence mocks crash sending. If empty we pretend the | 40 # File whose existence mocks crash sending. If empty we pretend the |
41 # crash sending was successful, otherwise unsuccessful. | 41 # crash sending was successful, otherwise unsuccessful. |
42 MOCK_CRASH_SENDING="/tmp/mock-crash-sending" | 42 MOCK_CRASH_SENDING="/tmp/mock-crash-sending" |
43 | 43 |
44 # File whose existence causes crash sending to be delayed (for testing). | 44 # File whose existence causes crash sending to be delayed (for testing). |
45 # Must be stateful to enable testing kernel crashes. | 45 # Must be stateful to enable testing kernel crashes. |
46 PAUSE_CRASH_SENDING="/var/lib/crash_sender_paused" | 46 PAUSE_CRASH_SENDING="/var/lib/crash_sender_paused" |
47 | 47 |
48 # URL to send official build crash reports to. | 48 # URL to send official build crash reports to. |
49 REPORT_UPLOAD_PROD_URL="http://clients2.google.com/cr/report" | 49 REPORT_UPLOAD_PROD_URL="https://clients2.google.com/cr/report" |
50 | 50 |
51 # File whose existence implies we're running and not to start again. | 51 # File whose existence implies we're running and not to start again. |
52 RUN_FILE="/var/run/crash_sender.pid" | 52 RUN_FILE="/var/run/crash_sender.pid" |
53 | 53 |
54 # Maximum time to sleep between sends. | 54 # Maximum time to sleep between sends. |
55 SECONDS_SEND_SPREAD=${SECONDS_SEND_SPREAD:-600} | 55 SECONDS_SEND_SPREAD=${SECONDS_SEND_SPREAD:-600} |
56 | 56 |
57 # The syslog tag for all logging we emit. | 57 # The syslog tag for all logging we emit. |
58 TAG="$(basename $0)[$$]" | 58 TAG="$(basename $0)[$$]" |
59 | 59 |
60 # Directory to store timestamp files indicating the uploads in the past 24 | 60 # Directory to store timestamp files indicating the uploads in the past 24 |
61 # hours. | 61 # hours. |
62 TIMESTAMPS_DIR="/var/lib/crash_sender" | 62 TIMESTAMPS_DIR="/var/lib/crash_sender" |
63 | 63 |
| 64 # Path to a directory of restricted certificates which includes |
| 65 # a certificate for ${REPORT_UPLOAD_PROD_URL}. |
| 66 RESTRICTED_CERTIFICATES_PATH="/usr/share/chromeos-ca-certificates" |
| 67 |
64 # Temp directory for this process. | 68 # Temp directory for this process. |
65 TMP_DIR="" | 69 TMP_DIR="" |
66 | 70 |
67 lecho() { | 71 lecho() { |
68 logger -t "${TAG}" "$@" | 72 logger -t "${TAG}" "$@" |
69 } | 73 } |
70 | 74 |
71 # Returns true if mock is enabled. | 75 # Returns true if mock is enabled. |
72 is_mock() { | 76 is_mock() { |
73 [ -f "${MOCK_CRASH_SENDING}" ] && return 0 | 77 [ -f "${MOCK_CRASH_SENDING}" ] && return 0 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 if ! sleep ${sleep_time}; then | 251 if ! sleep ${sleep_time}; then |
248 lecho "Sleep failed" | 252 lecho "Sleep failed" |
249 return 1 | 253 return 1 |
250 fi | 254 fi |
251 | 255 |
252 local report_id="${TMP_DIR}/report_id" | 256 local report_id="${TMP_DIR}/report_id" |
253 local curl_stderr="${TMP_DIR}/curl_stderr" | 257 local curl_stderr="${TMP_DIR}/curl_stderr" |
254 | 258 |
255 set +e | 259 set +e |
256 curl "${url}" \ | 260 curl "${url}" \ |
| 261 --capath "${RESTRICTED_CERTIFICATES_PATH}" --ciphers HIGH \ |
257 -F "prod=${CHROMEOS_PRODUCT}" \ | 262 -F "prod=${CHROMEOS_PRODUCT}" \ |
258 -F "ver=${chromeos_version}" \ | 263 -F "ver=${chromeos_version}" \ |
259 -F "upload_file_${kind}=@${report_payload}" \ | 264 -F "upload_file_${kind}=@${report_payload}" \ |
260 -F "board=${board}" \ | 265 -F "board=${board}" \ |
261 -F "hwclass=${hwclass}" \ | 266 -F "hwclass=${hwclass}" \ |
262 -F "exec_name=${exec_name}" \ | 267 -F "exec_name=${exec_name}" \ |
263 -F "${extra_key1}=${extra_value1}" \ | 268 -F "${extra_key1}=${extra_value1}" \ |
264 -F "${extra_key2}=${extra_value2}" \ | 269 -F "${extra_key2}=${extra_value2}" \ |
265 -F "guid=<${CONSENT_ID}" -o "${report_id}" 2>"${curl_stderr}" | 270 -F "guid=<${CONSENT_ID}" -o "${report_id}" 2>"${curl_stderr}" |
266 curl_result=$? | 271 curl_result=$? |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 main() { | 380 main() { |
376 trap cleanup EXIT INT TERM | 381 trap cleanup EXIT INT TERM |
377 if [ -e "${PAUSE_CRASH_SENDING}" ] && \ | 382 if [ -e "${PAUSE_CRASH_SENDING}" ] && \ |
378 [ ${OVERRIDE_PAUSE_SENDING} -eq 0 ]; then | 383 [ ${OVERRIDE_PAUSE_SENDING} -eq 0 ]; then |
379 lecho "Exiting early due to ${PAUSE_CRASH_SENDING}." | 384 lecho "Exiting early due to ${PAUSE_CRASH_SENDING}." |
380 exit 1 | 385 exit 1 |
381 fi | 386 fi |
382 | 387 |
383 check_not_already_running | 388 check_not_already_running |
384 | 389 |
385 for dependency in "${FIND}" "${METRICS_CLIENT}"; do | 390 for dependency in "${FIND}" "${METRICS_CLIENT}" \ |
| 391 "${RESTRICTED_CERTIFICATES_PATH}"; do |
386 if [ ! -x "${dependency}" ]; then | 392 if [ ! -x "${dependency}" ]; then |
387 lecho "Fatal: Crash sending disabled: ${dependency} not found." | 393 lecho "Fatal: Crash sending disabled: ${dependency} not found." |
388 exit 1 | 394 exit 1 |
389 fi | 395 fi |
390 done | 396 done |
391 | 397 |
392 TMP_DIR="$(mktemp -d /tmp/crash_sender.XXXX)" | 398 TMP_DIR="$(mktemp -d /tmp/crash_sender.XXXX)" |
393 | 399 |
394 # Send system-wide crashes | 400 # Send system-wide crashes |
395 send_crashes "/var/spool/crash" | 401 send_crashes "/var/spool/crash" |
396 | 402 |
397 # Send user-specific crashes | 403 # Send user-specific crashes |
398 send_crashes "/home/chronos/user/crash" | 404 send_crashes "/home/chronos/user/crash" |
399 } | 405 } |
400 | 406 |
401 main | 407 main |
OLD | NEW |