OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // This file implements a standalone host process for Me2Me. | 5 // This file implements a standalone host process for Me2Me. |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 #include "remoting/host/host_status_logger.h" | 65 #include "remoting/host/host_status_logger.h" |
66 #include "remoting/host/input_injector.h" | 66 #include "remoting/host/input_injector.h" |
67 #include "remoting/host/ipc_desktop_environment.h" | 67 #include "remoting/host/ipc_desktop_environment.h" |
68 #include "remoting/host/ipc_host_event_logger.h" | 68 #include "remoting/host/ipc_host_event_logger.h" |
69 #include "remoting/host/logging.h" | 69 #include "remoting/host/logging.h" |
70 #include "remoting/host/me2me_desktop_environment.h" | 70 #include "remoting/host/me2me_desktop_environment.h" |
71 #include "remoting/host/oauth_token_getter_impl.h" | 71 #include "remoting/host/oauth_token_getter_impl.h" |
72 #include "remoting/host/pairing_registry_delegate.h" | 72 #include "remoting/host/pairing_registry_delegate.h" |
73 #include "remoting/host/pin_hash.h" | 73 #include "remoting/host/pin_hash.h" |
74 #include "remoting/host/policy_watcher.h" | 74 #include "remoting/host/policy_watcher.h" |
75 #include "remoting/host/security_key/gnubby_auth_handler.h" | 75 #include "remoting/host/security_key/security_key_auth_handler.h" |
76 #include "remoting/host/security_key/gnubby_extension.h" | 76 #include "remoting/host/security_key/security_key_extension.h" |
77 #include "remoting/host/service_urls.h" | 77 #include "remoting/host/service_urls.h" |
78 #include "remoting/host/shutdown_watchdog.h" | 78 #include "remoting/host/shutdown_watchdog.h" |
79 #include "remoting/host/signaling_connector.h" | 79 #include "remoting/host/signaling_connector.h" |
80 #include "remoting/host/single_window_desktop_environment.h" | 80 #include "remoting/host/single_window_desktop_environment.h" |
81 #include "remoting/host/switches.h" | 81 #include "remoting/host/switches.h" |
82 #include "remoting/host/third_party_auth_config.h" | 82 #include "remoting/host/third_party_auth_config.h" |
83 #include "remoting/host/token_validator_factory_impl.h" | 83 #include "remoting/host/token_validator_factory_impl.h" |
84 #include "remoting/host/usage_stats_consent.h" | 84 #include "remoting/host/usage_stats_consent.h" |
85 #include "remoting/host/username.h" | 85 #include "remoting/host/username.h" |
86 #include "remoting/protocol/authenticator.h" | 86 #include "remoting/protocol/authenticator.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 // from stdin. | 144 // from stdin. |
145 const char kStdinConfigPath[] = "-"; | 145 const char kStdinConfigPath[] = "-"; |
146 #endif // !defined(REMOTING_MULTI_PROCESS) | 146 #endif // !defined(REMOTING_MULTI_PROCESS) |
147 | 147 |
148 #if defined(OS_LINUX) | 148 #if defined(OS_LINUX) |
149 // The command line switch used to pass name of the pipe to capture audio on | 149 // The command line switch used to pass name of the pipe to capture audio on |
150 // linux. | 150 // linux. |
151 const char kAudioPipeSwitchName[] = "audio-pipe-name"; | 151 const char kAudioPipeSwitchName[] = "audio-pipe-name"; |
152 | 152 |
153 // The command line switch used to pass name of the unix domain socket used to | 153 // The command line switch used to pass name of the unix domain socket used to |
154 // listen for gnubby requests. | 154 // listen for security key requests. |
155 const char kAuthSocknameSwitchName[] = "ssh-auth-sockname"; | 155 const char kAuthSocknameSwitchName[] = "ssh-auth-sockname"; |
156 #endif // defined(OS_LINUX) | 156 #endif // defined(OS_LINUX) |
157 | 157 |
158 // The command line switch used by the parent to request the host to signal it | 158 // The command line switch used by the parent to request the host to signal it |
159 // when it is successfully started. | 159 // when it is successfully started. |
160 const char kSignalParentSwitchName[] = "signal-parent"; | 160 const char kSignalParentSwitchName[] = "signal-parent"; |
161 | 161 |
162 // Command line switch used to enable VP9 encoding. | 162 // Command line switch used to enable VP9 encoding. |
163 const char kEnableVp9SwitchName[] = "enable-vp9"; | 163 const char kEnableVp9SwitchName[] = "enable-vp9"; |
164 | 164 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 std::string host_domain_; | 367 std::string host_domain_; |
368 bool host_username_match_required_ = false; | 368 bool host_username_match_required_ = false; |
369 bool allow_nat_traversal_ = true; | 369 bool allow_nat_traversal_ = true; |
370 bool allow_relay_ = true; | 370 bool allow_relay_ = true; |
371 PortRange udp_port_range_; | 371 PortRange udp_port_range_; |
372 std::string talkgadget_prefix_; | 372 std::string talkgadget_prefix_; |
373 bool allow_pairing_ = true; | 373 bool allow_pairing_ = true; |
374 | 374 |
375 bool curtain_required_ = false; | 375 bool curtain_required_ = false; |
376 ThirdPartyAuthConfig third_party_auth_config_; | 376 ThirdPartyAuthConfig third_party_auth_config_; |
377 bool gnubby_auth_policy_enabled_ = false; | 377 bool security_key_auth_policy_enabled_ = false; |
378 bool gnubby_extension_supported_ = false; | 378 bool security_key_extension_supported_ = false; |
379 | 379 |
380 // Boolean to change flow, where necessary, if we're | 380 // Boolean to change flow, where necessary, if we're |
381 // capturing a window instead of the entire desktop. | 381 // capturing a window instead of the entire desktop. |
382 bool enable_window_capture_ = false; | 382 bool enable_window_capture_ = false; |
383 | 383 |
384 // Used to specify which window to stream, if enabled. | 384 // Used to specify which window to stream, if enabled. |
385 webrtc::WindowId window_id_ = 0; | 385 webrtc::WindowId window_id_ = 0; |
386 | 386 |
387 // Must outlive |gcd_state_updater_| and |signaling_connector_|. | 387 // Must outlive |gcd_state_updater_| and |signaling_connector_|. |
388 std::unique_ptr<OAuthTokenGetter> oauth_token_getter_; | 388 std::unique_ptr<OAuthTokenGetter> oauth_token_getter_; |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
809 #if defined(OS_LINUX) | 809 #if defined(OS_LINUX) |
810 // If an audio pipe is specific on the command-line then initialize | 810 // If an audio pipe is specific on the command-line then initialize |
811 // AudioCapturerLinux to capture from it. | 811 // AudioCapturerLinux to capture from it. |
812 base::FilePath audio_pipe_name = base::CommandLine::ForCurrentProcess()-> | 812 base::FilePath audio_pipe_name = base::CommandLine::ForCurrentProcess()-> |
813 GetSwitchValuePath(kAudioPipeSwitchName); | 813 GetSwitchValuePath(kAudioPipeSwitchName); |
814 if (!audio_pipe_name.empty()) { | 814 if (!audio_pipe_name.empty()) { |
815 remoting::AudioCapturerLinux::InitializePipeReader( | 815 remoting::AudioCapturerLinux::InitializePipeReader( |
816 context_->audio_task_runner(), audio_pipe_name); | 816 context_->audio_task_runner(), audio_pipe_name); |
817 } | 817 } |
818 | 818 |
819 base::FilePath gnubby_socket_name = base::CommandLine::ForCurrentProcess()-> | 819 base::FilePath security_key_socket_name = |
820 GetSwitchValuePath(kAuthSocknameSwitchName); | 820 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
821 if (!gnubby_socket_name.empty()) { | 821 kAuthSocknameSwitchName); |
822 remoting::GnubbyAuthHandler::SetGnubbySocketName(gnubby_socket_name); | 822 if (!security_key_socket_name.empty()) { |
823 gnubby_extension_supported_ = true; | 823 remoting::SecurityKeyAuthHandler::SetSecurityKeySocketName( |
| 824 security_key_socket_name); |
| 825 security_key_extension_supported_ = true; |
824 } | 826 } |
825 #elif defined(OS_WIN) | 827 #elif defined(OS_WIN) |
826 // TODO(joedow): Remove the conditional once this is supported on OSX. | 828 // TODO(joedow): Remove the conditional once this is supported on OSX. |
827 gnubby_extension_supported_ = true; | 829 security_key_extension_supported_ = true; |
828 #endif // defined(OS_WIN) | 830 #endif // defined(OS_WIN) |
829 | 831 |
830 // Create a desktop environment factory appropriate to the build type & | 832 // Create a desktop environment factory appropriate to the build type & |
831 // platform. | 833 // platform. |
832 #if defined(REMOTING_MULTI_PROCESS) | 834 #if defined(REMOTING_MULTI_PROCESS) |
833 IpcDesktopEnvironmentFactory* desktop_environment_factory = | 835 IpcDesktopEnvironmentFactory* desktop_environment_factory = |
834 new IpcDesktopEnvironmentFactory( | 836 new IpcDesktopEnvironmentFactory( |
835 context_->audio_task_runner(), context_->network_task_runner(), | 837 context_->audio_task_runner(), context_->network_task_runner(), |
836 context_->network_task_runner(), daemon_channel_.get()); | 838 context_->network_task_runner(), daemon_channel_.get()); |
837 desktop_session_connector_ = desktop_environment_factory; | 839 desktop_session_connector_ = desktop_environment_factory; |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 } else { | 1312 } else { |
1311 HOST_LOG << "Policy disables client pairing."; | 1313 HOST_LOG << "Policy disables client pairing."; |
1312 } | 1314 } |
1313 return true; | 1315 return true; |
1314 } | 1316 } |
1315 | 1317 |
1316 bool HostProcess::OnGnubbyAuthPolicyUpdate(base::DictionaryValue* policies) { | 1318 bool HostProcess::OnGnubbyAuthPolicyUpdate(base::DictionaryValue* policies) { |
1317 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); | 1319 DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); |
1318 | 1320 |
1319 if (!policies->GetBoolean(policy::key::kRemoteAccessHostAllowGnubbyAuth, | 1321 if (!policies->GetBoolean(policy::key::kRemoteAccessHostAllowGnubbyAuth, |
1320 &gnubby_auth_policy_enabled_)) { | 1322 &security_key_auth_policy_enabled_)) { |
1321 return false; | 1323 return false; |
1322 } | 1324 } |
1323 | 1325 |
1324 if (gnubby_auth_policy_enabled_) { | 1326 if (security_key_auth_policy_enabled_) { |
1325 HOST_LOG << "Policy enables gnubby auth."; | 1327 HOST_LOG << "Policy enables security key auth."; |
1326 } else { | 1328 } else { |
1327 HOST_LOG << "Policy disables gnubby auth."; | 1329 HOST_LOG << "Policy disables security key auth."; |
1328 } | 1330 } |
1329 | 1331 |
1330 return true; | 1332 return true; |
1331 } | 1333 } |
1332 | 1334 |
1333 void HostProcess::InitializeSignaling() { | 1335 void HostProcess::InitializeSignaling() { |
1334 DCHECK(!host_id_.empty()); // ApplyConfig() should already have been run. | 1336 DCHECK(!host_id_.empty()); // ApplyConfig() should already have been run. |
1335 | 1337 |
1336 DCHECK(!signal_strategy_); | 1338 DCHECK(!signal_strategy_); |
1337 DCHECK(!oauth_token_getter_); | 1339 DCHECK(!oauth_token_getter_); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1451 if (enable_vp9_) | 1453 if (enable_vp9_) |
1452 protocol_config->set_vp9_experiment_enabled(true); | 1454 protocol_config->set_vp9_experiment_enabled(true); |
1453 protocol_config->set_webrtc_supported(true); | 1455 protocol_config->set_webrtc_supported(true); |
1454 session_manager->set_protocol_config(std::move(protocol_config)); | 1456 session_manager->set_protocol_config(std::move(protocol_config)); |
1455 | 1457 |
1456 host_.reset(new ChromotingHost(desktop_environment_factory_.get(), | 1458 host_.reset(new ChromotingHost(desktop_environment_factory_.get(), |
1457 std::move(session_manager), transport_context, | 1459 std::move(session_manager), transport_context, |
1458 context_->audio_task_runner(), | 1460 context_->audio_task_runner(), |
1459 context_->video_encode_task_runner())); | 1461 context_->video_encode_task_runner())); |
1460 | 1462 |
1461 if (gnubby_auth_policy_enabled_ && gnubby_extension_supported_) { | 1463 if (security_key_auth_policy_enabled_ && security_key_extension_supported_) { |
1462 host_->AddExtension(base::WrapUnique(new GnubbyExtension())); | 1464 host_->AddExtension(base::WrapUnique(new SecurityKeyExtension())); |
1463 } | 1465 } |
1464 | 1466 |
1465 // TODO(simonmorris): Get the maximum session duration from a policy. | 1467 // TODO(simonmorris): Get the maximum session duration from a policy. |
1466 #if defined(OS_LINUX) | 1468 #if defined(OS_LINUX) |
1467 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); | 1469 host_->SetMaximumSessionDuration(base::TimeDelta::FromHours(20)); |
1468 #endif | 1470 #endif |
1469 | 1471 |
1470 host_change_notification_listener_.reset(new HostChangeNotificationListener( | 1472 host_change_notification_listener_.reset(new HostChangeNotificationListener( |
1471 this, host_id_, signal_strategy_.get(), directory_bot_jid_)); | 1473 this, host_id_, signal_strategy_.get(), directory_bot_jid_)); |
1472 | 1474 |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1663 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1665 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
1664 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); | 1666 new HostProcess(std::move(context), &exit_code, &shutdown_watchdog); |
1665 | 1667 |
1666 // Run the main (also UI) message loop until the host no longer needs it. | 1668 // Run the main (also UI) message loop until the host no longer needs it. |
1667 message_loop.Run(); | 1669 message_loop.Run(); |
1668 | 1670 |
1669 return exit_code; | 1671 return exit_code; |
1670 } | 1672 } |
1671 | 1673 |
1672 } // namespace remoting | 1674 } // namespace remoting |
OLD | NEW |