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

Ability to customise DefaultDocumentWorker

Open cknowles opened this issue 9 years ago • 12 comments

Is it possible to customise the value for DefaultDocumentWorker on linux?

By default it appears to be hard coded to /usr/bin: https://github.com/aws/amazon-ssm-agent/blob/e092980b261c432156f738dc1531666bf8277679/agent/appconfig/constants_unix.go#L79

We're trying to deploy on Container Linux based on this blog post. It's not a current supported OS, although the agent does work fine if we rebuild after changing that value. The reason it needs to be different is on Container Linux /usr is read only to allow for OS updates.

cknowles avatar Nov 28 '17 12:11 cknowles

we currently don't support customizing binary paths.

shengmiw avatar Nov 30 '17 21:11 shengmiw

I have the same request for a different use case. I simply compiled amazon-ssm-agent from source on an unsupported OS, and I had to move ssm-document-worker binary from build directory to /usr/bin, because the reference is hardcoded.

Do you support this use case? If yes, the Readme should mention it https://github.com/aws/amazon-ssm-agent#building-and-running-from-source If not, do you suggested always create a release package?

hui-yang avatar Dec 06 '17 00:12 hui-yang

Same issue here; realizing CoreOS is not a supported OS but the hardcoding is unnecessarily strict.

jhmartin avatar Dec 08 '17 20:12 jhmartin

FYI the last release before the worker process entered was https://github.com/aws/amazon-ssm-agent/releases/tag/2.0.952.0.

https://amazon-ssm-us-east-1.s3.amazonaws.com/2.0.952.0/linux_amd64/amazon-ssm-agent.rpm

jhmartin avatar Dec 08 '17 20:12 jhmartin

Just ran into this as well. Any workarounds?

jpadilla avatar Jan 10 '18 14:01 jpadilla

@jpadilla for what it's worth, we augmented the script from the blog post I linked above with this:

sed -i "s+/usr/bin/ssm-document-worker+$BIN_DIR/ssm-document-worker+g" agent/appconfig/constants_unix.go

That's not to say all agent actions work as the OS is still not supported, but at least now it runs and shell script can be executed and audited via SSM.

cknowles avatar Jan 11 '18 10:01 cknowles

A custom build is certainly an option, but it is so much cleaner if it is a native configurable.

jhmartin avatar Jan 11 '18 16:01 jhmartin

@c-knowles @jpadilla @jhmartin @hui-yang - I have release binaries on my fork which lets you set $SSM_DOCUMENT_WORKER_PATH at agent run-time:

https://github.com/opsgang/amazon-ssm-agent/

Effectively you can install the agent and ssm doc worker binaries anywhere on the filesystem.

You can download the built releases (these work on CoreOS amongst other linux amd4s) from here: https://github.com/opsgang/amazon-ssm-agent/releases

I will be keeping this in-sync with the upstream - builds of the binaries are automated on a release.

Hope its of use ...

jinal--shah avatar Jan 25 '18 14:01 jinal--shah

@jinal--shah I suggest submitting a PR here with that, if nothing else AWS then can't complain about the work necessary to enable it.

jhmartin avatar Jan 25 '18 16:01 jhmartin

As of today, DefaultDocumentWorker is a var and I suppose it is ok to be modified at runtime. It is handling ubuntu w/ snap in that way.

mumoshu avatar May 21 '18 00:05 mumoshu

@c-knowles @jpadilla @jhmartin Just submitted #101 for this. Would it work for you guys?

@jinal--shah's I was able to notice that it was just a matter of adding 4 lines today, thanks to the last commit in your fork. Thanks for that 🙏

mumoshu avatar May 21 '18 01:05 mumoshu

Should be resolved: https://github.com/aws/amazon-ssm-agent/commit/bc7e78017a7802854fb9ddf313ca053a20e6a471 thanks @bdwyertech

hiimtu avatar Jul 02 '19 23:07 hiimtu