amazon-ssm-agent icon indicating copy to clipboard operation
amazon-ssm-agent copied to clipboard

CreateControlChannel failed with error "Unauthorized Requeset"

Open JamieGruener opened this issue 8 years ago • 4 comments

We're seeing many of these entries: 2018-09-21 09:15:14 ERROR [MessageGatewayService] Failed to get controlchannel token, error: CreateControlChannel failed with error: createControlChannel request failed: unexpected response from the service <BadRequest xmlns=""><message>Unauthorized request.</message></BadRequest>

The problem seemed to start about a week ago (~9/14/2018 @1:04 PM EDT, before upgrading when we were at 2.3.50.x). Looking at some other issues, #48, #120, I see similarities, but no resolution that would work for us. The error above and the log below were generated after updating to version 2.3.68.0. Our environment has not changed and the instances involved have been running since before 9/1/2018.

In System Manager, running AWS-RunPatchBaseline is successful, including on the instances reporting the error.

Any information would be helpful.

Here's the result of running amazon-ssm-info:

[root@aws-lin-ncbp-ovpn jamie.gruener]# amazon-ssm-agent info
2018/09/21 09:15:05 Failed to load instance info from vault. RegistrationKey does not exist.
Error occurred fetching the seelog config file path:  open /etc/amazon/ssm/seelog.xml: no such file or directory
Initializing new seelog logger
New Seelog Logger Creation Complete
2018-09-21 09:15:05 INFO Create new startup processor
2018-09-21 09:15:05 INFO [LongRunningPluginsManager] registered plugins: {}
2018-09-21 09:15:05 INFO Initializing bookkeeping folders
2018-09-21 09:15:05 INFO removing the completed state files
2018-09-21 09:15:05 INFO Initializing bookkeeping folders for long running plugins
2018-09-21 09:15:05 INFO Initializing replies folder for MDS reply requests that couldn't reach the service
2018-09-21 09:15:05 INFO Initializing healthcheck folders for long running plugins
2018-09-21 09:15:05 INFO Initializing locations for inventory plugin
2018-09-21 09:15:05 INFO Initializing default location for custom inventory
2018-09-21 09:15:05 INFO Initializing default location for file inventory
2018-09-21 09:15:05 INFO Initializing default location for role inventory
2018-09-21 09:15:05 INFO Init the cloudwatchlogs publisher
2018-09-21 09:15:05 INFO Starting Agent: amazon-ssm-agent - v2.3.68.0
2018-09-21 09:15:05 INFO OS: linux, Arch: amd64
datastore file /var/lib/amazon/ssm/[INSTANCE_ID_REDACTED]/longrunningplugins/datastore/store doesn't exist - no long running plugins to execute
2018-09-21 09:15:05 INFO [MessagingDeliveryService] Starting document processing engine...
2018-09-21 09:15:05 INFO [MessagingDeliveryService] [EngineProcessor] Starting
2018-09-21 09:15:05 INFO [MessagingDeliveryService] [EngineProcessor] Initial processing
2018-09-21 09:15:05 INFO [MessagingDeliveryService] Starting message polling
2018-09-21 09:15:05 INFO [MessagingDeliveryService] Starting send replies to MDS
2018-09-21 09:15:05 INFO [instanceID=i-028df4453001aab3a] Starting association polling
2018-09-21 09:15:05 INFO [MessagingDeliveryService] [Association] [EngineProcessor] Starting
2018-09-21 09:15:05 INFO [MessagingDeliveryService] [Association] Launching response handler
2018-09-21 09:15:05 INFO [MessagingDeliveryService] [Association] [EngineProcessor] Initial processing
2018-09-21 09:15:05 INFO [MessagingDeliveryService] [Association] Initializing association scheduling service
2018-09-21 09:15:05 INFO [MessagingDeliveryService] [Association] Association scheduling service initialized
2018-09-21 09:15:05 INFO [OfflineService] Starting document processing engine...
2018-09-21 09:15:05 INFO [OfflineService] [EngineProcessor] Starting
2018-09-21 09:15:05 INFO [OfflineService] [EngineProcessor] Initial processing
2018-09-21 09:15:05 INFO [OfflineService] Starting message polling
2018-09-21 09:15:05 INFO [OfflineService] Starting send replies to MDS
2018-09-21 09:15:05 INFO [LongRunningPluginsManager] starting long running plugin manager
2018-09-21 09:15:05 INFO [LongRunningPluginsManager] there aren't any long running plugin to execute
2018-09-21 09:15:05 INFO [HealthCheck] HealthCheck reporting agent health.
2018-09-21 09:15:05 INFO [MessageGatewayService] Starting session document processing engine...
2018-09-21 09:15:05 INFO [MessageGatewayService] [EngineProcessor] Starting
2018-09-21 09:15:05 INFO [MessageGatewayService] ssm-user already exists.
2018-09-21 09:15:05 INFO [MessageGatewayService] File /etc/sudoers.d/ssm-agent-users already exists
2018-09-21 09:15:05 INFO [MessageGatewayService] [EngineProcessor] Initial processing
2018-09-21 09:15:05 INFO [MessageGatewayService] Setting up websocket for controlchannel for instance: [INSTANCE_ID_REDACTED], requestId: [REQUEST_ID_REDACTED]
2018-09-21 09:15:05 INFO [MessageGatewayService] listening reply.
2018-09-21 09:15:05 INFO [LongRunningPluginsManager] There are no long running plugins currently getting executed - skipping their healthcheck
2018-09-21 09:15:05 INFO [StartupProcessor] Executing startup processor tasks
2018-09-21 09:15:05 INFO [StartupProcessor] Write to serial port: Amazon SSM Agent v2.3.68.0 is running
2018-09-21 09:15:05 INFO [StartupProcessor] Write to serial port: OsProductName: Red Hat Enterprise Linux Server
2018-09-21 09:15:05 INFO [StartupProcessor] Write to serial port: OsVersion: 7.5
2018-09-21 09:15:07 ERROR [MessageGatewayService] Failed to get controlchannel token, error: CreateControlChannel failed with error: createControlChannel request failed: unexpected response from the service <BadRequest xmlns=""><message>Unauthorized request.</message></BadRequest>
2018-09-21 09:15:14 INFO [MessageGatewayService] Setting up websocket for controlchannel for instance: [INSTANCE_ID_REDACTED], requestId: [REQUEST_ID_REDACTED]
2018-09-21 09:15:14 ERROR [MessageGatewayService] Failed to get controlchannel token, error: CreateControlChannel failed with error: createControlChannel request failed: unexpected response from the service <BadRequest xmlns=""><message>Unauthorized request.</message></BadRequest>
2018-09-21 09:15:27 INFO [MessageGatewayService] Setting up websocket for controlchannel for instance: [INSTANCE_ID_REDACTED], requestId: [REQUEST_ID_REDACTED]
2018-09-21 09:15:28 ERROR [MessageGatewayService] Failed to get controlchannel token, error: CreateControlChannel failed with error: createControlChannel request failed: unexpected response from the service <BadRequest xmlns=""><message>Unauthorized request.</message></BadRequest>
2018-09-21 09:15:35 INFO [MessagingDeliveryService] [Association] Based upon expression rate(30 minutes) and last execution date 2018-09-21T13-12-48.000Z, next scheduled date for association 0d1a0fab-6e78-426e-b886-ec948d87264e is 2018-09-21T13-42-48.000Z
2018-09-21 09:15:35 INFO [MessagingDeliveryService] [Association] Scheduling association 0d1a0fab-6e78-426e-b886-ec948d87264e, setting next ScheduledDate to 2018-09-21T13-42-48.000Z
2018-09-21 09:15:35 INFO [MessagingDeliveryService] [Association] Schedule manager refreshed with 1 associations, 0 new associations associated
2018-09-21 09:15:35 INFO [MessagingDeliveryService] [Association] Next association is scheduled at 2018-09-21 13:42:48 +0000 UTC, system will sleep for 27m12.468990433s
2018-09-21 09:15:55 INFO [MessageGatewayService] Setting up websocket for controlchannel for instance: [INSTANCE_ID_REDACTED], requestId: [REQUEST_ID_REDACTED]
2018-09-21 09:15:55 ERROR [MessageGatewayService] Failed to get controlchannel token, error: CreateControlChannel failed with error: createControlChannel request failed: unexpected response from the service <BadRequest xmlns=""><message>Unauthorized request.</message></BadRequest>
2018-09-21 09:16:49 INFO [MessageGatewayService] Setting up websocket for controlchannel for instance: [INSTANCE_ID_REDACTED], requestId: [REQUEST_ID_REDACTED]
2018-09-21 09:16:49 ERROR [MessageGatewayService] Failed to get controlchannel token, error: CreateControlChannel failed with error: createControlChannel request failed: unexpected response from the service <BadRequest xmlns=""><message>Unauthorized request.</message></BadRequest>

