Skip to content

Commit e82f0b8

Browse files
vgrlsophiethekingisaacmbrown
authored
Repo deploy keys can now be disabled by default by enterprise policy [GA] (#52511)
Co-authored-by: Sophie <29382425+sophietheking@users.noreply.github.com> Co-authored-by: Isaac Brown <101839405+isaacmbrown@users.noreply.github.com>
1 parent 8fb1ace commit e82f0b8

File tree

7 files changed

+71
-1
lines changed

7 files changed

+71
-1
lines changed

content/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,24 @@ Across all organizations owned by your enterprise, you can set the default branc
151151
1. Optionally, to enforce the default branch name for all organizations in the enterprise, select **Enforce across this enterprise**.
152152
1. Click **Update**.
153153

154+
{% ifversion deploy-keys-enterprise-org-policy %}
155+
156+
## Enforcing a policy for deploy keys
157+
158+
Across all organizations owned by your enterprise, you can allow members to create deploy keys in repositories, restrict deploy key creation, or allow owners to administer the setting on the organization level.
159+
160+
For more information about using deploy keys, see "[AUTOTITLE](/authentication/connecting-to-github-with-ssh/managing-deploy-keys#deploy-keys)." If you want fine-grained control over permissions, consider using a {% data variables.product.prodname_github_app %} instead. See "[AUTOTITLE](/apps/overview)."
161+
162+
> [!WARNING]
163+
> Changing this setting to disabled will result in existing deploy keys being disabled in all repositories in your enterprise.
164+
165+
{% data reusables.enterprise-accounts.access-enterprise %}
166+
{% data reusables.enterprise-accounts.policies-tab %}
167+
{% data reusables.enterprise-accounts.repositories-tab %}
168+
1. Under "Deploy keys", review the information about changing the setting, then select a policy.
169+
1. Click **Save**.
170+
{% endif %}
171+
154172
## Enforcing a policy for changes to repository visibility
155173

156174
Across all organizations owned by your enterprise, you can allow members with admin access to change a repository's visibility, restrict repository visibility changes to organization owners, or allow owners to administer the setting on the organization level. When you prevent members from changing repository visibility, only enterprise owners can change the visibility of a repository.

content/authentication/connecting-to-github-with-ssh/managing-deploy-keys.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ See [our guide on creating a {% data variables.product.pat_generic %}](/authenti
6969

7070
{% data reusables.repositories.deploy-keys-write-access %}
7171

72+
For enhanced security and fine-grained control over repository access and permissions, we recommend using a GitHub App instead. See "[AUTOTITLE](/apps/creating-github-apps/about-creating-github-apps/deciding-when-to-build-a-github-app#github-apps-offer-enhanced-security)."
73+
7274
### Pros of deploy keys
7375

7476
* Anyone with access to the repository and server has the ability to deploy the project.
@@ -79,10 +81,16 @@ See [our guide on creating a {% data variables.product.pat_generic %}](/authenti
7981

8082
* Deploy keys only grant access to a single repository. More complex projects may have many repositories to pull to the same server.
8183
* Deploy keys are usually not protected by a passphrase, making the key easily accessible if the server is compromised.
82-
* If the user who created the deploy key is removed from the repository, the deploy key will still be active as it isn't tied to the specific user, but rather to the repository.
84+
* Deploy keys are credentials that don't have an expiry date.
85+
* Deploy keys aren't linked directly to organization membership. If the user who created the deploy key is removed from the repository, the deploy key will still be active as it isn't tied to the specific user, but rather to the repository.
8386

8487
### Set up deploy keys
8588

89+
{% ifversion deploy-keys-enterprise-org-policy %}
90+
91+
> [!NOTE] If your organization is owned by an enterprise, and your enterprise owner has restricted the use of deploy keys in repositories, then you cannot override the policy in your organization to create a deploy key. For more information, see "[AUTOTITLE](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise#enforcing-a-policy-for-deploy-keys)."
92+
{% endif %}
93+
8694
1. [Run the `ssh-keygen` procedure][generating-ssh-keys] on your server, and remember where you save the generated public and private rsa key pair.
8795
{% data reusables.repositories.navigate-to-repo %}
8896
{% data reusables.repositories.sidebar-settings %}

content/code-security/getting-started/best-practices-for-preventing-data-leaks-in-your-organization.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ Disable the ability to fork repositories. | "[AUTOTITLE](/repositories/managing-
5252
Disable changing repository visibility. | "[AUTOTITLE](/organizations/managing-organization-settings/restricting-repository-visibility-changes-in-your-organization)"
5353
Restrict repository creation to private or internal. | "[AUTOTITLE](/organizations/managing-organization-settings/restricting-repository-creation-in-your-organization)"
5454
Disable repository deletion and transfer. | "[AUTOTITLE](/organizations/managing-organization-settings/setting-permissions-for-deleting-or-transferring-repositories)"
55+
| {% ifversion deploy-keys-enterprise-org-policy %} |
56+
Disable the ability to use deploy keys. | "[AUTOTITLE](/organizations/managing-organization-settings/restricting-deploy-keys-in-your-organization)"
57+
| {% endif %} |
5558
Scope {% data variables.product.pat_generic %}s to the minimum permissions necessary. | None
5659
Secure your code by converting public repositories to private whenever appropriate. You can alert the repository owners of this change automatically using a {% data variables.product.prodname_github_app %}. | [Prevent-Public-Repos](https://github.com/apps/prevent-public-repos) in {% data variables.product.prodname_marketplace %}
5760
Confirm your organization’s identity by verifying your domain and restricting email notifications to only verified email domains. | "[AUTOTITLE](/organizations/managing-organization-settings/verifying-or-approving-a-domain-for-your-organization){% ifversion ghec or ghes %}" and "[AUTOTITLE](/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/restricting-email-notifications-for-your-organization){% endif %}"{% ifversion fpt or ghec %}

content/organizations/managing-organization-settings/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ children:
3131
- /enabling-or-disabling-github-discussions-for-an-organization
3232
- /managing-discussion-creation-for-repositories-in-your-organization
3333
- /managing-the-commit-signoff-policy-for-your-organization
34+
- /restricting-deploy-keys-in-your-organization
3435
- /setting-team-creation-permissions-in-your-organization
3536
- /creating-an-announcement-banner-for-your-organization
3637
- /managing-scheduled-reminders-for-your-organization
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Restricting deploy keys in your organization
3+
intro: To protect your organization's data, you can configure permissions for creating deploy keys in your organization.
4+
permissions: Organization owners.
5+
versions:
6+
feature: deploy-keys-enterprise-org-policy
7+
topics:
8+
- Organizations
9+
- Policies
10+
shortTitle: Restrict deploy keys
11+
---
12+
13+
You can choose whether members can create deploy keys for repositories in your organization.
14+
15+
By default, new organizations are configured to disallow the creation of deploy keys in repositories.
16+
17+
Organization owners can restrict the creation of deploy keys to help prevent sensitive information from being exposed. For more information, see "[AUTOTITLE](/code-security/getting-started/best-practices-for-preventing-data-leaks-in-your-organization)" and "[AUTOTITLE](/authentication/connecting-to-github-with-ssh/managing-deploy-keys#deploy-keys)." If you want more fine-grained control over permissions, consider using a {% data variables.product.prodname_github_app %} instead. See "[AUTOTITLE](/apps/overview)."
18+
19+
If your organization is owned by an enterprise account, you may not be able to configure this setting for your organization, if an enterprise owner has set a policy at the enterprise level. For more information, see "[AUTOTITLE](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise#enforcing-a-policy-for-deploy-keys)."
20+
21+
> [!WARNING]
22+
> Changing this setting to disabled will result in existing deploy keys being disabled in all repositories in the organization.
23+
24+
{% data reusables.profile.access_org %}
25+
{% data reusables.profile.org_settings %}
26+
{% data reusables.profile.org_member_privileges %}
27+
1. Under "Deploy keys", review the information about changing the setting, click **Enabled** or **Disabled**.
28+
1. Click **Save**.

content/rest/deploy-keys/deploy-keys.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ autogenerated: rest
2020

2121
Deploy keys can either be set up using the following API endpoints, or by using the {% data variables.product.company_short %} web interface. To learn how to set deploy keys up in the web interface, see "[AUTOTITLE](/authentication/connecting-to-github-with-ssh/managing-deploy-keys)."
2222

23+
{% ifversion deploy-keys-enterprise-org-policy %}
24+
25+
You may be unable to create deploy keys if your organization or enterprise owner has set a policy to restrict their use. Furthermore, if this policy is enabled at the organization or enterprise level, existing deploy keys may be disabled. For more information, see "[AUTOTITLE](/admin/policies/enforcing-policies-for-your-enterprise/enforcing-repository-management-policies-in-your-enterprise#enforcing-a-policy-for-deploy-keys)" and "[AUTOTITLE](/organizations/managing-organization-settings/restricting-deploy-keys-in-your-organization)."
26+
{% endif %}
27+
2328
There are a few cases when a deploy key will be deleted by other activity:
2429

2530
* If the deploy key is created with a {% data variables.product.pat_generic %}, deleting the {% data variables.product.pat_generic %} will also delete the deploy key. Regenerating the {% data variables.product.pat_generic %} will not delete the deploy key.
@@ -31,4 +36,6 @@ Conversely, these activities will not delete a deploy key:
3136
* If the deploy key is created with a {% data variables.product.prodname_github_app %} installation access token, uninstalling or deleting the app will not delete the deploy key.
3237
* If the deploy key is created with a {% data variables.product.pat_generic %}, regenerating the {% data variables.product.pat_generic %} will not delete the deploy key.
3338

39+
Changing this setting to disabled will result in existing deploy keys being disabled in all repositories in your enterprise.
40+
3441
<!-- Content after this section is automatically generated -->
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Reference: #15666
2+
# Repo deploy keys can now be disabled by default by enterprise policy [GA]
3+
versions:
4+
ghec: '*'
5+
ghes: '>= 3.16'

0 commit comments

Comments
 (0)