cgenco
cgenco

Reputation: 3557

Get User-Agent and IP Address of object anonymously uploaded to S3?

Is there a way to retrieve the User-Agent and/or IP Address of the client that uploaded an object anonymously to an S3 bucket?

I'm using an anonymous upload method similar to this: https://gist.github.com/jareware/d7a817a08e9eae51a7ea

which shows a method of testing against the client's User-Agent (via. aws:UserAgent in a StringNotEquals block in the Condition block), and there is documentation that shows that aws:SourceIp exists as well, but I see no way of grabbing either after the file has been uploaded.

Am I missing something?

Upvotes: 0

Views: 1049

Answers (1)

Michael - sqlbot
Michael - sqlbot

Reputation: 179194

This is possible if you enabled logging on the bucket...

http://docs.aws.amazon.com/AmazonS3/latest/dev/ServerLogs.html

...or captured a bucket notification event about the upload...

http://docs.aws.amazon.com/AmazonS3/latest/dev/notification-content-structure.html

Otherwise, no.

Anonymous uploads are just a really, really bad idea. You can end up with objects where the only available action to you is deleting them. Bucket ownership != object ownership. Authenticating requests is simply not that difficult, so I would encourage you to back away slowly from anonymous S3 writes.

Upvotes: 1

Related Questions