summaryrefslogtreecommitdiffstats
path: root/remoting/host
diff options
context:
space:
mode:
authorskonig@chromium.org <skonig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-09 06:09:12 +0000
committerskonig@chromium.org <skonig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-09 06:09:12 +0000
commit4fbdf201cfd695d1a09e00c382e68f4884bce196 (patch)
treef1ef08b20a3480e35e71f4f96b1a6f33c1d8a308 /remoting/host
parente07a595018b0c09f2c53552f8627a20bf8de011f (diff)
downloadchromium_src-4fbdf201cfd695d1a09e00c382e68f4884bce196.zip
chromium_src-4fbdf201cfd695d1a09e00c382e68f4884bce196.tar.gz
chromium_src-4fbdf201cfd695d1a09e00c382e68f4884bce196.tar.bz2
Direct host output to a specific log file.
As of 10.8 if you don't specify a standard output/error destination file then output from the host service is not logged at all. This change modifies our host service .plist to specify a specific chromoting log file, ensures this log file is properly created when we install the host, adds a configuration for the newsyslog process (which will turnover/archive the log file once it goes >1MB), and removes the log file and newsyslog configuration in the uninstaller. It also adds some timestamps to the host startup script so that we can better identify log events. It also alphabetizes the strings in the .plist file. TEST=Manual (modified files, created install package, ran and uninstalled) BUG=171026 Review URL: https://chromiumcodereview.appspot.com/12213059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181605 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rw-r--r--remoting/host/constants_mac.cc5
-rw-r--r--remoting/host/constants_mac.h6
-rw-r--r--remoting/host/installer/mac/ChromotingHostService.pkgproj50
-rw-r--r--remoting/host/installer/mac/Config/org.chromium.chromoting.conf11
-rw-r--r--remoting/host/installer/mac/LaunchAgents/org.chromium.chromoting.plist12
-rwxr-xr-xremoting/host/installer/mac/PrivilegedHelperTools/org.chromium.chromoting.me2me.sh5
-rwxr-xr-xremoting/host/installer/mac/Scripts/remoting_postflight.sh9
-rw-r--r--remoting/host/installer/mac/uninstaller/remoting_uninstaller.mm2
8 files changed, 94 insertions, 6 deletions
diff --git a/remoting/host/constants_mac.cc b/remoting/host/constants_mac.cc
index 0e18b15..9b79384 100644
--- a/remoting/host/constants_mac.cc
+++ b/remoting/host/constants_mac.cc
@@ -12,6 +12,8 @@ namespace remoting {
#define HELPER_TOOLS_DIR "/Library/PrivilegedHelperTools/"
#define LAUNCH_AGENTS_DIR "/Library/LaunchAgents/"
#define PREFERENCE_PANES_DIR "/Library/PreferencePanes/"
+#define LOG_DIR "/var/log/"
+#define LOG_CONFIG_DIR "/etc/newsyslog.d/"
const char kServiceName[] = SERVICE_NAME;
@@ -31,6 +33,9 @@ const char kHostEnabledPath[] = HELPER_TOOLS_DIR SERVICE_NAME ".me2me_enabled";
const char kServicePlistPath[] = LAUNCH_AGENTS_DIR SERVICE_NAME ".plist";
+const char kLogFilePath[] = LOG_DIR SERVICE_NAME ".log";
+const char kLogFileConfigPath[] = LOG_CONFIG_DIR SERVICE_NAME ".conf";
+
const char kBrandedUninstallerPath[] = APPLICATIONS_DIR
"Chrome Remote Desktop Host Uninstaller.app";
const char kUnbrandedUninstallerPath[] = APPLICATIONS_DIR
diff --git a/remoting/host/constants_mac.h b/remoting/host/constants_mac.h
index 4c4ebf2..ac288e5 100644
--- a/remoting/host/constants_mac.h
+++ b/remoting/host/constants_mac.h
@@ -46,6 +46,12 @@ extern const char kHostEnabledPath[];
// The .plist file for the Chromoting service.
extern const char kServicePlistPath[];
+// Path to the host log file
+extern const char kLogFilePath[];
+
+// Path to the log config file
+extern const char kLogFileConfigPath[];
+
// The branded and unbranded names for the uninstaller.
// This is the only file that changes names based on branding. We define both
// because we want local dev builds to be able to clean up both files.
diff --git a/remoting/host/installer/mac/ChromotingHostService.pkgproj b/remoting/host/installer/mac/ChromotingHostService.pkgproj
index 28717bb..bc036f8 100644
--- a/remoting/host/installer/mac/ChromotingHostService.pkgproj
+++ b/remoting/host/installer/mac/ChromotingHostService.pkgproj
@@ -50,6 +50,56 @@
<array>
<dict>
<key>CHILDREN</key>
+ <array>
+ <dict>
+ <key>CHILDREN</key>
+ <array/>
+ <key>GID</key>
+ <integer>80</integer>
+ <key>PATH</key>
+ <string>Config/org.chromium.chromoting.conf</string>
+ <key>PATH_TYPE</key>
+ <integer>1</integer>
+ <key>PERMISSIONS</key>
+ <integer>436</integer>
+ <key>TYPE</key>
+ <integer>3</integer>
+ <key>UID</key>
+ <integer>0</integer>
+ </dict>
+ </array>
+ <key>GID</key>
+ <integer>0</integer>
+ <key>PATH</key>
+ <string>newsyslog.d</string>
+ <key>PATH_TYPE</key>
+ <integer>0</integer>
+ <key>PERMISSIONS</key>
+ <integer>493</integer>
+ <key>TYPE</key>
+ <integer>2</integer>
+ <key>UID</key>
+ <integer>0</integer>
+ </dict>
+ </array>
+ <key>GID</key>
+ <integer>0</integer>
+ <key>PATH</key>
+ <string>etc</string>
+ <key>PATH_TYPE</key>
+ <integer>0</integer>
+ <key>PERMISSIONS</key>
+ <integer>493</integer>
+ <key>TYPE</key>
+ <integer>2</integer>
+ <key>UID</key>
+ <integer>0</integer>
+ </dict>
+ <dict>
+ <key>CHILDREN</key>
+ <array>
+ <dict>
+ <key>CHILDREN</key>
<array/>
<key>GID</key>
<integer>80</integer>
diff --git a/remoting/host/installer/mac/Config/org.chromium.chromoting.conf b/remoting/host/installer/mac/Config/org.chromium.chromoting.conf
new file mode 100644
index 0000000..191408b
--- /dev/null
+++ b/remoting/host/installer/mac/Config/org.chromium.chromoting.conf
@@ -0,0 +1,11 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This file instructs the newsyslog process to clean up the Chrome Remote
+# Desktop log file by archiving it after it reaches 1MB in size. It will
+# retain up to five older compressed copies before deleting. See the manual
+# page for newsyslog.conf for more information.
+
+# logfilename [owner:group] mode count size when flags [/pid_file] [sig_num]
+/var/log/org.chromium.chromoting.log root:admin 660 3 1000 * J
diff --git a/remoting/host/installer/mac/LaunchAgents/org.chromium.chromoting.plist b/remoting/host/installer/mac/LaunchAgents/org.chromium.chromoting.plist
index 3831649..184d6f4 100644
--- a/remoting/host/installer/mac/LaunchAgents/org.chromium.chromoting.plist
+++ b/remoting/host/installer/mac/LaunchAgents/org.chromium.chromoting.plist
@@ -2,6 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
+ <key>Disabled</key>
+ <false/>
<key>Label</key>
<string>org.chromium.chromoting</string>
<key>LimitLoadToSessionType</key>
@@ -9,14 +11,16 @@
<string>Aqua</string>
<string>LoginWindow</string>
</array>
- <key>RunAtLoad</key>
- <true/>
- <key>Disabled</key>
- <false/>
<key>ProgramArguments</key>
<array>
<string>/Library/PrivilegedHelperTools/org.chromium.chromoting.me2me.sh</string>
<string>--run-from-launchd</string>
</array>
+ <key>RunAtLoad</key>
+ <true/>
+ <key>StandardErrorPath</key>
+ <string>/var/log/org.chromium.chromoting.log</string>
+ <key>StandardOutPath</key>
+ <string>/var/log/org.chromium.chromoting.log</string>
</dict>
</plist>
diff --git a/remoting/host/installer/mac/PrivilegedHelperTools/org.chromium.chromoting.me2me.sh b/remoting/host/installer/mac/PrivilegedHelperTools/org.chromium.chromoting.me2me.sh
index 338319d..bc3ceec 100755
--- a/remoting/host/installer/mac/PrivilegedHelperTools/org.chromium.chromoting.me2me.sh
+++ b/remoting/host/installer/mac/PrivilegedHelperTools/org.chromium.chromoting.me2me.sh
@@ -101,7 +101,7 @@ run_host() {
"$EXIT_CODE" -eq "$PERMISSION_DENIED_PARENTAL_CONTROL" ||
("$EXIT_CODE" -ge "$MIN_PERMANENT_ERROR_EXIT_CODE" && \
"$EXIT_CODE" -le "$MAX_PERMANENT_ERROR_EXIT_CODE") ]]; then
- echo "Host returned permanent exit code $EXIT_CODE"
+ echo "Host returned permanent exit code $EXIT_CODE at ""$(date)"""
if [[ "$EXIT_CODE" -eq 101 ]]; then
# Exit code 101 is "hostID deleted", which indicates that the host
# was taken off-line remotely. To prevent the host being restarted
@@ -118,7 +118,7 @@ run_host() {
# signals temporarily in case the script has to sleep to throttle host
# relaunches. While throttling, there is no host process to which to
# forward the signal, so the default behaviour should be restored.
- echo "Host returned non-permanent exit code $EXIT_CODE"
+ echo "Host returned non-permanent exit code $EXIT_CODE at ""$(date)"""
trap - $SIGNAL_LIST
HOST_PID=0
break
@@ -153,6 +153,7 @@ elif [[ "$1" = "--relaunch-prefpane" ]]; then
cat 2>/dev/null || true
open "$PREF_PANE_BUNDLE"
elif [[ "$1" = "--run-from-launchd" ]]; then
+ echo Host started for user $USER at $"$(date)"
run_host
else
echo $$
diff --git a/remoting/host/installer/mac/Scripts/remoting_postflight.sh b/remoting/host/installer/mac/Scripts/remoting_postflight.sh
index 10ad3a6..325da02 100755
--- a/remoting/host/installer/mac/Scripts/remoting_postflight.sh
+++ b/remoting/host/installer/mac/Scripts/remoting_postflight.sh
@@ -13,6 +13,7 @@ PLIST=/Library/LaunchAgents/org.chromium.chromoting.plist
PAM_CONFIG=/etc/pam.d/chrome-remote-desktop
ENABLED_FILE="$HELPERTOOLS/$NAME.me2me_enabled"
ENABLED_FILE_BACKUP="$ENABLED_FILE.backup"
+LOG_FILE=/var/log/org.chromium.chromoting.log
KSADMIN=/Library/Google/GoogleSoftwareUpdate/GoogleSoftwareUpdate.bundle/Contents/MacOS/ksadmin
KSUPDATE=https://tools.google.com/service/update2
@@ -63,6 +64,14 @@ else
logger PAM config has local edits. Not updating.
fi
+# Create the log file (if this isn't created ahead of time
+# then directing output from the service there won't work).
+# Make sure admins have write privileges (CRD users are
+# typically admins)
+touch "$LOG_FILE"
+chown :admin "$LOG_FILE"
+chmod 660 "$LOG_FILE"
+
# Load the service.
# The launchctl command we'd like to run:
# launchctl load -w -S Aqua $PLIST
diff --git a/remoting/host/installer/mac/uninstaller/remoting_uninstaller.mm b/remoting/host/installer/mac/uninstaller/remoting_uninstaller.mm
index 2c37541..d09702e 100644
--- a/remoting/host/installer/mac/uninstaller/remoting_uninstaller.mm
+++ b/remoting/host/installer/mac/uninstaller/remoting_uninstaller.mm
@@ -140,6 +140,8 @@ const char kKeystonePID[] = "com.google.chrome_remote_desktop";
[self sudoDelete:remoting::kHostHelperScriptPath usingAuth:authRef];
[self sudoDelete:remoting::kHostConfigFilePath usingAuth:authRef];
[self sudoDelete:remoting::kPrefPaneFilePath usingAuth:authRef];
+ [self sudoDelete:remoting::kLogFilePath usingAuth:authRef];
+ [self sudoDelete:remoting::kLogFileConfigPath usingAuth:authRef];
[self sudoDelete:remoting::kBrandedUninstallerPath usingAuth:authRef];
[self sudoDelete:remoting::kUnbrandedUninstallerPath usingAuth:authRef];