JamieGruener avatar Sep 21 '18 13:09 JamieGruener

Hi. The error message you see is for connecting to the new MessageGatewayService that was introduced for Session Manager service. https://aws.amazon.com/about-aws/whats-new/2018/09/introducing-aws-systems-manager-session-manager/. This error is probably because instance role doesn't have permission to connect to the service. It should have no impact on existing Systems Manager scenarios. If you would like to use Session Manager, you can change your IAM policy on the instance using the documentation here - https://docs.aws.amazon.com/systems-manager/latest/userguide/getting-started-add-permissions-to-existing-profile.html.

Thanks, Munindra

munindradas avatar Sep 21 '18 15:09 munindradas

That all makes sense. I think that feature sounds interesting, and I think I'll explore it.

Even so, it seems like there should be a cleaner way to implement this without generating spurious errors when you're not intending to use the feature (like I wasn't). I leave it to folks smarter than me to figure that out.

JamieGruener avatar Sep 21 '18 17:09 JamieGruener

Hi -- @JamieGruener I am seeing this error too, and noticed that it appears to have been resolved, see #120

tomharrisonjr avatar Sep 25 '18 20:09 tomharrisonjr

Closing issue, as it seems it has been resolved. Thanks everyone!

hiimtu avatar Jul 02 '19 21:07 hiimtu