S3 + AWS KMS (specifically SSE-KMS) support is broken #1001
	
		Labels
		
	
	
	
	No labels
	
		
			
	
	Affects/CppNix
		
			Affects/Nightly
		
			Affects/Only nightly
		
			Affects/Stable
		
			Area/build-packaging
		
			Area/cli
		
			Area/evaluator
		
			Area/fetching
		
			Area/flakes
		
			Area/language
		
			Area/lix ci
		
			Area/nix-eval-jobs
		
			Area/profiles
		
			Area/protocol
		
			Area/releng
		
			Area/remote-builds
		
			Area/repl
		
			Area/repl/debugger
		
			Area/store
		
			bug
		
			Context
contributors
		
			Context
drive-by
		
			Context
maintainers
		
			Context
RFD
		
			crash 💥
		
			Cross Compilation
		
			devx
		
			docs
		
			Downstream Dependents
		
			E/easy
		
			E/hard
		
			E/help wanted
		
			E/reproducible
		
			E/requires rearchitecture
		
			Feature/S3
		
			imported
		
			Language/Bash
		
			Language/C++
		
			Language/NixLang
		
			Language/Python
		
			Language/Rust
		
			Needs Langver
		
			OS/Linux
		
			OS/macOS
		
			performance
		
			regression
		
			release-blocker
		
			stability
		
			Status
blocked
		
			Status
invalid
		
			Status
postponed
		
			Status
wontfix
		
			testing
		
			testing/flakey
		
			Topic/Large Scale Installations
		
			ux
		
		
	
		No milestone
		
			
		
	No project
	
		
	
	
	
	
		No assignees
		
	
	
		
			
		
	
	
	
		4 participants
	
	
		
		
	Notifications
	
		
	
	
	
		
	
	
	Due date
No due date set.
	
		Dependencies
		
		
	
	
	No dependencies set.
	
	
		
	
	
		
			Reference
		
	
	
		
	
	
			lix-project/lix#1001
			
		
	
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	
	No description provided.
		
		Delete branch "%!s()"
	 
	Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Describe the bug
Pushing to a S3 bucket which has Server-Side Encryption with AWS KMS enabled with
nix copy --tois broken, and results in this error:Interestingly, this only happens locally using AWS SSO + the AWS CLI, and doesn't happen in my $work's CI, where we use
AWS_ACCESS_KEY_ID+AWS_SECRET_ACCESS_KEYderived from an OAuth identity principal (specifically GitHub Actions).Steps To Reproduce
aws sso login)nix copy --to:Expected behavior
Expected behavior is that this derivation (and all of it's dependencies) are properly copied to the S3 bucket using the credentials from the AWS SDK. Note that upstream CppNix also has this same error, albeit in a slightly different way:
nix --versionoutputAdditional context
Related: #272
fascinating. I have a workaround, which is to NOT use AWS SSO, and instead use a temporary key-pair for this which... fixes things.
@arianvp you may be interested in this report
The error you're getting is the fallback behaviour of trying to talk to S3 without any auth at all.
Credentials need to be available to the nix daemon. Lix doesn't do credential propagation from (trusted) users to the daemon.
Your CI most likely works because you're using nix in single user mode or setting the env vars in a way that the daemon can pick them up.
Your credentials from AWS CLI locally don't magically make it to the daemon unfortunately.
You'll have to export your local credentials and set them in the
.aws/credentialsfile of the nix daemon user.Oh no wait. For nix copy it does use the local credentials. Maybe AWS SSO is not in the default credential chain or something.
Could you please run this wit maximum verbosity? It'll show the AWS SDK logs. Make sure to sanitize any credentials as they're logged at this level
sure! will do on monday when i'm back on my work laptop.
@rv32ima any updates on this?
can't reproduce after upgrading to using a nightly version of 2.94.0
So, the AWS CRT doesn't pick up the AWS SSO credential chain at all it seems:
https://github.com/awslabs/aws-c-auth/issues/228
https://github.com/NixOS/nix/issues/5525
The workaround for copying to cache is:
For substitution you will need to get those credentials to be picked up by the nix-daemon instead.
You can do that with:
But it's all kinda hacky. As the SSO credential chain can be renewed. But the raw AWS credentials expire after 15 mins (by default; can be made longer).