Skip to main content

Применение политик для параметров безопасности в вашем предприятии

Вы можете применять политики для управления параметрами безопасности в организациях предприятия или разрешить настройку политик в каждой организации.

Кто может использовать эту функцию?

Enterprise owners can enforce policies for security settings in an enterprise.

About policies for security settings in your enterprise

You can enforce policies to control the security settings for organizations owned by your enterprise on GitHub Enterprise Cloud. By default, organization owners can manage security settings.

Requiring two-factor authentication for organizations in your enterprise

Note

As of March 2023, GitHub required all users who contribute code on GitHub.com to enable one or more forms of two-factor authentication (2FA). If you were in an eligible group, you would have received a notification email when that group was selected for enrollment, marking the beginning of a 45-day 2FA enrollment period, and you would have seen banners asking you to enroll in 2FA on GitHub.com. If you didn't receive a notification, then you were not part of a group required to enable 2FA, though we strongly recommend it.

For more information about the 2FA enrollment rollout, see this blog post.

Enterprise owners can require that organization members, billing managers, and outside collaborators in all organizations owned by an enterprise use two-factor authentication to secure their user accounts. This policy is not available for enterprises with managed users.

Before you can require two-factor authentication for all organizations owned by your enterprise, you must enable 2FA for your own account. For more information, see "Securing your account with two-factor authentication (2FA)."

Before you require use of two-factor authentication, we recommend notifying organization members, outside collaborators, and billing managers and asking them to set up 2FA for their accounts. Organization owners can see if members and outside collaborators already use 2FA on each organization's "People" page. For more information, see "Viewing whether users in your organization have 2FA enabled."

Warning

  • When you require two-factor authentication for your enterprise, outside collaborators (including bot accounts) in all organizations owned by your enterprise who do not use 2FA will be removed from the organization and lose access to its repositories. They will also lose access to their forks of the organization's private repositories. You can reinstate their access privileges and settings if they enable 2FA for their account within three months of their removal from your organization. For more information, see "Reinstating a former member of your organization."
  • Any outside collaborator in any of the organizations owned by your enterprise who disables 2FA for their account after you've enabled required two-factor authentication will automatically be removed from the organization. Members and billing managers who disable 2FA will not be able to access organization resources until they re-enable it.
  • If you're the sole owner of an enterprise that requires two-factor authentication, you won't be able to disable 2FA for your user account without disabling required 2FA for the enterprise.

Note

Some of the users in your organizations may have been selected for mandatory two-factor authentication enrollment by GitHub.com, but it has no impact on how you enable the 2FA requirement for the organizations in your enterprise. If you enable the 2FA requirement for organizations in your enterprise, outside collaborators without 2FA currently enabled will be removed from the organizations, including those that are required to enable it by GitHub.com.

  1. In the top-right corner of GitHub, click your profile photo.

  2. Depending on your environment, click Your enterprise, or click Your enterprises then click the enterprise you want to view.

  3. On the left side of the page, in the enterprise account sidebar, click Settings.

  4. Under Settings, click Authentication security.

  5. Under "Two-factor authentication", review the information about changing the setting. Optionally, to view the current configuration for all organizations in the enterprise account before you change the setting, click View your organizations' current configurations.

    Screenshot of a policy in the enterprise settings. A link, labeled "View your organizations' current configurations", is highlighted with an orange outline.

  6. Under "Two-factor authentication", select Require two-factor authentication for the enterprise and all of its organizations, then click Save.

  7. If prompted, read the information about how user access to organization resources will be affected by a 2FA requirement. To confirm the change, click Confirm.

  8. Optionally, if any outside collaborators are removed from the organizations owned by your enterprise, we recommend sending them an invitation to reinstate their former privileges and access to your organization. Each person must enable 2FA before they can accept your invitation.

Requiring secure methods of two-factor authentication for organizations in your enterprise

Alongside requiring two-factor authentication, enterprise owners can require that organization members, billing managers, and outside collaborators in all organizations owned by an enterprise use secure methods of 2FA. Secure two-factor methods are passkeys, security keys, authenticator apps, and the GitHub mobile app. Users who do not have a secure method of 2FA configured, or who have any insecure method configured, will be prevented from accessing resources within any organizations owned by an enterprise. This policy is not available for enterprises with managed users.

Before you require secure methods of two-factor authentication, we recommend notifying organization members, outside collaborators, and billing managers and asking them to set up secure 2FA for their accounts. Organization owners can see if members and outside collaborators already use secure methods of 2FA on each organization's "People" page. For more information, see "Viewing whether users in your organization have 2FA enabled."

  1. Under "Two-factor authentication", select Require two-factor authentication for the enterprise and all of its organizations and Only allow secure two-factor methods, then click Save.
  2. If prompted, read the information about how user access to organization resources will be affected by requiring secure 2FA methods. To confirm the change, click Confirm.
  3. Optionally, if any outside collaborators are removed from the organizations owned by your enterprise, we recommend sending them an invitation to reinstate their former privileges and access to your organization. Each person must enable 2FA with a secure method before they can accept your invitation.

Managing SSH certificate authorities for your enterprise

