阻止了可疑登录(Heroku,Amazon AWS,Gmail SMTP)

时间:2012-11-20 01:25:53

标签: ruby-on-rails heroku amazon-web-services smtp gmail

我偶尔会收到来自Google(accounts-noreply@google.com)的电子邮件,类似于以下内容:

Subject: Suspicious sign in prevented

Someone recently tried to use an application to sign in to your Google  
Account, ________@gmail.com. We prevented the sign-in attempt in case  
this was a hijacker trying to access your account. Please review the  
details of the sign-in attempt:

Monday, November 19, 2012 8:40:55 PM GMT
IP Address: 184.72.161.49 (amazonaws.com)
Location: Dixmoor, IL, USA

If you do not recognize this sign-in attempt, someone else might be trying  
to access your account. You should sign in to your account and reset your  
password immediately. Find out how at  
http://support.google.com/accounts?p=reset_pw

If this was you, and you want to give this application access to your  
account, complete the troubleshooting steps listed at  
http://support.google.com/mail?p=client_login

Sincerely,
The Google Accounts Team


© 2012 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043

You have received this mandatory email service announcement to update you  
about important changes to your Google product or account.

确实,这就是我,因为我在 Heroku上运行了一个应用(因此IP地址来自amazonaws.com),我通过Gmail SMTP直接从我的应用发送电子邮件(我认为这不重要,但具体来说,我正在使用我gmail_smtp plugin)的updated for Rails 3.2

有没有办法避免此警告或将已知IP列入白名单?

5 个答案:

答案 0 :(得分:36)

简答

  1. 在网络浏览器(可能是Chrome / Incognito)中,登录您的Gmail帐户(您尝试从应用中发送电子邮件的帐户)。

  2. 在另一个浏览器标签中,打开https://accounts.google.com/DisplayUnlockCaptcha - 然后按照以下步骤操作。

  3. 长答案

    我最终登录了我的Gmail帐户(在上面的Stackoverflow问题中提到为________@gmail.com)并看到以下警告:

    enter image description here

    [注意:事实之后,我正在拼凑这个答案。]点击链接是吗?我很确定我被带到了包含以下内容的页面,但在其下方有一条消息和按钮,用于将另一个应用程序添加到列表中:

    enter image description here

    [再次,我非常确定 ...]点击该页面上的按钮会将我带到https://accounts.google.com/DisplayUnlockCaptcha - 看起来像这样:

    enter image description here

    点击继续,将我带到另一页:

    enter image description here

    那时我刚去了我的应用程序,并发了一封电子邮件。

    注意:对于我的应用中的电子邮件的一般实时测试,我在triggers#index处有一个视图,其中有两个按钮可向这些操作发送PUT个请求:triggers#send_email和{{1 }}。这使管理员可以转到triggers#raise_exception发送电子邮件引发例外,以测试生产系统是否正常工作,只要能够发送电子邮件。通过exception_notification向我发送任何应用电子邮件详细信息中的异常。

答案 1 :(得分:3)

当我尝试使用PHP通过Gmail SMTP发送电子邮件时遇到了同样的问题。您应该完成电子邮件末尾提供的故障排除步骤。

答案 2 :(得分:2)

在Gmail邮箱上,查看右下角,您可以看到“详细信息”按钮。单击它然后在弹出窗口中更改可疑警告设置。

答案 3 :(得分:2)

要使用 Rails 4 在dev中工作,我必须为不太安全的应用启用访问权限。

登录您的Gmail帐户后访问https://www.google.com/settings/security/lesssecureapps,然后点击“开启”。请注意,这样可以访问不太安全的应用程序,这可能带来意想不到的后果。

  

某些应用和设备使用安全性较低的登录技术   您的帐户更容易受到攻您可以关闭这些应用的访问权限,   我们建议使用,或者如果您想使用它们,请打开访问权限   风险。

答案 4 :(得分:1)

要在Rails 4中使用此功能,除了启用安全性较低的应用之外,如上所述(登录到您的Gmail帐户时访问https://www.google.com/settings/security/lesssecureapps,然后点击'启用'。请注意,这样可以访问不太安全的应用程序,这可能带来意想不到的后果。), 如果仍然阻止帐户访问,则在某些情况下可能还需要一个步骤。 如果是这种情况,请访问https://accounts.google.com/DisplayUnlockCaptcha并点击“继续”,以启用帐户访问权限以通过Gmail邮件发送。

归功于Steve Polito