Access Denied when trying to Edit Bucket policy - amazon-s3

According to the ACL I should be able to write the bucket permissions because when I go to "My Security Credentials" I can verify that my Canonical User ID is the one that appear as the one that should be able to edit the bucket permissions:
Yet everytime I try to edit the bucket permissions I get the following "access denied" message:
I don't understand why is this happening, I made the policy in the generator with the following options:
And I'm getting the ARN from here:
So according to me everything should be correct ... What am I doing wrong?
EDIT: The same "access denied" message appear if I try to make it public or edit other properties...

Related

Trying to access GCS bucket but getting a `403 - Forbidden` error message

I'm hoping to get help with the right permission settings for accessing my files from a Colab app.
Goal
I'd like to be able to access personal images in a CGS bucket from a Colab python notebook running the "Style Transfer for Arbitrary Styles" demo of Tensorflow.
Situation
I setup a GCS bucket, made it public, and was able to retrieve files and use them in the demo.
To avoid having the GCS bucket publicly accessible, I removed allUsers and changed to my account/email that's tied to both Colab and GCS.
That caused the following error message:
Error Messages
Exception: URL fetch failure on https://storage.googleapis.com/01_bucket-02/Portrait-Ali-02-PXL_20220105_233524809.jpg: 403 -- Forbidden
Other Approaches
I'm trying to understand how I should approach this.
Is it a URL problem?
The 'Authenticated URL' caused the above 403 error.
https://storage.cloud.google.com/01_bucket-02/Portrait_82A6118_r01.png
And the gsutil link:
gs://01_bucket-02/Portrait_82A6118_r01.png
Returned this error message:
Exception: URL fetch failure on gs://01_bucket-02/Portrait_82A6118_r01.png: None -- unknown url type: gs
Authentication setup
For IAM
I have a service account in the project, as well as my user account (email: d#arrovox.com) that's tied to both the Colab and GCP accounts.
The Service Account role is Storage Admin.
The Service Account has an inheritance from the Project.
My user account, my email, is Storage Object Viewer
Assessment
Seems like the Authenticated URL is the right one, and it's a permissions issue.
Is this just about having the right permissions set in GCS, or do I need to call anything in the code before trying to return the image at the GCS URL?
I'd greatly appreciate any help or suggestions in how to troubleshoot this.
Thanks
doug
storage.objects.get is the demand for viewing files from GCS, but it looks like your user account or email already has the right permission.
How should I know my account has the right permission?
I think there's a simple solution to figure it out.
copy your Authenticated URL
Paste on any website and search.
If your current account doesn't have the right permission, that will return #Gmail-account does not have storage.objects.get access to the Google Cloud Storage object.
Or you can visit permission of bucket details to check are your email and service over there and have the right role.

S3 Access Denied with boto for private bucket as root user

I am trying to access a private S3 bucket that I've created in the console with boto3. However, when I try any action e.g. to list the bucket contents, I get
boto3.setup_default_session()
s3Client = boto3.client('s3')
blist = s3Client.list_objects(Bucket=f'{bucketName}')['Contents']
ClientError: An error occurred (AccessDenied) when calling the ListObjects operation: Access Denied
I am using my default profile (no need for IAM roles). The Access Control List on the browser states that the bucket owner has list/read/write permissions. The canonical id listed as the bucket owner is the same as the canonical id I get when I go to 'Your Security Credentials'.
In short, it feels like the account permissions are ok, but boto is not logging in with the right profile. In addition, running similar commands from the command line e.g.
aws s3api list-buckets
also gives Access Denied. I have no problem running these commands at work, where I have a work log-in and IAM roles. It's just running them on my personal 'default' profile.
Any suggestions?
It appears that your credentials have not been stored in a configuration file.
You can run this AWS CLI command:
aws configure
It will then prompt you for Access Key and Secret Key, then will store them in the ~.aws/credentials file. That file is automatically used by the AWS CLI and boto3.
It is a good idea to confirm that it works via the AWS CLI first, then you will know that it should work for boto3 also.
I would highly recommend that you create IAM credentials and use them instead of root credentials. It is quite dangerous if the root credentials are compromised. A good practice is to create an IAM User for specific applications, then limit the permissions granted to that application. This avoids situations where a programming error (or a security compromise) could lead to unwanted behaviour (eg resources being used or data being deleted).

Why does the IAM admin get "Error, Access denied" upon attempting to grant listObjects to the public?

I am logged into the aws console as an IAM user with the AdministratorAccess policy attached. I'm trying to grant the public read access to the entire contents of a bucket.
To do this I open the bucket and click on Permissions, and select Access Control List. I select Public Access | Everyone, and select List Objects, and click on Save.
I get an inline error message saying "Error, Access denied".
The browser console says
"POST https://us-east-2.console.aws.amazon.com/s3/proxy 403 (Forbidden)"
I get the same result when I try this as the root user.
I got the same result when trying to set up a bucket policy.
Am I going about this incorrectly?

access issue in uploading SSL file in amazon EC2 server

i am using this command to upload ssl file.
aws iam upload-server-certificate --server-certificate-name CertificateName --certificate-body file://public_key_certificate_file --private-key file://privatekey.pem
i also placed a config file at ~/.aws/config
and values are
[default]
aws_access_key_id = with my own key
aws_secret_access_key = with my own key
region = ********
but it is giving me this error:
A client error (AccessDenied) occurred: User: arn:aws:iam::419351825566:user/** is not authorized to perform: iam:UploadServerCertificate on resource: arn:a
ws:iam::419351825566:server-certificate/**.crt
Am I not writing AWS Credentials properly? Or I have no access? I am also not sure if I am writing region right..
As of Nov 2015, having an IAM user with a policy of 'IAMFullAccess' will make this work. You can create a new user to have that sole policy, or you can use an existing user and just add the policy.
Note: After uploading the SSL file, you can remove the IAMFullAccess policy if you'd like to tighten down permissions/security again.
New user workflow:
In the jumbo Services menu in AWS, go to IAM
In left sidebar, click on Users
Click blue "Create New Users" button
Type in a name for the user, e.g. "ssl-uploader", and create user
Make note of the keys that AWS gives you. You can't retrieve these later (you'd have to go back to step 1 and create a different user).
Assign the IAMFullAccess policy to the new user
In command line, do aws configure and answer the questions:
AWS Access Key ID: - access key from step 5
AWS Secret Access Key: - secret key from step 5
Default region name: - didn't matter in my case, accepted default None
Default output format: - didn't matter in my case, accepted default None
Run command as mentioned in the question, and it should work. You may want to take note of the JSON it returns in case you need it later.

Sharepoint 2010 login layout page gives Access denied error

I have few login screen in Loayout folder of sharepoint. When we are redirecting to change password screen it gives Access denied error. But no in other pages like Custom login page security question pages. In the debug mode also we couldnt get any error.
Check out the whole access denied string. If you look at the parameters, you often can find the culprit or file in questions generating the access denied. Maybe you can post the whole URL when you get the access denied?