Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signature v4 problem, AWS: [Action Required] Migrate to Signature Version 4 to continue using Amazon SES #85

Open
benjamin74 opened this issue Apr 4, 2021 · 4 comments

Comments

@benjamin74
Copy link

Hello,

I am a bit clueless : I keep receiving emails from AWS telling me that my php-aws-ses install is using version 3:

Your Signature Version 3 requests were identified to be originating from:
- IAM Users: arn:aws:iam::XXXXXXXXXXX:user/YYYYYYYY-php
- IPs: xxx.zzz.xxx.175
- User Agents: SimpleEmailService/php

I've updated my composer packages so I'm now using version 0.9.5 which, according to the documentation, is configured to use signature v4 by default.

Does anyone has any idea of what the issue could be ?

I'm using php-aws-ses in one of the most basic usage and it worked perfectly until now:

require_once 'vendor/autoload.php';
function emailing_sesmail($from, $to, $subject, $body){
        $m = new SimpleEmailServiceMessage();
        $m->addTo($to);
        $m->setFrom($from);
        $m->setSubject($subject);
        $m->setMessageFromString($body);
        // that's the key ID and secret of user php-aws-ses-script inside AWS IAM
        $ses = new SimpleEmailService('XXXXXXXXXXXXXXX', 'ZZZZZZZZZZZZZZZZZZZZZZZZ');
        return print_r($ses->sendEmail($m));
}

Thanks for any idea!

@daniel-zahariev
Copy link
Owner

Hi @benjamin74,
here's a short-list of things to check:

  • Can you confirm the version (0.9.5) in the lib files in vendor folder
  • Have you restarted PHP-FPM if you're using it - sometimes it won't let go of old versions files
  • Have you tried sending outside your project

@aa6my
Copy link

aa6my commented Apr 8, 2021

Hello,

I am a bit clueless : I keep receiving emails from AWS telling me that my php-aws-ses install is using version 3:

Your Signature Version 3 requests were identified to be originating from:
- IAM Users: arn:aws:iam::XXXXXXXXXXX:user/YYYYYYYY-php
- IPs: xxx.zzz.xxx.175
- User Agents: SimpleEmailService/php

I've updated my composer packages so I'm now using version 0.9.5 which, according to the documentation, is configured to use signature v4 by default.

Does anyone has any idea of what the issue could be ?

I'm using php-aws-ses in one of the most basic usage and it worked perfectly until now:

require_once 'vendor/autoload.php';
function emailing_sesmail($from, $to, $subject, $body){
        $m = new SimpleEmailServiceMessage();
        $m->addTo($to);
        $m->setFrom($from);
        $m->setSubject($subject);
        $m->setMessageFromString($body);
        // that's the key ID and secret of user php-aws-ses-script inside AWS IAM
        $ses = new SimpleEmailService('XXXXXXXXXXXXXXX', 'ZZZZZZZZZZZZZZZZZZZZZZZZ');
        return print_r($ses->sendEmail($m));
}

Thanks for any idea!

My suggestion for $ses

$region = SimpleEmailService::AWS_US_EAST_1; //its should be AWS_US_EAST_1 only, if you try to using diffrent region it will be failed
$version = SimpleEmailService::REQUEST_SIGNATURE_V4;
$debug = true;

$ses = new SimpleEmailService(
    $_ENV['AWS_ACCESS_KEY_ID'], 
    $_ENV['AWS_SECRET_ACCESS_KEY'], 
    $region,
    $debug,
    $version
);

$ses->setHost('ap-southeast-1'); //trick to switch region
return print_r($ses->sendEmail($m));

@zippytiff
Copy link

Hi

Newbie question

I have the error showing now:

Signature Version 3 requests are deprecated from March 1, 2021. From that date on, we are progressively rejecting such requests. To resolve the issue you must migrate to Signature Version 4. If you are self-signing your requests, refer to the documentation for Authenticating requests to the Amazon SES API [1] with Signature Version 4 [2]. If you are not self-signing your requests, simply update your SDK/CLI to the latest version. [1]

im using an inherited SES setup, using an access and secret key

Is this error saying i need to update them ? if so how ?

im running 0.9.3 of your code

Much appreciated

ZT

@benjamin74
Copy link
Author

benjamin74 commented Apr 28, 2021

Thanks @ daniel-zahariev for your suggestion, since I wasn't 100% sure whether or not the problem was solved I had to wait some days after restarting php-fpm to confirm that I'm not receiving such emails from amazon anymore.

So it looks like it was just an issue with my old PHP version being cached until php-fpm got restarted.

@ zippytiff I suspect updating to the latest version and making sure to restart php-fpm should solve your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants