ruby-on-rails - 阻止可疑登录(Heroku,Amazon AWS,Gmail SMTP)

标签 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 pluginupdated for Rails 3.2)。

有什么办法可以避免这种警告,也可以将已知IP列入白名单?

最佳答案

简短答案

  • 在网络浏览器(可能是Chrome / Incognito)中,登录您的Gmail帐户(尝试通过该帐户从应用程序发送电子邮件的帐户)。
  • 在另一个浏览器选项卡中,打开https://accounts.google.com/DisplayUnlockCaptcha-并按照以下步骤操作。

  • 详细答案

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

    [注意:事后我将这个答案拼凑在一起。]单击链接是吗? ,我敢肯定我被带到了包含以下内容的页面,尽管在它下面有一个消息和按钮,用于向列表添加另一个应用程序:

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

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

    那时,我刚进入我的应用程序,并使其发送电子邮件。

    注意:为了在我的应用程序中进行电子邮件的常规实时测试,我在triggers#index上有一个 View ,其中有两个按钮可将PUT请求发送到这些操作:triggers#send_emailtriggers#raise_exception。这使管理员可以转到/triggers并发送电子邮件,或引发异常以测试生产系统在能够发送电子邮件方面是否正常工作。在我的任何应用程序中,通过exception_notification向我发送电子邮件详细信息都会引发异常。

    关于ruby-on-rails - 阻止可疑登录(Heroku,Amazon AWS,Gmail SMTP),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13465269/

    相关文章:

    ruby-on-rails - 如何根据开发数据库模式重新创建测试装置

    python - 关闭 SSL Django/Python 服务器 (Heroku)

    amazon-web-services - 我们不应该都从 API-Gateway + Lambda 堆栈迁移到 Lambda@Edge 以进行 API 服务吗?

    amazon-web-services - 如何将AWS CDK堆栈部署到多个账户?

    ruby-on-rails - Rails to_xml,使用xml属性代替子节点

    ruby-on-rails - 定义关系 Ruby-on-Rails

    ruby-on-rails - 推荐用于 Ruby on Rails 开发的 TextMate bundle

    ruby-on-rails - 使用 Asset Sync Gem 时 Heroku 上的 Slug 大小问题

    Node.js Express.js Heroku Toolbelt >Foreman 启动 - 错误 : write EINVAL

    ubuntu - 无法使用 Amazon AWS、SES 和 PostFix 发送电子邮件