|
| 1 | +--- |
| 2 | +title: Best practices for securing accounts |
| 3 | +shortTitle: Securing accounts |
| 4 | +allowTitleToDifferFromFilename: true |
| 5 | +intro: Guidance on how to protect accounts with access to your software supply chain. |
| 6 | +versions: |
| 7 | + fpt: '*' |
| 8 | + ghec: '*' |
| 9 | + ghes: '*' |
| 10 | +type: overview |
| 11 | +topics: |
| 12 | + - Organizations |
| 13 | + - Teams |
| 14 | + - SSH |
| 15 | + - Security |
| 16 | + - Accounts |
| 17 | +--- |
| 18 | +## About this guide |
| 19 | + |
| 20 | +This guide describes the highest impact changes you can make to increase account security. Each section outlines a change you can make to your processes to improve the security. The highest impact changes are listed first. |
| 21 | + |
| 22 | +## What's the risk? |
| 23 | + |
| 24 | +Account security is fundamental to the security of your supply chain. If an attacker can take over your account on {% data variables.product.product_name %}, they can then make malicious changes to your code or build process. So your first goal should be to make it difficult for someone to take over your account and the accounts of other {% ifversion ghes %}users{% else %}members{% endif %} of {% ifversion fpt %}your organization{% elsif ghec or ghae %}your organization or enterprise{% elsif ghes %}{% data variables.product.product_location %}{% endif %}. |
| 25 | + |
| 26 | +{% ifversion ghec or ghes %} |
| 27 | +## Centralize authentication |
| 28 | +{% endif %} |
| 29 | + |
| 30 | +{% ifversion ghec %} |
| 31 | +If you're an enterprise or organization owner, you can configure centralized authentication with SAML. While you can add or remove members manually, it's simpler and more secure to set up single sign-on (SSO) and SCIM between {% data variables.product.product_name %} and your SAML identity provider (IdP). This also simplifies the authentication process for all members of your enterprise. |
| 32 | + |
| 33 | +You can configure SAML authentication for an enterprise or organization account. With SAML, you can grant access to the personal accounts of members of your enterprise or organization on {% data variables.product.product_location %} through your IdP, or you can create and control the accounts that belong to your enterprise by using {% data variables.product.prodname_emus %}. For more information, see "[About identity and access management with SAML single sign-on](/organizations/managing-saml-single-sign-on-for-your-organization/about-identity-and-access-management-with-saml-single-sign-on)". |
| 34 | + |
| 35 | +After you configure SAML authentication, when members request access to your resources, they'll be directed to your SSO flow to ensure they are still recognized by your IdP. If they are unrecognized, their request is declined. |
| 36 | + |
| 37 | +Some IdPs support a protocol called SCIM, which can automatically provision or deprovision access on {% data variables.product.product_name %} when you make changes on your IdP. With SCIM, you can simplify administration as your team grows, and you can quickly revoke access to accounts. SCIM is available for individual organizations on {% data variables.product.product_name %}, or for enterprises that use {% data variables.product.prodname_emus %}. For more information, see "[About SCIM](/organizations/managing-saml-single-sign-on-for-your-organization/about-scim)." |
| 38 | +{% endif %} |
| 39 | + |
| 40 | +{% ifversion ghes %} |
| 41 | +If you're the site administrator for {% data variables.product.product_location %}, you can simplify the login experience for users by choosing an authentication method that connects with your existing identity provider (IdP), like CAS, SAML, or LDAP. This means that they no longer need to remember an extra password for {% data variables.product.prodname_dotcom %}. |
| 42 | + |
| 43 | +Some authentication methods also support communicating additional information to {% data variables.product.product_name %}, for example, what groups the user is a member of, or synchronizing cryptographic keys for the user. This is a great way to simplify your administration as your organization grows. |
| 44 | + |
| 45 | +For more information on these authentication methods, see "[Using CAS](/admin/identity-and-access-management/authenticating-users-for-your-github-enterprise-server-instance/using-cas)," "[Using SAML](/admin/identity-and-access-management/authenticating-users-for-your-github-enterprise-server-instance/using-saml)," and "[Using LDAP](/admin/identity-and-access-management/authenticating-users-for-your-github-enterprise-server-instance/using-ldap)." |
| 46 | +{% endif %} |
| 47 | + |
| 48 | +## Configure two-factor authentication |
| 49 | + |
| 50 | +The best way to improve the security of {% ifversion fpt %}your personal account{% elsif ghes %}your personal account or {% data variables.product.product_location %}{% elsif ghec %}your accounts{% elsif ghae %}your enterprise on {% data variables.product.product_name %}{% endif %} is to configure two-factor authentication (2FA){% ifversion ghae %} on your SAML identity provider (IdP){% endif %}. Passwords by themselves can be compromised by being guessable, by being reused on another site that's been compromised, or by social engineering, like phishing. 2FA makes it much more difficult for your accounts to be compromised, even if an attacker has your password. |
| 51 | + |
| 52 | +{% ifversion not ghae %} |
| 53 | + |
| 54 | +{% ifversion ghec %} |
| 55 | +If you're an enterprise owner, you may be able to configure a policy to require 2FA for all organizations owned by your enterprise. |
| 56 | +{% endif %} |
| 57 | + |
| 58 | +{% ifversion ghes %} |
| 59 | +If you're the site administrator for {% data variables.product.product_location %}, you may be able to configure 2FA for all users of your instance. The availability of 2FA on {% data variables.product.product_name %} depends on the authentication method that you use. For more information, see "[Centralize user authentication](#centralize-user-authentication)." |
| 60 | +{% endif %} |
| 61 | + |
| 62 | +If you're an organization owner, then you {% ifversion fpt %}can{% else %}may be able to{% endif %} require that all members of the organization enable 2FA. |
| 63 | + |
| 64 | +{% ifversion ghec or ghes %} |
| 65 | + |
| 66 | +### Configure your enterprise account |
| 67 | + |
| 68 | +Enterprise owners may be able to require 2FA for all {% ifversion ghes %}users on{% elsif ghec %}members of{% endif %} the {% ifversion ghes %}instance{% elsif ghec %}enterprise{% endif %}. The availability of 2FA policies on {% data variables.product.product_name %} depends on how {% ifversion ghes %}users{% else %}members{% endif %} authenticate to access your {% ifversion ghes %}instance{% elsif ghec %}enterprise's resources{% endif %}. |
| 69 | + |
| 70 | +{% ifversion ghes %} |
| 71 | +- If you sign into {% data variables.product.product_location %} through an external IdP using CAS or SAML SSO, you |
| 72 | +{% elsif ghec %} |
| 73 | +If your enterprise uses {% data variables.product.prodname_emus %} or SAML authentication is enforced for your enterprise, you |
| 74 | +{%- endif %} cannot configure 2FA on {% data variables.product.product_name %}. Someone with administrative access to your IdP must configure 2FA for the IdP. |
| 75 | + |
| 76 | +{% ifversion ghes %} |
| 77 | + |
| 78 | +- If you sign into {% data variables.product.product_location %} through an external LDAP directory, you can require 2FA for your enterprise on {% data variables.product.product_name %}. If you allow built-in authentication for users outside of your directory, individual users can enable 2FA, but you cannot require 2FA for your enterprise. |
| 79 | + |
| 80 | +{% endif %} |
| 81 | + |
| 82 | +For more information, see {% ifversion ghec %}"[About identity and access management for your enterprise](/admin/identity-and-access-management/managing-iam-for-your-enterprise/about-identity-and-access-management-for-your-enterprise)" and {% endif %}"[Enforcing policies for security settings in your enterprise](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-security-settings-in-your-enterprise#requiring-two-factor-authentication-for-organizations-in-your-enterprise)." |
| 83 | + |
| 84 | +{% endif %} |
| 85 | + |
| 86 | +### Configure your personal account |
| 87 | + |
| 88 | +{% ifversion ghec or ghes %} |
| 89 | +{% note %} |
| 90 | + |
| 91 | +**Note**: Depending on the authentication method that {% ifversion ghec %}an enterprise owner{% elsif ghes %}a site administrator{% endif %} has configured for {% ifversion ghec %}your enterprise on {% endif %}{% data variables.product.product_location %}, you may not be able to enable 2FA for your personal account. |
| 92 | + |
| 93 | +{% endnote %} |
| 94 | +{% endif %} |
| 95 | + |
| 96 | +{% data variables.product.product_name %} supports several options for 2FA, and while any of them is better than nothing, the most secure option is WebAuthn. WebAuthn requires either a hardware security key or a device that supports it through things like Windows Hello or Mac TouchID. It's possible, although difficult, to phish other forms of 2FA (for example, someone asking you to read them your 6 digit one-time password). However WebAuthn isn't phishable, because domain scoping is built into the protocol, which prevents credentials from a website impersonating a login page from being used on {% data variables.product.product_name %}. |
| 97 | + |
| 98 | +When you set up 2FA, you should always download the recovery codes and set up more than one factor. This ensures that access to your account doesn't depend on a single device. For more information, see "[Configuring two-factor authentication](/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication)," "[Configuring two-factor authentication recovery methods](/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication-recovery-methods)," and [GitHub Branded hardware security keys](https://thegithubshop.com/products/github-branded-yubikey) in the GitHub shop. |
| 99 | + |
| 100 | +### Configure your organization account |
| 101 | + |
| 102 | +{% ifversion ghec or ghes %} |
| 103 | +{% note %} |
| 104 | + |
| 105 | +**Note**: Depending on the authentication method that {% ifversion ghec %}an enterprise owner{% elsif ghes %}a site administrator{% endif %} has configured for {% ifversion ghec %}your enterprise on {% endif %}{% data variables.product.product_location %}, you may not be able to require 2FA for your organization. |
| 106 | + |
| 107 | +{% endnote %} |
| 108 | +{% endif %} |
| 109 | + |
| 110 | +If you're an organization owner, you can see which users don't have 2FA enabled, help them get set up, and then require 2FA for your organization. To guide you through that process, see: |
| 111 | + |
| 112 | +1. "[Viewing whether users in your organization have 2FA enabled](/organizations/keeping-your-organization-secure/managing-two-factor-authentication-for-your-organization/viewing-whether-users-in-your-organization-have-2fa-enabled)" |
| 113 | +2. "[Preparing to require two-factor authentication in your organization](/organizations/keeping-your-organization-secure/managing-two-factor-authentication-for-your-organization/preparing-to-require-two-factor-authentication-in-your-organization)" |
| 114 | +3. "[Requiring two-factor authentication in your organization](/organizations/keeping-your-organization-secure/managing-two-factor-authentication-for-your-organization/requiring-two-factor-authentication-in-your-organization)" |
| 115 | + |
| 116 | +{% endif %} |
| 117 | + |
| 118 | +## Connect to {% data variables.product.product_name %} using SSH keys |
| 119 | + |
| 120 | +There are other ways to interact with {% data variables.product.product_name %} beyond signing into the website. Many people authorize the code they push to {% data variables.product.prodname_dotcom %} with an SSH private key. For more information, see "[About SSH](/authentication/connecting-to-github-with-ssh/about-ssh)." |
| 121 | + |
| 122 | +Just like your account password, if an attacker were able to get your SSH private key, they could impersonate you and push malicious code to any repository you have write access for. If you store your SSH private key on a disk drive, it's a good idea to protect it with a passphrase. For more information, see "[Working with SSH key passphrases](/authentication/connecting-to-github-with-ssh/working-with-ssh-key-passphrases)." |
| 123 | + |
| 124 | +Another option is to generate SSH keys on a hardware security key. You could use the same key you're using for 2FA. Hardware security keys are very difficult to compromise remotely, because the private SSH key remains on the hardware, and is not directly accessible from software. For more information, see "[Generating a new SSH key for a hardware security key](/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key-for-a-hardware-security-key)." |
| 125 | + |
| 126 | +{% ifversion ghec or ghes or ghae %} |
| 127 | +Hardware-backed SSH keys are quite secure, but the hardware requirement might not work for some organizations. An alternative approach is to use SSH keys that are only valid for a short period of time, so even if the private key is compromised it can't be exploited for very long. This is the concept behind running your own SSH certificate authority. While this approach gives you a lot of control over how users authenticate, it also comes with the responsibility of maintaining an SSH certificate authority yourself. For more information, see "[About SSH certificate authorities](/organizations/managing-git-access-to-your-organizations-repositories/about-ssh-certificate-authorities)." |
| 128 | +{% endif %} |
| 129 | + |
| 130 | +## Next steps |
| 131 | + |
| 132 | +- "[Securing your end-to-end supply chain](/code-security/supply-chain-security/end-to-end-supply-chain/end-to-end-supply-chain-overview)" |
| 133 | + |
| 134 | +- "[Best practices for securing code in your supply chain](/code-security/supply-chain-security/end-to-end-supply-chain/securing-code)" |
| 135 | + |
| 136 | +- "[Best practices for securing your build system](/code-security/supply-chain-security/end-to-end-supply-chain/securing-builds)" |
0 commit comments