|
| 1 | +--- |
| 2 | +title: "2FA Enforcement" |
| 3 | +description: "Learn how to enforce Two-Factor Authentication (2FA) for all members of your organization to enhance security and protect your apps." |
| 4 | +sidebar: |
| 5 | + order: 10 |
| 6 | +--- |
| 7 | + |
| 8 | +import { Aside, Steps } from '@astrojs/starlight/components'; |
| 9 | + |
| 10 | +Two-Factor Authentication (2FA) enforcement allows organization administrators to require all members to have 2FA enabled on their accounts before accessing organization resources. This ensures a higher level of security for your apps and data. |
| 11 | + |
| 12 | +## Overview |
| 13 | + |
| 14 | +When 2FA enforcement is enabled for an organization: |
| 15 | +- All members must have 2FA enabled on their Capgo account |
| 16 | +- Members without 2FA will be denied access to the organization's apps |
| 17 | +- Both the web dashboard and CLI will enforce this requirement |
| 18 | +- New members must enable 2FA before they can access organization resources |
| 19 | + |
| 20 | +<Aside type="tip"> |
| 21 | + |
| 22 | +2FA enforcement is particularly important for: |
| 23 | +- Enterprise organizations with strict security policies |
| 24 | +- Teams handling sensitive user data |
| 25 | +- Organizations in regulated industries (healthcare, finance, etc.) |
| 26 | +- Companies requiring SOC 2 or ISO 27001 compliance |
| 27 | + |
| 28 | +</Aside> |
| 29 | + |
| 30 | +## How It Works |
| 31 | + |
| 32 | +### Web Dashboard |
| 33 | +When you try to access an organization that requires 2FA, and you don't have it enabled: |
| 34 | +1. You'll see an access denied message |
| 35 | +2. You'll be directed to enable 2FA in your account settings |
| 36 | +3. Once enabled, you can access the organization normally |
| 37 | + |
| 38 | +### CLI Access |
| 39 | +When using the Capgo CLI to interact with apps in an organization that requires 2FA: |
| 40 | + |
| 41 | +``` |
| 42 | +🔐 Access Denied: Two-Factor Authentication Required |
| 43 | +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 44 | +
|
| 45 | +This organization requires all members to have 2FA enabled. |
| 46 | +
|
| 47 | +To regain access: |
| 48 | + 1. Go to https://web.capgo.app/settings/account |
| 49 | + 2. Enable Two-Factor Authentication on your account |
| 50 | + 3. Try your command again |
| 51 | +``` |
| 52 | + |
| 53 | +## Enabling 2FA Enforcement |
| 54 | + |
| 55 | +<Aside type="caution"> |
| 56 | + |
| 57 | +Before enabling 2FA enforcement: |
| 58 | +- Ensure you have 2FA enabled on your own account |
| 59 | +- Notify all organization members to enable 2FA |
| 60 | +- Members without 2FA will immediately lose access |
| 61 | + |
| 62 | +</Aside> |
| 63 | + |
| 64 | +### Via Web Dashboard |
| 65 | + |
| 66 | +<Steps> |
| 67 | + |
| 68 | +1. Navigate to your organization settings |
| 69 | +2. Go to the **Security** section |
| 70 | +3. Toggle **Require 2FA for all members** |
| 71 | +4. Confirm the action |
| 72 | + |
| 73 | +</Steps> |
| 74 | + |
| 75 | +### Via CLI |
| 76 | + |
| 77 | +You can enable 2FA enforcement using the Capgo CLI: |
| 78 | + |
| 79 | +```shell |
| 80 | +# Enable 2FA enforcement for an organization |
| 81 | +npx @capgo/cli organisation set YOUR_ORG_ID --enforce-2fa |
| 82 | + |
| 83 | +# Disable 2FA enforcement |
| 84 | +npx @capgo/cli organisation set YOUR_ORG_ID --no-enforce-2fa |
| 85 | +``` |
| 86 | + |
| 87 | +When enabling via CLI, you'll be shown: |
| 88 | +- Which members don't have 2FA enabled |
| 89 | +- A warning if you yourself don't have 2FA enabled |
| 90 | +- A confirmation prompt before applying the change |
| 91 | + |
| 92 | +## Checking Member 2FA Status |
| 93 | + |
| 94 | +### Via CLI |
| 95 | + |
| 96 | +You can list all organization members and their 2FA status: |
| 97 | + |
| 98 | +```shell |
| 99 | +npx @capgo/cli organisation members YOUR_ORG_ID |
| 100 | +``` |
| 101 | + |
| 102 | +This will display: |
| 103 | +- Member email and role |
| 104 | +- Whether they have 2FA enabled |
| 105 | +- A summary of how many members need to enable 2FA |
| 106 | + |
| 107 | +### Via Web Dashboard |
| 108 | + |
| 109 | +In your organization settings, you can see whether each member has 2FA enabled. |
| 110 | + |
| 111 | +## Setting Up 2FA on Your Account |
| 112 | + |
| 113 | +If you need to enable 2FA on your account, see our [Two-Factor Authentication setup guide](/docs/webapp/mfa/). |
| 114 | + |
| 115 | +## Best Practices |
| 116 | + |
| 117 | +### Before Enabling Enforcement |
| 118 | +- **Communicate in advance**: Give members at least a week's notice before enabling enforcement |
| 119 | +- **Provide support**: Share the [2FA setup guide](/docs/webapp/mfa/) with your team |
| 120 | +- **Check readiness**: Use `npx @capgo/cli organisation members` to see who still needs to enable 2FA |
| 121 | + |
| 122 | +### After Enabling Enforcement |
| 123 | +- **Monitor access issues**: Be available to help members who get locked out |
| 124 | +- **Keep backup codes**: Remind members to save their 2FA backup codes |
| 125 | +- **Review regularly**: Periodically check that all members maintain 2FA |
| 126 | + |
| 127 | +### For CI/CD Pipelines |
| 128 | +- **Use API keys**: CI/CD systems should use API keys, not user accounts |
| 129 | +- **API key owners**: Ensure the user who created CI/CD API keys has 2FA enabled |
| 130 | +- **Rotate keys**: Regularly rotate API keys used in automated systems |
| 131 | + |
| 132 | +## Troubleshooting |
| 133 | + |
| 134 | +### "Access Denied: Two-Factor Authentication Required" |
| 135 | + |
| 136 | +**Problem**: You're seeing this error when trying to access an organization. |
| 137 | + |
| 138 | +**Solution**: |
| 139 | +1. Go to [Account Settings](https://web.capgo.app/settings/account) |
| 140 | +2. Enable 2FA on your account |
| 141 | +3. Try accessing the organization again |
| 142 | + |
| 143 | +### "Cannot enable 2FA enforcement" |
| 144 | + |
| 145 | +**Problem**: You can't enable 2FA enforcement for your organization. |
| 146 | + |
| 147 | +**Solution**: |
| 148 | +- Ensure you have `super_admin` rights in the organization |
| 149 | +- Enable 2FA on your own account first |
| 150 | +- Contact support if the issue persists |
| 151 | + |
| 152 | +### CLI Commands Failing |
| 153 | + |
| 154 | +**Problem**: CLI commands fail with 2FA-related errors. |
| 155 | + |
| 156 | +**Solution**: |
| 157 | +- Verify your API key is valid: `npx @capgo/cli doctor` |
| 158 | +- Ensure the API key owner has 2FA enabled |
| 159 | +- Re-authenticate if using login-based auth: `npx @capgo/cli login` |
| 160 | + |
| 161 | +## Compliance |
| 162 | + |
| 163 | +2FA enforcement helps your organization meet various compliance requirements: |
| 164 | + |
| 165 | +| Standard | Requirement | How 2FA Helps | |
| 166 | +|----------|-------------|---------------| |
| 167 | +| **SOC 2** | Access controls | Ensures strong authentication for all users | |
| 168 | +| **ISO 27001** | Information security | Adds a layer of identity verification | |
| 169 | +| **HIPAA** | Access management | Protects against unauthorized access | |
| 170 | +| **GDPR** | Data protection | Reduces risk of account compromise | |
| 171 | +| **PCI DSS** | Authentication controls | Meets multi-factor authentication requirements | |
| 172 | + |
| 173 | +## Next Steps |
| 174 | + |
| 175 | +- [Set up 2FA on your account](/docs/webapp/mfa/) |
| 176 | +- [Learn about organization management](/docs/webapp/organization-system/) |
| 177 | +- [Configure API keys for CI/CD](/docs/webapp/api-keys/) |
| 178 | + |
0 commit comments