You can use a SSH certificate authority (CA) to allow members of any organization owned by your enterprise to access that organization's repositories using SSH certificates you provide. If your enterprise uses Enterprise Managed Users, enterprise members can also be allowed to use the certificate to access personally-owned repositories. You can require that members use SSH certificates to access organization resources, unless SSH is disabled in your repository. For more information, see "About SSH certificate authorities."

When you issue each client certificate, you must include an extension that specifies which GitHub Enterprise Cloud user the certificate is for. For more information, see "About SSH certificate authorities."

Adding an SSH certificate authority

If you require SSH certificates for your enterprise, enterprise members should use a special URL for Git operations over SSH. For more information, see "About SSH certificate authorities."

Each certificate authority can only be uploaded to one account on GitHub Enterprise Cloud. If an SSH certificate authority has been added to an organization or enterprise account, you cannot add the same certificate authority to another organization or enterprise account on GitHub Enterprise Cloud.

If you add one certificate authority to an enterprise and another certificate authority to an organization in the enterprise, either certificate authority can be used to access the organization's repositories.

  1. In the top-right corner of GitHub, click your profile photo.

  2. Depending on your environment, click Your enterprise, or click Your enterprises then click the enterprise you want to view.

  3. On the left side of the page, in the enterprise account sidebar, click Settings.

  4. Under Settings, click Authentication security.

  5. To the right of "SSH Certificate Authorities", click New CA.

  6. Under "Key," paste your public SSH key.

  7. Click Add CA.

  8. Optionally, to require members to use SSH certificates, select Require SSH Certificates, then click Save.

    Note

    When you require SSH certificates, users will not be able to authenticate to access the organization's repositories over HTTPS or with an unsigned SSH key, regardless of whether the SSH key is authorized for an organization that requires authentication through an external identity system.

    The requirement does not apply to authorized GitHub Apps (including user-to-server tokens), deploy keys, or to GitHub features such as GitHub Actions and Codespaces, which are trusted environments within the GitHub ecosystem.

Managing access to user-owned repositories

You can enable or disable access to user-owned repositories with an SSH certificate if your enterprise uses managed user accounts. However, if your enterprise uses personal accounts on GitHub.com members cannot use the certificate to access personally-owned repositories.

  1. In the top-right corner of GitHub, click your profile photo.

  2. Depending on your environment, click Your enterprise, or click Your enterprises then click the enterprise you want to view.

  3. On the left side of the page, in the enterprise account sidebar, click Settings.

  4. Under Settings, click Authentication security.

  5. Under "SSH Certificate Authorities", select the Access User Owned Repository checkbox.

Deleting an SSH certificate authority

Deleting a CA cannot be undone. If you want to use the same CA in the future, you'll need to upload the CA again.

  1. In the top-right corner of GitHub, click your profile photo.

  2. Depending on your environment, click Your enterprise, or click Your enterprises then click the enterprise you want to view.

  3. On the left side of the page, in the enterprise account sidebar, click Settings.

  4. Under Settings, click Authentication security.

  5. Under "SSH Certificate Authorities", to the right of the CA you want to delete, click Delete.

  6. Read the warning, then click I understand, please delete this CA.

Upgrading an SSH certificate authority

CAs uploaded to your enterprise prior to March 27th, 2024, allow the use of non-expiring certificates. To learn more about why expirations are now required for new CAs, see "About SSH certificate authorities." You can upgrade an existing CA to prevent it from issuing non-expiring certificates. For best security, we strongly recommend upgrading all your CAs once you validate you're not reliant on non-expiring certificates.

  1. In the top-right corner of GitHub, click your profile photo.

  2. Depending on your environment, click Your enterprise, or click Your enterprises then click the enterprise you want to view.

  3. On the left side of the page, in the enterprise account sidebar, click Settings.

  4. Under Settings, click Authentication security.

  5. Under "SSH Certificate Authorities", to the right of the CA you want to upgrade, click Upgrade.

  6. Read the warning, then click Upgrade.

After upgrading the CA, non-expiring certificates signed by that CA will be rejected.

Managing SSO for unauthenticated users

Note

Automatically redirecting users to sign in is currently in public preview for Enterprise Managed Users and subject to change.

If your enterprise uses Enterprise Managed Users, you can choose what unauthenticated users see when they attempt to access your enterprise's resources. For more information about Enterprise Managed Users, see "About Enterprise Managed Users."

By default, to hide the existence of private resources, when an unauthenticated user attempts to access your enterprise, GitHub displays a 404 error.

To prevent confusion from your developers, you can change this behavior so that users are automatically redirected to single sign-on (SSO) through your identity provider (IdP). When you enable automatic redirects, anyone who visits the URL for any of your enterprise's resources will be able to see that the resource exists. However, they'll only be able to see the resource if they have appropriate access after authenticating with your IdP.

Note

If a user is signed in to their personal account when they attempt to access any of your enterprise's resources, they'll be automatically signed out and redirected to SSO to sign in to their managed user account. For more information, see "Managing multiple accounts."

  1. In the top-right corner of GitHub, click your profile photo, then click Your enterprise.
  2. On the left side of the page, in the enterprise account sidebar, click Identity provider.
  3. Under Identity Provider, click Single sign-on configuration.
  4. Under "Single sign-on settings", select or deselect Automatically redirect users to sign in.

Further reading