2017-10-06 101 views
0

我成立CodeCommit SSH訪問和測試連接:IAM阻止訪問AWS CodeCommit回購

You have successfully authenticated over SSH. You can use Git to interact with AWS CodeCommit. Interactive shells are not supported.Connection to git-codecommit.us-east-1.amazonaws.com closed by remote host. 

當我嘗試克隆或推,我看到這個錯誤:

Access denied: User: arn:aws:iam::##########:user/[email protected] is not authorized to perform: codecommit:GitPull on resource: arn:aws:codecommit:us-east-1:##########:my-repo 

即使在向我的用戶添加策略以訪問此回購庫上的所有操作後,我無法克隆或推送。

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
     { 
      "Effect": "Allow", 
      "Action": [ 
       "codecommit:*" 
      ], 
      "Resource": [ 
       "arn:aws:codecommit:us-east-1:##########:my-repo" 
      ] 
     } 
    ] 
} 

什麼給?其他人有沒有這個問題?

+0

您是否還添加了IAMUserSSHKeys和IAMReadOnlyAccess的策略?請參閱http://docs.aws.amazon.com/codecommit/latest/userguide/how-to-share-repository.html#how-to-share-repository-IAMgroup。 PS您應該爲IAM組執行此操作,然後將用戶添加到該組,而不是將單個策略添加到IAM用戶。 – jarmod

+0

是的,建立一個包含這些策略的組和我描述的策略。 –

回答

0

有幾件事情可能導致此:

  1. 如果有任何組的權限。如果您正在使用多因素身份驗證拒絕對CodeCommit

  2. 訪問,不會與SSH工作(http://docs.aws.amazon.com/codecommit/latest/userguide/temporary-access.html

  3. 的IAM策略,拒絕到KMS

訪問

如果您在AWS論壇上發佈此信息,我們可以使用您的帳戶ID來幫助您解決問題。

+0

謝謝@zachary,這可能是導致此問題的第二個子彈。出於實際原因,這是一個棘手的限制。你知道這是預期行爲還是限制嗎? –

+0

不支持。 –

+1

要繼續使用SSH,可以爲CodeCommit禁用MFA。否則,您必須通過HTTPS使用憑證助手(http://docs.aws.amazon.com/codecommit/latest/userguide/setting-up-gc.html)。將MFA用於Credential Helper時,必須確保MFA先使用AWS CLI。 –