mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-10 12:13:17 -08:00
Translated ['src/README.md', 'src/banners/hacktricks-training.md', 'src/
This commit is contained in:
@@ -8,77 +8,69 @@
|
||||
|
||||
### Accounts
|
||||
|
||||
In AWS there is a **root account,** which is the **parent container for all the accounts** for your **organization**. However, you don't need to use that account to deploy resources, you can create **other accounts to separate different AWS** infrastructures between them.
|
||||
AWS में एक **root account** है, जो आपके **organization** के लिए सभी खातों का **parent container** है। हालांकि, आपको संसाधनों को तैनात करने के लिए उस खाते का उपयोग करने की आवश्यकता नहीं है, आप **अलग-अलग AWS** बुनियादी ढांचे को अलग करने के लिए **अन्य खाते बना सकते हैं**।
|
||||
|
||||
This is very interesting from a **security** point of view, as **one account won't be able to access resources from other account** (except bridges are specifically created), so this way you can create boundaries between deployments.
|
||||
यह **security** के दृष्टिकोण से बहुत दिलचस्प है, क्योंकि **एक खाता अन्य खाते के संसाधनों तक पहुँच नहीं पाएगा** (जब तक कि पुल विशेष रूप से बनाए नहीं गए हैं), इसलिए इस तरह आप तैनाती के बीच सीमाएँ बना सकते हैं।
|
||||
|
||||
Therefore, there are **two types of accounts in an organization** (we are talking about AWS accounts and not User accounts): a single account that is designated as the management account, and one or more member accounts.
|
||||
इसलिए, एक संगठन में **दो प्रकार के खाते** होते हैं (हम AWS खातों की बात कर रहे हैं और उपयोगकर्ता खातों की नहीं): एकल खाता जिसे प्रबंधन खाता के रूप में नामित किया गया है, और एक या अधिक सदस्य खाते।
|
||||
|
||||
- The **management account (the root account)** is the account that you use to create the organization. From the organization's management account, you can do the following:
|
||||
- **प्रबंधन खाता (root account)** वह खाता है जिसका उपयोग आप संगठन बनाने के लिए करते हैं। संगठन के प्रबंधन खाते से, आप निम्नलिखित कर सकते हैं:
|
||||
|
||||
- Create accounts in the organization
|
||||
- Invite other existing accounts to the organization
|
||||
- Remove accounts from the organization
|
||||
- Manage invitations
|
||||
- Apply policies to entities (roots, OUs, or accounts) within the organization
|
||||
- Enable integration with supported AWS services to provide service functionality across all of the accounts in the organization.
|
||||
- It's possible to login as the root user using the email and password used to create this root account/organization.
|
||||
- संगठन में खाते बनाएं
|
||||
- संगठन में अन्य मौजूदा खातों को आमंत्रित करें
|
||||
- संगठन से खातों को हटाएं
|
||||
- आमंत्रण प्रबंधित करें
|
||||
- संगठन के भीतर संस्थाओं (roots, OUs, या खातों) पर नीतियाँ लागू करें
|
||||
- संगठन में सभी खातों के बीच सेवा कार्यक्षमता प्रदान करने के लिए समर्थित AWS सेवाओं के साथ एकीकरण सक्षम करें।
|
||||
- आप इस root account/organization को बनाने के लिए उपयोग किए गए ईमेल और पासवर्ड का उपयोग करके root उपयोगकर्ता के रूप में लॉगिन करना संभव है।
|
||||
|
||||
The management account has the **responsibilities of a payer account** and is responsible for paying all charges that are accrued by the member accounts. You can't change an organization's management account.
|
||||
|
||||
- **Member accounts** make up all of the rest of the accounts in an organization. An account can be a member of only one organization at a time. You can attach a policy to an account to apply controls to only that one account.
|
||||
- Member accounts **must use a valid email address** and can have a **name**, in general they wont be able to manage the billing (but they might be given access to it).
|
||||
प्रबंधन खाते के पास **payer account** की जिम्मेदारियाँ होती हैं और यह सदस्य खातों द्वारा उत्पन्न सभी शुल्कों का भुगतान करने के लिए जिम्मेदार होता है। आप एक संगठन के प्रबंधन खाते को बदल नहीं सकते।
|
||||
|
||||
- **सदस्य खाते** संगठन में बाकी सभी खातों का निर्माण करते हैं। एक खाता एक समय में केवल एक संगठन का सदस्य हो सकता है। आप एक खाते पर नियंत्रण लागू करने के लिए एक नीति संलग्न कर सकते हैं केवल उसी एक खाते पर।
|
||||
- सदस्य खातों को **एक मान्य ईमेल पता** का उपयोग करना चाहिए और एक **नाम** हो सकता है, सामान्यतः वे बिलिंग का प्रबंधन नहीं कर पाएंगे (लेकिन उन्हें इसके लिए पहुँच दी जा सकती है)।
|
||||
```
|
||||
aws organizations create-account --account-name testingaccount --email testingaccount@lalala1233fr.com
|
||||
```
|
||||
|
||||
### **Organization Units**
|
||||
|
||||
Accounts can be grouped in **Organization Units (OU)**. This way, you can create **policies** for the Organization Unit that are going to be **applied to all the children accounts**. Note that an OU can have other OUs as children.
|
||||
|
||||
खातों को **Organization Units (OU)** में समूहित किया जा सकता है। इस तरह, आप उस Organization Unit के लिए **policies** बना सकते हैं जो **सभी बच्चों के खातों पर लागू होंगी**। ध्यान दें कि एक OU के पास अन्य OUs भी हो सकते हैं।
|
||||
```bash
|
||||
# You can get the root id from aws organizations list-roots
|
||||
aws organizations create-organizational-unit --parent-id r-lalala --name TestOU
|
||||
```
|
||||
|
||||
### Service Control Policy (SCP)
|
||||
|
||||
A **service control policy (SCP)** is a policy that specifies the services and actions that users and roles can use in the accounts that the SCP affects. SCPs are **similar to IAM** permissions policies except that they **don't grant any permissions**. Instead, SCPs specify the **maximum permissions** for an organization, organizational unit (OU), or account. When you attach a SCP to your organization root or an OU, the **SCP limits permissions for entities in member accounts**.
|
||||
एक **सेवा नियंत्रण नीति (SCP)** एक नीति है जो उन सेवाओं और क्रियाओं को निर्दिष्ट करती है जिन्हें उपयोगकर्ता और भूमिकाएँ उन खातों में उपयोग कर सकते हैं जिन पर SCP प्रभाव डालता है। SCPs **IAM** अनुमतियों की नीतियों के समान हैं, सिवाय इसके कि वे **कोई अनुमतियाँ नहीं देतीं**। इसके बजाय, SCPs एक संगठन, संगठनात्मक इकाई (OU), या खाते के लिए **अधिकतम अनुमतियों** को निर्दिष्ट करती हैं। जब आप अपने संगठन की जड़ या एक OU पर SCP संलग्न करते हैं, तो **SCP सदस्य खातों में संस्थाओं के लिए अनुमतियों को सीमित करता है**।
|
||||
|
||||
This is the ONLY way that **even the root user can be stopped** from doing something. For example, it could be used to stop users from disabling CloudTrail or deleting backups.\
|
||||
The only way to bypass this is to compromise also the **master account** that configures the SCPs (master account cannot be blocked).
|
||||
यह **एकमात्र तरीका है कि** **यहाँ तक कि रूट उपयोगकर्ता को भी कुछ करने से रोका जा सकता है**। उदाहरण के लिए, इसका उपयोग उपयोगकर्ताओं को CloudTrail को निष्क्रिय करने या बैकअप हटाने से रोकने के लिए किया जा सकता है।\
|
||||
इससे बचने का एकमात्र तरीका यह है कि **मास्टर खाता** भी समझौता किया जाए जो SCPs को कॉन्फ़िगर करता है (मास्टर खाता को अवरुद्ध नहीं किया जा सकता)।
|
||||
|
||||
> [!WARNING]
|
||||
> Note that **SCPs only restrict the principals in the account**, so other accounts are not affected. This means having an SCP deny `s3:GetObject` will not stop people from **accessing a public S3 bucket** in your account.
|
||||
> ध्यान दें कि **SCPs केवल खाते में प्रिंसिपल को प्रतिबंधित करती हैं**, इसलिए अन्य खाते प्रभावित नहीं होते। इसका मतलब है कि एक SCP `s3:GetObject` को अस्वीकार करने से लोगों को आपके खाते में **एक सार्वजनिक S3 बकेट** तक पहुँचने से नहीं रोका जाएगा।
|
||||
|
||||
SCP examples:
|
||||
SCP उदाहरण:
|
||||
|
||||
- Deny the root account entirely
|
||||
- Only allow specific regions
|
||||
- Only allow white-listed services
|
||||
- Deny GuardDuty, CloudTrail, and S3 Public Block Access from
|
||||
- रूट खाते को पूरी तरह से अस्वीकार करें
|
||||
- केवल विशिष्ट क्षेत्रों की अनुमति दें
|
||||
- केवल श्वेतसूचीबद्ध सेवाओं की अनुमति दें
|
||||
- GuardDuty, CloudTrail, और S3 सार्वजनिक ब्लॉक एक्सेस को निष्क्रिय करने से रोकें
|
||||
|
||||
being disabled
|
||||
- सुरक्षा/घटना प्रतिक्रिया भूमिकाओं को हटाने या
|
||||
|
||||
- Deny security/incident response roles from being deleted or
|
||||
संशोधित करने से रोकें।
|
||||
|
||||
modified.
|
||||
- बैकअप को हटाने से रोकें।
|
||||
- IAM उपयोगकर्ताओं और एक्सेस कुंजियों को बनाने से रोकें
|
||||
|
||||
- Deny backups from being deleted.
|
||||
- Deny creating IAM users and access keys
|
||||
|
||||
Find **JSON examples** in [https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples.html](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples.html)
|
||||
**JSON उदाहरण** [https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples.html](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_manage_policies_scps_examples.html) में खोजें
|
||||
|
||||
### ARN
|
||||
|
||||
**Amazon Resource Name** is the **unique name** every resource inside AWS has, its composed like this:
|
||||
|
||||
**Amazon Resource Name** वह **विशिष्ट नाम** है जो AWS के अंदर हर संसाधन का होता है, यह इस तरह से बना होता है:
|
||||
```
|
||||
arn:partition:service:region:account-id:resource-type/resource-id
|
||||
arn:aws:elasticbeanstalk:us-west-1:123456789098:environment/App/Env
|
||||
```
|
||||
|
||||
Note that there are 4 partitions in AWS but only 3 ways to call them:
|
||||
|
||||
- AWS Standard: `aws`
|
||||
@@ -86,246 +78,240 @@ Note that there are 4 partitions in AWS but only 3 ways to call them:
|
||||
- AWS US public Internet (GovCloud): `aws-us-gov`
|
||||
- AWS Secret (US Classified): `aws`
|
||||
|
||||
## IAM - Identity and Access Management
|
||||
## IAM - पहचान और पहुँच प्रबंधन
|
||||
|
||||
IAM is the service that will allow you to manage **Authentication**, **Authorization** and **Access Control** inside your AWS account.
|
||||
IAM वह सेवा है जो आपको अपने AWS खाते के भीतर **प्रमाणीकरण**, **अधिकार** और **पहुँच नियंत्रण** प्रबंधित करने की अनुमति देती है।
|
||||
|
||||
- **Authentication** - Process of defining an identity and the verification of that identity. This process can be subdivided in: Identification and verification.
|
||||
- **Authorization** - Determines what an identity can access within a system once it's been authenticated to it.
|
||||
- **Access Control** - The method and process of how access is granted to a secure resource
|
||||
- **प्रमाणीकरण** - एक पहचान को परिभाषित करने और उस पहचान के सत्यापन की प्रक्रिया। इस प्रक्रिया को पहचान और सत्यापन में विभाजित किया जा सकता है।
|
||||
- **अधिकार** - यह निर्धारित करता है कि एक पहचान एक प्रणाली के भीतर क्या पहुँच सकती है जब इसे प्रमाणित किया गया हो।
|
||||
- **पहुँच नियंत्रण** - सुरक्षित संसाधन तक पहुँच कैसे दी जाती है, इसकी विधि और प्रक्रिया।
|
||||
|
||||
IAM can be defined by its ability to manage, control and govern authentication, authorization and access control mechanisms of identities to your resources within your AWS account.
|
||||
IAM को इसकी क्षमता द्वारा परिभाषित किया जा सकता है कि यह आपके AWS खाते के भीतर पहचान के प्रमाणीकरण, अधिकार और पहुँच नियंत्रण तंत्रों का प्रबंधन, नियंत्रण और शासन कर सकता है।
|
||||
|
||||
### [AWS account root user](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html) <a href="#id_root" id="id_root"></a>
|
||||
### [AWS खाता रूट उपयोगकर्ता](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html) <a href="#id_root" id="id_root"></a>
|
||||
|
||||
When you first create an Amazon Web Services (AWS) account, you begin with a single sign-in identity that has **complete access to all** AWS services and resources in the account. This is the AWS account _**root user**_ and is accessed by signing in with the **email address and password that you used to create the account**.
|
||||
जब आप पहली बार एक Amazon Web Services (AWS) खाता बनाते हैं, तो आप एकल साइन-इन पहचान के साथ शुरू करते हैं जिसके पास खाते में सभी AWS सेवाओं और संसाधनों तक **पूर्ण पहुँच** होती है। यह AWS खाता _**रूट उपयोगकर्ता**_ है और इसे **उस ईमेल पते और पासवर्ड के साथ साइन इन करके एक्सेस किया जाता है जिसका उपयोग आपने खाता बनाने के लिए किया था**।
|
||||
|
||||
Note that a new **admin user** will have **less permissions that the root user**.
|
||||
ध्यान दें कि एक नया **व्यवस्थापक उपयोगकर्ता** के पास **रूट उपयोगकर्ता की तुलना में कम अनुमतियाँ होंगी**।
|
||||
|
||||
From a security point of view, it's recommended to create other users and avoid using this one.
|
||||
सुरक्षा के दृष्टिकोण से, अन्य उपयोगकर्ताओं को बनाना और इस एक का उपयोग करने से बचना अनुशंसित है।
|
||||
|
||||
### [IAM users](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html) <a href="#id_iam-users" id="id_iam-users"></a>
|
||||
### [IAM उपयोगकर्ता](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users.html) <a href="#id_iam-users" id="id_iam-users"></a>
|
||||
|
||||
An IAM _user_ is an entity that you create in AWS to **represent the person or application** that uses it to **interact with AWS**. A user in AWS consists of a name and credentials (password and up to two access keys).
|
||||
एक IAM _उपयोगकर्ता_ एक इकाई है जिसे आप AWS में **उस व्यक्ति या एप्लिकेशन का प्रतिनिधित्व करने के लिए बनाते हैं** जो इसका उपयोग **AWS के साथ बातचीत करने के लिए** करता है। AWS में एक उपयोगकर्ता का नाम और क्रेडेंशियल्स (पासवर्ड और दो तक पहुँच कुंजी) होता है।
|
||||
|
||||
When you create an IAM user, you grant it **permissions** by making it a **member of a user group** that has appropriate permission policies attached (recommended), or by **directly attaching policies** to the user.
|
||||
जब आप एक IAM उपयोगकर्ता बनाते हैं, तो आप इसे **अनुमतियाँ** प्रदान करते हैं, इसे एक **उपयोगकर्ता समूह का सदस्य बनाकर** जो उचित अनुमति नीतियों से जुड़ा होता है (अनुशंसित), या **सीधे उपयोगकर्ता पर नीतियाँ संलग्न करके**।
|
||||
|
||||
Users can have **MFA enabled to login** through the console. API tokens of MFA enabled users aren't protected by MFA. If you want to **restrict the access of a users API keys using MFA** you need to indicate in the policy that in order to perform certain actions MFA needs to be present (example [**here**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_configure-api-require.html)).
|
||||
उपयोगकर्ताओं के पास कंसोल के माध्यम से लॉगिन करने के लिए **MFA सक्षम** हो सकता है। MFA सक्षम उपयोगकर्ताओं के API टोकन MFA द्वारा सुरक्षित नहीं होते हैं। यदि आप **MFA का उपयोग करके उपयोगकर्ताओं की API कुंजियों की पहुँच को प्रतिबंधित करना चाहते हैं** तो आपको नीति में यह इंगित करना होगा कि कुछ क्रियाएँ करने के लिए MFA की आवश्यकता है (उदाहरण [**यहाँ**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_configure-api-require.html))।
|
||||
|
||||
#### CLI
|
||||
|
||||
- **Access Key ID**: 20 random uppercase alphanumeric characters like AKHDNAPO86BSHKDIRYT
|
||||
- **Secret access key ID**: 40 random upper and lowercase characters: S836fh/J73yHSb64Ag3Rkdi/jaD6sPl6/antFtU (It's not possible to retrieve lost secret access key IDs).
|
||||
- **एक्सेस कुंजी आईडी**: 20 यादृच्छिक अपरकेस अल्फ़ान्यूमेरिक वर्ण जैसे AKHDNAPO86BSHKDIRYT
|
||||
- **गुप्त एक्सेस कुंजी आईडी**: 40 यादृच्छिक अपर और लोअरकेस वर्ण: S836fh/J73yHSb64Ag3Rkdi/jaD6sPl6/antFtU (खोई हुई गुप्त एक्सेस कुंजी आईडी को पुनः प्राप्त करना संभव नहीं है)।
|
||||
|
||||
Whenever you need to **change the Access Key** this is the process you should follow:\
|
||||
जब भी आपको **एक्सेस कुंजी बदलने की आवश्यकता हो** तो आपको इस प्रक्रिया का पालन करना चाहिए:\
|
||||
&#xNAN;_Create a new access key -> Apply the new key to system/application -> mark original one as inactive -> Test and verify new access key is working -> Delete old access key_
|
||||
|
||||
### MFA - Multi Factor Authentication
|
||||
### MFA - मल्टी फैक्टर प्रमाणीकरण
|
||||
|
||||
It's used to **create an additional factor for authentication** in addition to your existing methods, such as password, therefore, creating a multi-factor level of authentication.\
|
||||
You can use a **free virtual application or a physical device**. You can use apps like google authentication for free to activate a MFA in AWS.
|
||||
यह आपके मौजूदा तरीकों, जैसे पासवर्ड, के अतिरिक्त **प्रमाणीकरण के लिए एक अतिरिक्त कारक बनाने** के लिए उपयोग किया जाता है, इस प्रकार, प्रमाणीकरण का एक मल्टी-फैक्टर स्तर बनता है।\
|
||||
आप एक **नि:शुल्क वर्चुअल एप्लिकेशन या एक भौतिक उपकरण** का उपयोग कर सकते हैं। आप AWS में MFA सक्रिय करने के लिए मुफ्त में गूगल प्रमाणीकरण जैसे ऐप्स का उपयोग कर सकते हैं।
|
||||
|
||||
Policies with MFA conditions can be attached to the following:
|
||||
MFA शर्तों वाली नीतियाँ निम्नलिखित पर संलग्न की जा सकती हैं:
|
||||
|
||||
- An IAM user or group
|
||||
- A resource such as an Amazon S3 bucket, Amazon SQS queue, or Amazon SNS topic
|
||||
- The trust policy of an IAM role that can be assumed by a user
|
||||
|
||||
If you want to **access via CLI** a resource that **checks for MFA** you need to call **`GetSessionToken`**. That will give you a token with info about MFA.\
|
||||
Note that **`AssumeRole` credentials don't contain this information**.
|
||||
- एक IAM उपयोगकर्ता या समूह
|
||||
- एक संसाधन जैसे Amazon S3 बकेट, Amazon SQS कतार, या Amazon SNS विषय
|
||||
- एक IAM भूमिका की ट्रस्ट नीति जिसे एक उपयोगकर्ता द्वारा ग्रहण किया जा सकता है
|
||||
|
||||
यदि आप **CLI के माध्यम से पहुँच** करना चाहते हैं एक संसाधन जो **MFA की जाँच करता है** तो आपको **`GetSessionToken`** कॉल करना होगा। यह आपको MFA के बारे में जानकारी के साथ एक टोकन देगा।\
|
||||
ध्यान दें कि **`AssumeRole` क्रेडेंशियल्स में यह जानकारी नहीं होती**।
|
||||
```bash
|
||||
aws sts get-session-token --serial-number <arn_device> --token-code <code>
|
||||
```
|
||||
As [**यहां कहा गया है**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_configure-api-require.html), कई अलग-अलग मामले हैं जहां **MFA का उपयोग नहीं किया जा सकता**।
|
||||
|
||||
As [**stated here**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_configure-api-require.html), there are a lot of different cases where **MFA cannot be used**.
|
||||
### [IAM उपयोगकर्ता समूह](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html) <a href="#id_iam-groups" id="id_iam-groups"></a>
|
||||
|
||||
### [IAM user groups](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html) <a href="#id_iam-groups" id="id_iam-groups"></a>
|
||||
एक IAM [उपयोगकर्ता समूह](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html) एक ऐसा तरीका है जिससे **एक समय में कई उपयोगकर्ताओं के लिए नीतियों को संलग्न किया जा सकता है**, जिससे उन उपयोगकर्ताओं के लिए अनुमतियों का प्रबंधन करना आसान हो सकता है। **भूमिकाएँ और समूह समूह का हिस्सा नहीं हो सकते**।
|
||||
|
||||
An IAM [user group](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_groups.html) is a way to **attach policies to multiple users** at one time, which can make it easier to manage the permissions for those users. **Roles and groups cannot be part of a group**.
|
||||
आप एक **पहचान-आधारित नीति को एक उपयोगकर्ता समूह में संलग्न कर सकते हैं** ताकि उपयोगकर्ता समूह में सभी **उपयोगकर्ताओं को नीति की अनुमतियाँ प्राप्त हों**। आप **एक उपयोगकर्ता समूह** को **`Principal`** के रूप में **नीति** (जैसे संसाधन-आधारित नीति) में पहचान नहीं सकते क्योंकि समूह अनुमतियों से संबंधित होते हैं, प्रमाणीकरण से नहीं, और प्रिंसिपल प्रमाणीकरण किए गए IAM संस्थाएँ हैं।
|
||||
|
||||
You can attach an **identity-based policy to a user group** so that all of the **users** in the user group **receive the policy's permissions**. You **cannot** identify a **user group** as a **`Principal`** in a **policy** (such as a resource-based policy) because groups relate to permissions, not authentication, and principals are authenticated IAM entities.
|
||||
यहां उपयोगकर्ता समूहों की कुछ महत्वपूर्ण विशेषताएँ हैं:
|
||||
|
||||
Here are some important characteristics of user groups:
|
||||
- एक उपयोगकर्ता **समूह** में **कई उपयोगकर्ता हो सकते हैं**, और एक **उपयोगकर्ता** **कई समूहों का सदस्य हो सकता है**।
|
||||
- **उपयोगकर्ता समूहों को नेस्ट नहीं किया जा सकता**; वे केवल उपयोगकर्ताओं को शामिल कर सकते हैं, अन्य उपयोगकर्ता समूहों को नहीं।
|
||||
- **AWS खाते में सभी उपयोगकर्ताओं को स्वचालित रूप से शामिल करने वाला कोई डिफ़ॉल्ट उपयोगकर्ता समूह नहीं है**। यदि आप ऐसा उपयोगकर्ता समूह रखना चाहते हैं, तो आपको इसे बनाना होगा और प्रत्येक नए उपयोगकर्ता को इसमें असाइन करना होगा।
|
||||
- AWS खाते में IAM संसाधनों की संख्या और आकार, जैसे समूहों की संख्या, और एक उपयोगकर्ता जिस समूह का सदस्य हो सकता है, सीमित हैं। अधिक जानकारी के लिए, [IAM और AWS STS कोटा](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html) देखें।
|
||||
|
||||
- A user **group** can **contain many users**, and a **user** can **belong to multiple groups**.
|
||||
- **User groups can't be nested**; they can contain only users, not other user groups.
|
||||
- There is **no default user group that automatically includes all users in the AWS account**. If you want to have a user group like that, you must create it and assign each new user to it.
|
||||
- The number and size of IAM resources in an AWS account, such as the number of groups, and the number of groups that a user can be a member of, are limited. For more information, see [IAM and AWS STS quotas](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_iam-quotas.html).
|
||||
### [IAM भूमिकाएँ](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html) <a href="#id_iam-roles" id="id_iam-roles"></a>
|
||||
|
||||
### [IAM roles](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html) <a href="#id_iam-roles" id="id_iam-roles"></a>
|
||||
एक IAM **भूमिका** एक **उपयोगकर्ता** के समान है, क्योंकि यह एक **पहचान है जिसमें अनुमति नीतियाँ होती हैं जो यह निर्धारित करती हैं कि** यह AWS में क्या कर सकता है और क्या नहीं। हालाँकि, एक भूमिका के साथ कोई **क्रेडेंशियल्स** (पासवर्ड या एक्सेस कुंजी) नहीं होते। एक व्यक्ति के साथ विशेष रूप से जुड़े होने के बजाय, एक भूमिका को **किसी भी व्यक्ति द्वारा अपनाने के लिए डिज़ाइन किया गया है जिसे इसकी आवश्यकता है (और जिसके पास पर्याप्त अनुमतियाँ हैं)**। एक **IAM उपयोगकर्ता एक भूमिका को अस्थायी रूप से** एक विशिष्ट कार्य के लिए विभिन्न अनुमतियाँ लेने के लिए अपना सकता है। एक भूमिका को एक [**संघीय उपयोगकर्ता**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers.html) को असाइन किया जा सकता है जो IAM के बजाय एक बाहरी पहचान प्रदाता का उपयोग करके साइन इन करता है।
|
||||
|
||||
An IAM **role** is very **similar** to a **user**, in that it is an **identity with permission policies that determine what** it can and cannot do in AWS. However, a role **does not have any credentials** (password or access keys) associated with it. Instead of being uniquely associated with one person, a role is intended to be **assumable by anyone who needs it (and have enough perms)**. An **IAM user can assume a role to temporarily** take on different permissions for a specific task. A role can be **assigned to a** [**federated user**](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers.html) who signs in by using an external identity provider instead of IAM.
|
||||
एक IAM भूमिका में **दो प्रकार की नीतियाँ** होती हैं: एक **विश्वास नीति**, जो खाली नहीं हो सकती, यह परिभाषित करती है कि **कौन भूमिका को अपना सकता है**, और एक **अनुमति नीति**, जो खाली नहीं हो सकती, यह परिभाषित करती है कि **यह क्या एक्सेस कर सकता है**।
|
||||
|
||||
An IAM role consists of **two types of policies**: A **trust policy**, which cannot be empty, defining **who can assume** the role, and a **permissions policy**, which cannot be empty, defining **what it can access**.
|
||||
#### AWS सुरक्षा टोकन सेवा (STS)
|
||||
|
||||
#### AWS Security Token Service (STS)
|
||||
AWS सुरक्षा टोकन सेवा (STS) एक वेब सेवा है जो **अस्थायी, सीमित-विशेषाधिकार क्रेडेंशियल्स** के **जारी करने** की सुविधा प्रदान करती है। यह विशेष रूप से निम्नलिखित के लिए तैयार की गई है:
|
||||
|
||||
AWS Security Token Service (STS) is a web service that facilitates the **issuance of temporary, limited-privilege credentials**. It is specifically tailored for:
|
||||
### [IAM में अस्थायी क्रेडेंशियल्स](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html) <a href="#id_temp-creds" id="id_temp-creds"></a>
|
||||
|
||||
### [Temporary credentials in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html) <a href="#id_temp-creds" id="id_temp-creds"></a>
|
||||
**अस्थायी क्रेडेंशियल्स मुख्य रूप से IAM भूमिकाओं के साथ उपयोग की जाती हैं**, लेकिन इसके अन्य उपयोग भी हैं। आप अस्थायी क्रेडेंशियल्स का अनुरोध कर सकते हैं जिनमें आपके मानक IAM उपयोगकर्ता की तुलना में अधिक सीमित अनुमतियों का सेट होता है। यह **आपको** **अनुमत नहीं किए गए कार्यों को गलती से करने से रोकता है**। अस्थायी क्रेडेंशियल्स का एक लाभ यह है कि वे एक निर्धारित समय के बाद स्वचालित रूप से समाप्त हो जाते हैं। आपके पास यह नियंत्रित करने की क्षमता है कि क्रेडेंशियल्स कितने समय तक मान्य हैं।
|
||||
|
||||
**Temporary credentials are primarily used with IAM roles**, but there are also other uses. You can request temporary credentials that have a more restricted set of permissions than your standard IAM user. This **prevents** you from **accidentally performing tasks that are not permitted** by the more restricted credentials. A benefit of temporary credentials is that they expire automatically after a set period of time. You have control over the duration that the credentials are valid.
|
||||
### नीतियाँ
|
||||
|
||||
### Policies
|
||||
#### नीति अनुमतियाँ
|
||||
|
||||
#### Policy Permissions
|
||||
अनुमतियों को असाइन करने के लिए उपयोग की जाती हैं। 2 प्रकार हैं:
|
||||
|
||||
Are used to assign permissions. There are 2 types:
|
||||
|
||||
- AWS managed policies (preconfigured by AWS)
|
||||
- Customer Managed Policies: Configured by you. You can create policies based on AWS managed policies (modifying one of them and creating your own), using the policy generator (a GUI view that helps you granting and denying permissions) or writing your own..
|
||||
|
||||
By **default access** is **denied**, access will be granted if an explicit role has been specified.\
|
||||
If **single "Deny" exist, it will override the "Allow"**, except for requests that use the AWS account's root security credentials (which are allowed by default).
|
||||
- AWS प्रबंधित नीतियाँ (AWS द्वारा पूर्व-कॉन्फ़िगर की गई)
|
||||
- ग्राहक प्रबंधित नीतियाँ: आपके द्वारा कॉन्फ़िगर की गई। आप AWS प्रबंधित नीतियों के आधार पर नीतियाँ बना सकते हैं (उनमें से एक को संशोधित करके और अपनी खुद की बनाकर), नीति जनरेटर का उपयोग करके (एक GUI दृश्य जो आपको अनुमतियाँ देने और अस्वीकार करने में मदद करता है) या अपनी खुद की लिखकर।
|
||||
|
||||
**डिफ़ॉल्ट रूप से पहुँच** **अस्वीकृत** है, यदि एक स्पष्ट भूमिका निर्दिष्ट की गई है तो पहुँच दी जाएगी।\
|
||||
यदि **एकल "Deny" मौजूद है, तो यह "Allow" को ओवरराइड करेगा**, AWS खाते की रूट सुरक्षा क्रेडेंशियल्स का उपयोग करने वाले अनुरोधों को छोड़कर (जो डिफ़ॉल्ट रूप से अनुमति दी जाती हैं)।
|
||||
```javascript
|
||||
{
|
||||
"Version": "2012-10-17", //Version of the policy
|
||||
"Statement": [ //Main element, there can be more than 1 entry in this array
|
||||
{
|
||||
"Sid": "Stmt32894y234276923" //Unique identifier (optional)
|
||||
"Effect": "Allow", //Allow or deny
|
||||
"Action": [ //Actions that will be allowed or denied
|
||||
"ec2:AttachVolume",
|
||||
"ec2:DetachVolume"
|
||||
],
|
||||
"Resource": [ //Resource the action and effect will be applied to
|
||||
"arn:aws:ec2:*:*:volume/*",
|
||||
"arn:aws:ec2:*:*:instance/*"
|
||||
],
|
||||
"Condition": { //Optional element that allow to control when the permission will be effective
|
||||
"ArnEquals": {"ec2:SourceInstanceARN": "arn:aws:ec2:*:*:instance/instance-id"}
|
||||
}
|
||||
}
|
||||
]
|
||||
"Version": "2012-10-17", //Version of the policy
|
||||
"Statement": [ //Main element, there can be more than 1 entry in this array
|
||||
{
|
||||
"Sid": "Stmt32894y234276923" //Unique identifier (optional)
|
||||
"Effect": "Allow", //Allow or deny
|
||||
"Action": [ //Actions that will be allowed or denied
|
||||
"ec2:AttachVolume",
|
||||
"ec2:DetachVolume"
|
||||
],
|
||||
"Resource": [ //Resource the action and effect will be applied to
|
||||
"arn:aws:ec2:*:*:volume/*",
|
||||
"arn:aws:ec2:*:*:instance/*"
|
||||
],
|
||||
"Condition": { //Optional element that allow to control when the permission will be effective
|
||||
"ArnEquals": {"ec2:SourceInstanceARN": "arn:aws:ec2:*:*:instance/instance-id"}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
The [global fields that can be used for conditions in any service are documented here](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-resourceaccount).\
|
||||
The [specific fields that can be used for conditions per service are documented here](https://docs.aws.amazon.com/service-authorization/latest/reference/reference_policies_actions-resources-contextkeys.html).
|
||||
|
||||
#### Inline Policies
|
||||
|
||||
This kind of policies are **directly assigned** to a user, group or role. Then, they do not appear in the Policies list as any other one can use them.\
|
||||
Inline policies are useful if you want to **maintain a strict one-to-one relationship between a policy and the identity** that it's applied to. For example, you want to be sure that the permissions in a policy are not inadvertently assigned to an identity other than the one they're intended for. When you use an inline policy, the permissions in the policy cannot be inadvertently attached to the wrong identity. In addition, when you use the AWS Management Console to delete that identity, the policies embedded in the identity are deleted as well. That's because they are part of the principal entity.
|
||||
इस प्रकार की नीतियाँ **प्रत्यक्ष रूप से** एक उपयोगकर्ता, समूह या भूमिका को असाइन की जाती हैं। फिर, वे नीतियों की सूची में नहीं दिखाई देती हैं क्योंकि कोई अन्य उनका उपयोग कर सकता है।\
|
||||
Inline policies उपयोगी होती हैं यदि आप **एक नीति और उस पहचान के बीच एक सख्त एक-से-एक संबंध बनाए रखना चाहते हैं** जिस पर इसे लागू किया गया है। उदाहरण के लिए, आप यह सुनिश्चित करना चाहते हैं कि किसी नीति में अनुमतियाँ अनजाने में किसी अन्य पहचान को असाइन नहीं की गई हैं। जब आप एक inline policy का उपयोग करते हैं, तो नीति में अनुमतियाँ अनजाने में गलत पहचान से नहीं जुड़ सकतीं। इसके अलावा, जब आप AWS प्रबंधन कंसोल का उपयोग करके उस पहचान को हटाते हैं, तो पहचान में निहित नीतियाँ भी हटा दी जाती हैं। इसका कारण यह है कि वे प्रमुख इकाई का हिस्सा हैं।
|
||||
|
||||
#### Resource Bucket Policies
|
||||
|
||||
These are **policies** that can be defined in **resources**. **Not all resources of AWS supports them**.
|
||||
ये **नीतियाँ** हैं जिन्हें **संसाधनों** में परिभाषित किया जा सकता है। **AWS के सभी संसाधन उनका समर्थन नहीं करते**।
|
||||
|
||||
If a principal does not have an explicit deny on them, and a resource policy grants them access, then they are allowed.
|
||||
यदि किसी प्रमुख के पास उन पर स्पष्ट अस्वीकृति नहीं है, और एक संसाधन नीति उन्हें पहुँच प्रदान करती है, तो उन्हें अनुमति दी जाती है।
|
||||
|
||||
### IAM Boundaries
|
||||
|
||||
IAM boundaries can be used to **limit the permissions a user or role should have access to**. This way, even if a different set of permissions are granted to the user by a **different policy** the operation will **fail** if he tries to use them.
|
||||
IAM सीमाएँ **एक उपयोगकर्ता या भूमिका को पहुँच की अनुमतियों को सीमित करने के लिए** उपयोग की जा सकती हैं। इस तरह, भले ही उपयोगकर्ता को **एक अलग नीति** द्वारा अनुमतियों का एक अलग सेट दिया गया हो, यदि वह उनका उपयोग करने की कोशिश करता है तो संचालन **विफल** हो जाएगा।
|
||||
|
||||
A boundary is just a policy attached to a user which **indicates the maximum level of permissions the user or role can have**. So, **even if the user has Administrator access**, if the boundary indicates he can only read S· buckets, that's the maximum he can do.
|
||||
एक सीमा बस एक नीति है जो एक उपयोगकर्ता से जुड़ी होती है जो **यह संकेत करती है कि उपयोगकर्ता या भूमिका के पास अधिकतम अनुमतियों का स्तर क्या हो सकता है**। इसलिए, **भले ही उपयोगकर्ता के पास व्यवस्थापक पहुँच हो**, यदि सीमा यह संकेत करती है कि वह केवल S· बकेट पढ़ सकता है, तो यही अधिकतम है जो वह कर सकता है।
|
||||
|
||||
**This**, **SCPs** and **following the least privilege** principle are the ways to control that users doesn't have more permissions than the ones he needs.
|
||||
**यह**, **SCPs** और **कम से कम विशेषाधिकार** सिद्धांत का पालन करना उन तरीकों में से हैं जिनसे यह नियंत्रित किया जा सकता है कि उपयोगकर्ताओं के पास उनकी आवश्यकताओं से अधिक अनुमतियाँ नहीं हैं।
|
||||
|
||||
### Session Policies
|
||||
|
||||
A session policy is a **policy set when a role is assumed** somehow. This will be like an **IAM boundary for that session**: This means that the session policy doesn't grant permissions but **restrict them to the ones indicated in the policy** (being the max permissions the ones the role has).
|
||||
|
||||
This is useful for **security meassures**: When an admin is going to assume a very privileged role he could restrict the permission to only the ones indicated in the session policy in case the session gets compromised.
|
||||
एक सत्र नीति एक **नीति है जो तब सेट की जाती है जब किसी भूमिका को किसी तरह से ग्रहण किया जाता है**। यह उस सत्र के लिए एक **IAM सीमा** की तरह होगी: इसका मतलब है कि सत्र नीति अनुमतियाँ नहीं देती है बल्कि **उन्हें नीति में निर्दिष्ट अनुमतियों तक सीमित करती है** (अधिकतम अनुमतियाँ वे होती हैं जो भूमिका के पास होती हैं)।
|
||||
|
||||
यह **सुरक्षा उपायों** के लिए उपयोगी है: जब एक व्यवस्थापक एक बहुत विशेषाधिकार प्राप्त भूमिका ग्रहण करने जा रहा है, तो वह सत्र नीति में निर्दिष्ट अनुमतियों तक ही अनुमति को सीमित कर सकता है यदि सत्र से समझौता किया जाता है।
|
||||
```bash
|
||||
aws sts assume-role \
|
||||
--role-arn <value> \
|
||||
--role-session-name <value> \
|
||||
[--policy-arns <arn_custom_policy1> <arn_custom_policy2>]
|
||||
[--policy <file://policy.json>]
|
||||
--role-arn <value> \
|
||||
--role-session-name <value> \
|
||||
[--policy-arns <arn_custom_policy1> <arn_custom_policy2>]
|
||||
[--policy <file://policy.json>]
|
||||
```
|
||||
|
||||
Note that by default **AWS might add session policies to sessions** that are going to be generated because of third reasons. For example, in [unauthenticated cognito assumed roles](../aws-services/aws-cognito-enum/cognito-identity-pools.md#accessing-iam-roles) by default (using enhanced authentication), AWS will generate **session credentials with a session policy** that limits the services that session can access [**to the following list**](https://docs.aws.amazon.com/cognito/latest/developerguide/iam-roles.html#access-policies-scope-down-services).
|
||||
|
||||
Therefore, if at some point you face the error "... because no session policy allows the ...", and the role has access to perform the action, it's because **there is a session policy preventing it**.
|
||||
इसलिए, यदि किसी बिंदु पर आप त्रुटि का सामना करते हैं "... क्योंकि कोई सत्र नीति अनुमति नहीं देती है ...", और भूमिका को कार्रवाई करने की अनुमति है, तो इसका कारण है कि **एक सत्र नीति इसे रोक रही है**।
|
||||
|
||||
### Identity Federation
|
||||
### पहचान संघ
|
||||
|
||||
Identity federation **allows users from identity providers which are external** to AWS to access AWS resources securely without having to supply AWS user credentials from a valid IAM user account.\
|
||||
An example of an identity provider can be your own corporate **Microsoft Active Directory** (via **SAML**) or **OpenID** services (like **Google**). Federated access will then allow the users within it to access AWS.
|
||||
पहचान संघ **AWS के लिए बाहरी पहचान प्रदाताओं से उपयोगकर्ताओं को सुरक्षित रूप से AWS संसाधनों तक पहुँचने की अनुमति देता है** बिना किसी मान्य IAM उपयोगकर्ता खाते से AWS उपयोगकर्ता क्रेडेंशियल प्रदान किए।\
|
||||
एक पहचान प्रदाता का उदाहरण आपका अपना कॉर्पोरेट **Microsoft Active Directory** (द्वारा **SAML**) या **OpenID** सेवाएँ (जैसे **Google**) हो सकता है। संघीय पहुँच फिर उपयोगकर्ताओं को AWS तक पहुँचने की अनुमति देगी।
|
||||
|
||||
To configure this trust, an **IAM Identity Provider is generated (SAML or OAuth)** that will **trust** the **other platform**. Then, at least one **IAM role is assigned (trusting) to the Identity Provider**. If a user from the trusted platform access AWS, he will be accessing as the mentioned role.
|
||||
इस विश्वास को कॉन्फ़िगर करने के लिए, एक **IAM पहचान प्रदाता उत्पन्न किया जाता है (SAML या OAuth)** जो **अन्य प्लेटफ़ॉर्म** पर **विश्वास करेगा**। फिर, कम से कम एक **IAM भूमिका (विश्वास करने वाली) पहचान प्रदाता को सौंपा जाता है**। यदि विश्वसनीय प्लेटफ़ॉर्म से एक उपयोगकर्ता AWS तक पहुँचता है, तो वह उल्लेखित भूमिका के रूप में पहुँच रहा होगा।
|
||||
|
||||
However, you will usually want to give a **different role depending on the group of the user** in the third party platform. Then, several **IAM roles can trust** the third party Identity Provider and the third party platform will be the one allowing users to assume one role or the other.
|
||||
हालांकि, आप आमतौर पर **उपयोगकर्ता के समूह के आधार पर एक अलग भूमिका देना चाहेंगे** तीसरे पक्ष के प्लेटफ़ॉर्म में। फिर, कई **IAM भूमिकाएँ तीसरे पक्ष के पहचान प्रदाता पर विश्वास कर सकती हैं** और तीसरा पक्ष का प्लेटफ़ॉर्म उपयोगकर्ताओं को एक भूमिका या दूसरी भूमिका ग्रहण करने की अनुमति देगा।
|
||||
|
||||
<figure><img src="../../../images/image (247).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
### IAM Identity Center
|
||||
### IAM पहचान केंद्र
|
||||
|
||||
AWS IAM Identity Center (successor to AWS Single Sign-On) expands the capabilities of AWS Identity and Access Management (IAM) to provide a **central plac**e that brings together **administration of users and their access to AWS** accounts and cloud applications.
|
||||
AWS IAM पहचान केंद्र (AWS सिंगल साइन-ऑन का उत्तराधिकारी) AWS पहचान और पहुँच प्रबंधन (IAM) की क्षमताओं का विस्तार करता है ताकि **उपयोगकर्ताओं और उनके AWS** खातों और क्लाउड अनुप्रयोगों तक पहुँच के प्रशासन को एक **केंद्रीय स्थान** में लाया जा सके।
|
||||
|
||||
The login domain is going to be something like `<user_input>.awsapps.com`.
|
||||
लॉगिन डोमेन कुछ इस तरह होगा `<user_input>.awsapps.com`।
|
||||
|
||||
To login users, there are 3 identity sources that can be used:
|
||||
उपयोगकर्ताओं को लॉगिन करने के लिए, 3 पहचान स्रोतों का उपयोग किया जा सकता है:
|
||||
|
||||
- Identity Center Directory: Regular AWS users
|
||||
- Active Directory: Supports different connectors
|
||||
- External Identity Provider: All users and groups come from an external Identity Provider (IdP)
|
||||
- पहचान केंद्र निर्देशिका: नियमित AWS उपयोगकर्ता
|
||||
- सक्रिय निर्देशिका: विभिन्न कनेक्टर्स का समर्थन करता है
|
||||
- बाहरी पहचान प्रदाता: सभी उपयोगकर्ता और समूह एक बाहरी पहचान प्रदाता (IdP) से आते हैं
|
||||
|
||||
<figure><img src="../../../images/image (279).png" alt=""><figcaption></figcaption></figure>
|
||||
|
||||
In the simplest case of Identity Center directory, the **Identity Center will have a list of users & groups** and will be able to **assign policies** to them to **any of the accounts** of the organization.
|
||||
पहचान केंद्र निर्देशिका के सबसे सरल मामले में, **पहचान केंद्र के पास उपयोगकर्ताओं और समूहों की एक सूची होगी** और वह उन्हें संगठन के **किसी भी खाते** के लिए **नीतियाँ सौंपने में सक्षम होगा**।
|
||||
|
||||
In order to give access to a Identity Center user/group to an account a **SAML Identity Provider trusting the Identity Center will be created**, and a **role trusting the Identity Provider with the indicated policies will be created** in the destination account.
|
||||
एक पहचान केंद्र उपयोगकर्ता/समूह को एक खाते तक पहुँच देने के लिए एक **SAML पहचान प्रदाता जो पहचान केंद्र पर विश्वास करता है, बनाया जाएगा**, और एक **भूमिका जो निर्दिष्ट नीतियों के साथ पहचान प्रदाता पर विश्वास करती है, गंतव्य खाते में बनाई जाएगी**।
|
||||
|
||||
#### AwsSSOInlinePolicy
|
||||
|
||||
It's possible to **give permissions via inline policies to roles created via IAM Identity Center**. The roles created in the accounts being given **inline policies in AWS Identity Center** will have these permissions in an inline policy called **`AwsSSOInlinePolicy`**.
|
||||
यह संभव है कि **IAM पहचान केंद्र के माध्यम से बनाई गई भूमिकाओं को इनलाइन नीतियों के माध्यम से अनुमतियाँ दी जाएं**। उन खातों में बनाई गई भूमिकाएँ जिन्हें **AWS पहचान केंद्र में इनलाइन नीतियाँ दी गई हैं** इनलाइन नीति में **`AwsSSOInlinePolicy`** के रूप में ये अनुमतियाँ होंगी।
|
||||
|
||||
Therefore, even if you see 2 roles with an inline policy called **`AwsSSOInlinePolicy`**, it **doesn't mean it has the same permissions**.
|
||||
इसलिए, भले ही आप **`AwsSSOInlinePolicy`** नामक इनलाइन नीति के साथ 2 भूमिकाएँ देखें, यह **यह नहीं दर्शाता कि इसकी समान अनुमतियाँ हैं**।
|
||||
|
||||
### Cross Account Trusts and Roles
|
||||
### क्रॉस खाता विश्वास और भूमिकाएँ
|
||||
|
||||
**A user** (trusting) can create a Cross Account Role with some policies and then, **allow another user** (trusted) to **access his account** but only **having the access indicated in the new role policies**. To create this, just create a new Role and select Cross Account Role. Roles for Cross-Account Access offers two options. Providing access between AWS accounts that you own, and providing access between an account that you own and a third party AWS account.\
|
||||
It's recommended to **specify the user who is trusted and not put some generic thing** because if not, other authenticated users like federated users will be able to also abuse this trust.
|
||||
**एक उपयोगकर्ता** (विश्वास करने वाला) कुछ नीतियों के साथ एक क्रॉस खाता भूमिका बना सकता है और फिर, **दूसरे उपयोगकर्ता** (विश्वासित) को **अपने खाते तक पहुँचने की अनुमति दे सकता है** लेकिन केवल **नई भूमिका नीतियों में निर्दिष्ट पहुँच के साथ**। इसे बनाने के लिए, बस एक नई भूमिका बनाएँ और क्रॉस खाता भूमिका का चयन करें। क्रॉस-खाता पहुँच के लिए भूमिकाएँ दो विकल्प प्रदान करती हैं। उन AWS खातों के बीच पहुँच प्रदान करना जो आपके पास हैं, और एक खाते के बीच पहुँच प्रदान करना जो आपके पास है और एक तीसरे पक्ष के AWS खाते के बीच।\
|
||||
यह अनुशंसा की जाती है कि **विश्वासित उपयोगकर्ता को निर्दिष्ट करें और कुछ सामान्य चीज़ न डालें** क्योंकि यदि नहीं, तो अन्य प्रमाणित उपयोगकर्ता जैसे संघीय उपयोगकर्ता भी इस विश्वास का दुरुपयोग कर सकेंगे।
|
||||
|
||||
### AWS Simple AD
|
||||
### AWS सरल AD
|
||||
|
||||
Not supported:
|
||||
समर्थित नहीं:
|
||||
|
||||
- Trust Relations
|
||||
- AD Admin Center
|
||||
- Full PS API support
|
||||
- AD Recycle Bin
|
||||
- Group Managed Service Accounts
|
||||
- Schema Extensions
|
||||
- No Direct access to OS or Instances
|
||||
- विश्वास संबंध
|
||||
- AD प्रशासन केंद्र
|
||||
- पूर्ण PS API समर्थन
|
||||
- AD रीसाइक्ल बिन
|
||||
- समूह प्रबंधित सेवा खाते
|
||||
- स्कीमा एक्सटेंशन
|
||||
- OS या उदाहरणों तक सीधी पहुँच नहीं
|
||||
|
||||
#### Web Federation or OpenID Authentication
|
||||
#### वेब संघ या OpenID प्रमाणीकरण
|
||||
|
||||
The app uses the AssumeRoleWithWebIdentity to create temporary credentials. However, this doesn't grant access to the AWS console, just access to resources within AWS.
|
||||
ऐप अस्थायी क्रेडेंशियल बनाने के लिए AssumeRoleWithWebIdentity का उपयोग करता है। हालाँकि, यह AWS कंसोल तक पहुँच प्रदान नहीं करता है, केवल AWS के भीतर संसाधनों तक पहुँच प्रदान करता है।
|
||||
|
||||
### Other IAM options
|
||||
### अन्य IAM विकल्प
|
||||
|
||||
- You can **set a password policy setting** options like minimum length and password requirements.
|
||||
- You can **download "Credential Report"** with information about current credentials (like user creation time, is password enabled...). You can generate a credential report as often as once every **four hours**.
|
||||
- आप **पासवर्ड नीति सेटिंग** विकल्प जैसे न्यूनतम लंबाई और पासवर्ड आवश्यकताओं को सेट कर सकते हैं।
|
||||
- आप **"क्रेडेंशियल रिपोर्ट" डाउनलोड कर सकते हैं** जिसमें वर्तमान क्रेडेंशियल्स के बारे में जानकारी होती है (जैसे उपयोगकर्ता निर्माण समय, क्या पासवर्ड सक्षम है...)। आप एक क्रेडेंशियल रिपोर्ट हर **चार घंटे** में एक बार उत्पन्न कर सकते हैं।
|
||||
|
||||
AWS Identity and Access Management (IAM) provides **fine-grained access control** across all of AWS. With IAM, you can specify **who can access which services and resources**, and under which conditions. With IAM policies, you manage permissions to your workforce and systems to **ensure least-privilege permissions**.
|
||||
AWS पहचान और पहुँच प्रबंधन (IAM) **AWS के सभी क्षेत्रों में बारीक पहुँच नियंत्रण** प्रदान करता है। IAM के साथ, आप निर्दिष्ट कर सकते हैं **कौन कौन सी सेवाओं और संसाधनों तक पहुँच सकता है**, और किन शर्तों के तहत। IAM नीतियों के साथ, आप अपनी कार्यबल और प्रणालियों के लिए अनुमतियों का प्रबंधन करते हैं ताकि **कम से कम विशेषाधिकार अनुमतियाँ सुनिश्चित की जा सकें**।
|
||||
|
||||
### IAM ID Prefixes
|
||||
### IAM ID उपसर्ग
|
||||
|
||||
In [**this page**](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-unique-ids) you can find the **IAM ID prefixe**d of keys depending on their nature:
|
||||
[**इस पृष्ठ**](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html#identifiers-unique-ids) पर आप कुंजियों के **IAM ID उपसर्ग** उनकी प्रकृति के अनुसार पा सकते हैं:
|
||||
|
||||
| ABIA | [AWS STS service bearer token](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_bearer.html) |
|
||||
| ABIA | [AWS STS सेवा धारक टोकन](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_bearer.html) |
|
||||
| ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| ACCA | Context-specific credential |
|
||||
| AGPA | User group |
|
||||
| AIDA | IAM user |
|
||||
| AIPA | Amazon EC2 instance profile |
|
||||
| AKIA | Access key |
|
||||
| ANPA | Managed policy |
|
||||
| ANVA | Version in a managed policy |
|
||||
| APKA | Public key |
|
||||
| AROA | Role |
|
||||
| ASCA | Certificate |
|
||||
| ASIA | [Temporary (AWS STS) access key IDs](https://docs.aws.amazon.com/STS/latest/APIReference/API_Credentials.html) use this prefix, but are unique only in combination with the secret access key and the session token. |
|
||||
| ACCA | संदर्भ-विशिष्ट क्रेडेंशियल |
|
||||
| AGPA | उपयोगकर्ता समूह |
|
||||
| AIDA | IAM उपयोगकर्ता |
|
||||
| AIPA | अमेज़न EC2 उदाहरण प्रोफ़ाइल |
|
||||
| AKIA | पहुँच कुंजी |
|
||||
| ANPA | प्रबंधित नीति |
|
||||
| ANVA | प्रबंधित नीति में संस्करण |
|
||||
| APKA | सार्वजनिक कुंजी |
|
||||
| AROA | भूमिका |
|
||||
| ASCA | प्रमाणपत्र |
|
||||
| ASIA | [अस्थायी (AWS STS) पहुँच कुंजी आईडी](https://docs.aws.amazon.com/STS/latest/APIReference/API_Credentials.html) इस उपसर्ग का उपयोग करती हैं, लेकिन केवल गुप्त पहुँच कुंजी और सत्र टोकन के संयोजन में अद्वितीय होती हैं। |
|
||||
|
||||
### Recommended permissions to audit accounts
|
||||
### खातों का ऑडिट करने के लिए अनुशंसित अनुमतियाँ
|
||||
|
||||
The following privileges grant various read access of metadata:
|
||||
निम्नलिखित विशेषाधिकार विभिन्न मेटाडेटा के पढ़ने की पहुँच प्रदान करते हैं:
|
||||
|
||||
- `arn:aws:iam::aws:policy/SecurityAudit`
|
||||
- `arn:aws:iam::aws:policy/job-function/ViewOnlyAccess`
|
||||
@@ -336,14 +322,13 @@ The following privileges grant various read access of metadata:
|
||||
- `directconnect:DescribeConnections`
|
||||
- `dynamodb:ListTables`
|
||||
|
||||
## Misc
|
||||
## विविध
|
||||
|
||||
### CLI Authentication
|
||||
|
||||
In order for a regular user authenticate to AWS via CLI you need to have **local credentials**. By default you can configure them **manually** in `~/.aws/credentials` or by **running** `aws configure`.\
|
||||
In that file you can have more than one profile, if **no profile** is specified using the **aws cli**, the one called **`[default]`** in that file will be used.\
|
||||
Example of credentials file with more than 1 profile:
|
||||
### CLI प्रमाणीकरण
|
||||
|
||||
एक नियमित उपयोगकर्ता को CLI के माध्यम से AWS में प्रमाणीकरण करने के लिए **स्थानीय क्रेडेंशियल्स** होना आवश्यक है। डिफ़ॉल्ट रूप से, आप उन्हें **हाथ से** `~/.aws/credentials` में कॉन्फ़िगर कर सकते हैं या **चलाकर** `aws configure`।\
|
||||
उस फ़ाइल में आपके पास एक से अधिक प्रोफ़ाइल हो सकती हैं, यदि **कोई प्रोफ़ाइल** निर्दिष्ट नहीं की गई है तो **aws cli** का उपयोग करते समय, उस फ़ाइल में **`[default]`** नामक प्रोफ़ाइल का उपयोग किया जाएगा।\
|
||||
एक से अधिक प्रोफ़ाइल के साथ क्रेडेंशियल फ़ाइल का उदाहरण:
|
||||
```
|
||||
[default]
|
||||
aws_access_key_id = AKIA5ZDCUJHF83HDTYUT
|
||||
@@ -354,12 +339,10 @@ aws_access_key_id = AKIA8YDCu7TGTR356SHYT
|
||||
aws_secret_access_key = uOcdhof683fbOUGFYEQuR2EIHG34UY987g6ff7
|
||||
region = eu-west-2
|
||||
```
|
||||
यदि आपको **विभिन्न AWS खातों** तक पहुँचने की आवश्यकता है और आपके प्रोफ़ाइल को **उन खातों के अंदर एक भूमिका ग्रहण करने** की अनुमति दी गई है, तो आपको हर बार मैन्युअल रूप से STS को कॉल करने की आवश्यकता नहीं है (`aws sts assume-role --role-arn <role-arn> --role-session-name sessname`) और क्रेडेंशियल्स को कॉन्फ़िगर करने की।
|
||||
|
||||
If you need to access **different AWS accounts** and your profile was given access to **assume a role inside those accounts**, you don't need to call manually STS every time (`aws sts assume-role --role-arn <role-arn> --role-session-name sessname`) and configure the credentials.
|
||||
|
||||
You can use the `~/.aws/config` file to[ **indicate which roles to assume**](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html), and then use the `--profile` param as usual (the `assume-role` will be performed in a transparent way for the user).\
|
||||
A config file example:
|
||||
|
||||
आप `~/.aws/config` फ़ाइल का उपयोग कर सकते हैं[ **यह इंगित करने के लिए कि कौन सी भूमिकाएँ ग्रहण करनी हैं**](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-role.html), और फिर सामान्य रूप से `--profile` पैरामीटर का उपयोग करें (भूमिका ग्रहण करना उपयोगकर्ता के लिए पारदर्शी तरीके से किया जाएगा)।\
|
||||
एक कॉन्फ़िग फ़ाइल का उदाहरण:
|
||||
```
|
||||
[profile acc2]
|
||||
region=eu-west-2
|
||||
@@ -368,23 +351,16 @@ role_session_name = <session_name>
|
||||
source_profile = <profile_with_assume_role>
|
||||
sts_regional_endpoints = regional
|
||||
```
|
||||
|
||||
With this config file you can then use aws cli like:
|
||||
|
||||
इस कॉन्फ़िग फ़ाइल के साथ आप aws cli का उपयोग कर सकते हैं जैसे:
|
||||
```
|
||||
aws --profile acc2 ...
|
||||
```
|
||||
यदि आप इसके लिए कुछ **समान** खोज रहे हैं लेकिन **ब्राउज़र** के लिए, तो आप **एक्सटेंशन** [**AWS Extend Switch Roles**](https://chrome.google.com/webstore/detail/aws-extend-switch-roles/jpmkfafbacpgapdghgdpembnojdlgkdl?hl=en) देख सकते हैं।
|
||||
|
||||
If you are looking for something **similar** to this but for the **browser** you can check the **extension** [**AWS Extend Switch Roles**](https://chrome.google.com/webstore/detail/aws-extend-switch-roles/jpmkfafbacpgapdghgdpembnojdlgkdl?hl=en).
|
||||
|
||||
## References
|
||||
## संदर्भ
|
||||
|
||||
- [https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html](https://docs.aws.amazon.com/organizations/latest/userguide/orgs_getting-started_concepts.html)
|
||||
- [https://aws.amazon.com/iam/](https://aws.amazon.com/iam/)
|
||||
- [https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html](https://docs.aws.amazon.com/singlesignon/latest/userguide/what-is.html)
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -4,84 +4,81 @@
|
||||
|
||||
## SAML
|
||||
|
||||
For info about SAML please check:
|
||||
SAML के बारे में जानकारी के लिए कृपया देखें:
|
||||
|
||||
{{#ref}}
|
||||
https://book.hacktricks.xyz/pentesting-web/saml-attacks
|
||||
{{#endref}}
|
||||
|
||||
In order to configure an **Identity Federation through SAML** you just need to provide a **name** and the **metadata XML** containing all the SAML configuration (**endpoints**, **certificate** with public key)
|
||||
**SAML** के माध्यम से **Identity Federation** को कॉन्फ़िगर करने के लिए आपको केवल एक **नाम** और **metadata XML** प्रदान करने की आवश्यकता है जिसमें सभी SAML कॉन्फ़िगरेशन (**endpoints**, **certificate** जिसमें सार्वजनिक कुंजी है) शामिल हैं।
|
||||
|
||||
## OIDC - Github Actions Abuse
|
||||
|
||||
In order to add a github action as Identity provider:
|
||||
|
||||
1. For _Provider type_, select **OpenID Connect**.
|
||||
2. For _Provider URL_, enter `https://token.actions.githubusercontent.com`
|
||||
3. Click on _Get thumbprint_ to get the thumbprint of the provider
|
||||
4. For _Audience_, enter `sts.amazonaws.com`
|
||||
5. Create a **new role** with the **permissions** the github action need and a **trust policy** that trust the provider like:
|
||||
- ```json
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"Federated": "arn:aws:iam::0123456789:oidc-provider/token.actions.githubusercontent.com"
|
||||
},
|
||||
"Action": "sts:AssumeRoleWithWebIdentity",
|
||||
"Condition": {
|
||||
"StringEquals": {
|
||||
"token.actions.githubusercontent.com:sub": [
|
||||
"repo:ORG_OR_USER_NAME/REPOSITORY:pull_request",
|
||||
"repo:ORG_OR_USER_NAME/REPOSITORY:ref:refs/heads/main"
|
||||
],
|
||||
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
6. Note in the previous policy how only a **branch** from **repository** of an **organization** was authorized with a specific **trigger**.
|
||||
7. The **ARN** of the **role** the github action is going to be able to **impersonate** is going to be the "secret" the github action needs to know, so **store** it inside a **secret** inside an **environment**.
|
||||
8. Finally use a github action to configure the AWS creds to be used by the workflow:
|
||||
एक github action को Identity provider के रूप में जोड़ने के लिए:
|
||||
|
||||
1. _Provider type_ के लिए, **OpenID Connect** चुनें।
|
||||
2. _Provider URL_ के लिए, `https://token.actions.githubusercontent.com` दर्ज करें।
|
||||
3. प्रदाता का थंबप्रिंट प्राप्त करने के लिए _Get thumbprint_ पर क्लिक करें।
|
||||
4. _Audience_ के लिए, `sts.amazonaws.com` दर्ज करें।
|
||||
5. एक **नया भूमिका** बनाएं जिसमें **permissions** हों जो github action को चाहिए और एक **trust policy** जो प्रदाता पर भरोसा करती हो जैसे:
|
||||
- ```json
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"Federated": "arn:aws:iam::0123456789:oidc-provider/token.actions.githubusercontent.com"
|
||||
},
|
||||
"Action": "sts:AssumeRoleWithWebIdentity",
|
||||
"Condition": {
|
||||
"StringEquals": {
|
||||
"token.actions.githubusercontent.com:sub": [
|
||||
"repo:ORG_OR_USER_NAME/REPOSITORY:pull_request",
|
||||
"repo:ORG_OR_USER_NAME/REPOSITORY:ref:refs/heads/main"
|
||||
],
|
||||
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
6. पिछले नीति में ध्यान दें कि केवल एक **branch** को **repository** के **organization** से एक विशिष्ट **trigger** के साथ अधिकृत किया गया था।
|
||||
7. **role** का **ARN** जिसे github action **impersonate** करने में सक्षम होगा, वह "secret" होगा जिसे github action को जानने की आवश्यकता है, इसलिए इसे एक **secret** के अंदर एक **environment** में **store** करें।
|
||||
8. अंत में, AWS creds को कॉन्फ़िगर करने के लिए एक github action का उपयोग करें जो workflow द्वारा उपयोग किया जाएगा:
|
||||
```yaml
|
||||
name: "test AWS Access"
|
||||
|
||||
# The workflow should only trigger on pull requests to the main branch
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
# Required to get the ID Token that will be used for OIDC
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: read # needed for private repos to checkout
|
||||
id-token: write
|
||||
contents: read # needed for private repos to checkout
|
||||
|
||||
jobs:
|
||||
aws:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
aws:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
aws-region: eu-west-1
|
||||
role-to-assume:${{ secrets.READ_ROLE }}
|
||||
role-session-name: OIDCSession
|
||||
- name: Configure AWS Credentials
|
||||
uses: aws-actions/configure-aws-credentials@v1
|
||||
with:
|
||||
aws-region: eu-west-1
|
||||
role-to-assume:${{ secrets.READ_ROLE }}
|
||||
role-session-name: OIDCSession
|
||||
|
||||
- run: aws sts get-caller-identity
|
||||
shell: bash
|
||||
- run: aws sts get-caller-identity
|
||||
shell: bash
|
||||
```
|
||||
|
||||
## OIDC - EKS Abuse
|
||||
|
||||
## OIDC - EKS दुरुपयोग
|
||||
```bash
|
||||
# Crate an EKS cluster (~10min)
|
||||
eksctl create cluster --name demo --fargate
|
||||
@@ -91,43 +88,34 @@ eksctl create cluster --name demo --fargate
|
||||
# Create an Identity Provider for an EKS cluster
|
||||
eksctl utils associate-iam-oidc-provider --cluster Testing --approve
|
||||
```
|
||||
|
||||
It's possible to generate **OIDC providers** in an **EKS** cluster simply by setting the **OIDC URL** of the cluster as a **new Open ID Identity provider**. This is a common default policy:
|
||||
|
||||
यह संभव है कि **EKS** क्लस्टर में **OIDC प्रदाताओं** को केवल क्लस्टर के **OIDC URL** को **नए Open ID पहचान प्रदाता** के रूप में सेट करके उत्पन्न किया जा सके। यह एक सामान्य डिफ़ॉल्ट नीति है:
|
||||
```json
|
||||
{
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"Federated": "arn:aws:iam::123456789098:oidc-provider/oidc.eks.us-east-1.amazonaws.com/id/20C159CDF6F2349B68846BEC03BE031B"
|
||||
},
|
||||
"Action": "sts:AssumeRoleWithWebIdentity",
|
||||
"Condition": {
|
||||
"StringEquals": {
|
||||
"oidc.eks.us-east-1.amazonaws.com/id/20C159CDF6F2349B68846BEC03BE031B:aud": "sts.amazonaws.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"Federated": "arn:aws:iam::123456789098:oidc-provider/oidc.eks.us-east-1.amazonaws.com/id/20C159CDF6F2349B68846BEC03BE031B"
|
||||
},
|
||||
"Action": "sts:AssumeRoleWithWebIdentity",
|
||||
"Condition": {
|
||||
"StringEquals": {
|
||||
"oidc.eks.us-east-1.amazonaws.com/id/20C159CDF6F2349B68846BEC03BE031B:aud": "sts.amazonaws.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
यह नीति सही ढंग से संकेत कर रही है कि **केवल** **EKS क्लस्टर** जिसका **id** `20C159CDF6F2349B68846BEC03BE031B` है, वह भूमिका ग्रहण कर सकता है। हालाँकि, यह यह नहीं बता रहा है कि कौन सी सेवा खाता इसे ग्रहण कर सकता है, जिसका अर्थ है कि **कोई भी सेवा खाता जिसमें एक वेब पहचान टोकन है** वह भूमिका ग्रहण करने में **सक्षम होगा**।
|
||||
|
||||
This policy is correctly indicating than **only** the **EKS cluster** with **id** `20C159CDF6F2349B68846BEC03BE031B` can assume the role. However, it's not indicting which service account can assume it, which means that A**NY service account with a web identity token** is going to be **able to assume** the role.
|
||||
|
||||
In order to specify **which service account should be able to assume the role,** it's needed to specify a **condition** where the **service account name is specified**, such as:
|
||||
|
||||
**जिस सेवा खाते को भूमिका ग्रहण करने में सक्षम होना चाहिए,** उसे निर्दिष्ट करने के लिए, एक **शर्त** निर्दिष्ट करना आवश्यक है जहाँ **सेवा खाता नाम निर्दिष्ट किया गया है**, जैसे:
|
||||
```bash
|
||||
"oidc.eks.region-code.amazonaws.com/id/20C159CDF6F2349B68846BEC03BE031B:sub": "system:serviceaccount:default:my-service-account",
|
||||
```
|
||||
|
||||
## References
|
||||
## संदर्भ
|
||||
|
||||
- [https://www.eliasbrange.dev/posts/secure-aws-deploys-from-github-actions-with-oidc/](https://www.eliasbrange.dev/posts/secure-aws-deploys-from-github-actions-with-oidc/)
|
||||
|
||||
{{#include ../../../banners/hacktricks-training.md}}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user