I,
我想在AWS S3存储桶上启用“MFA删除”。官方文件(cf http://docs.aws.amazon.com/AmazonS3/latest/dev/Versioning.html#MultiFactorAuthenticationDelete)
我不知道MFA的“序列号”是什么?
编写一个python代码来生成正确的签名标头似乎很难。你对我有什么建议吗? (例如现有的python脚本!:p)
官方代码段:
PUT /?versioning HTTPS/1.1
Host: BucketName .s3.amazonaws.com
Date: Date
Authorization: Signature
Content-Type: ContentType
Content-Length: Length-of-Content
x-amz-mfa: [SerialNumber] [AuthenticationCode]
<VersioningConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Status> Enabled </Status>
<MfaDelete> Enabled </MfaDelete>
</VersioningConfiguration>
答案 0 :(得分:2)
如果是虚拟MFA,则只需将虚拟MFA设备的ARN作为序列号。验证码是设备上显示的当前代码。您可以从IAM仪表板或执行CLI获取ARN:
$ aws iam list-mfa-devices
{
"MFADevices": [
{
"UserName": "obama",
"SerialNumber": "arn:aws:iam::1234827366789:mfa/obama",
"EnableDate": "2015-09-16T18:47:44Z"
}
]
}
如果你需要一个python示例:mfa_delete