简体   繁体   中英

Limit Access of GitHub or Bitbucket Repository

Is there any way to limit the access of bitbucket or Github repository from a specific IP Address.

Which means I want to access my organisation repositories only from my office.

The another this is that is there any way to block with a time being?

Any of the git providers supporting this feature?

The SSH key is only useful for the git action without entering passwords and username?

Any way to solve this issue?

I think many of the IT Companies are using this service for securing their source code.

Is it possible to achieve this without a git service?

BitBucket does not appear to currently support access limitation by IP address:

We don't have any plans to add this feature in the short term, but it's a good idea. We'll leave this issue open as a feature request.

GitHub Enterprise does appear to support limiting access by IP address:

Whenever you add an SSH key to GitHub Enterprise via the Management Console, you can also specify which IP addresses to allow or deny connections from.

As to why BitBucket is in no rush to add this feature, we can look at the model upon which Git was built. One major feature of Git is that it allows for truly distributed development, across locations and IP addresses. A developer can contribute at home, in the office, or on the road, requiring only an internet connection. He can even continue making commits without an internet connection.

Note: GitLab 12.0 (June 2019) does have the " Restrict access by IP address " feature.

But only for Ultimate (self-managed) or Gold (gitlab.com) editions.

Compliance-minded organizations may want to prohibit traffic from outside IP addresses from accessing company resources.
This is especially helpful for organizations using VPNs, as you're now able to restrict traffic from outside a specified subnet from accessing a group's resources in the GitLab UI.

Configurable at the group level on both self-managed and GitLab.com, maintaining tight control over your organization's most valued code just became easier than ever.

https://about.gitlab.com/images/12_0/restrict-group-by-ip.png

See documentation and gitlab-org/gitlab-ee issue 1985 .

Bitbucket added the new features in IP based access repository. IP based access to the repository in bitbucket, you need to purchase the premium version of bitbucket ($5/per user/month). By these, you can restrict the access to the repository by another network.

For GitHub Enterprise , the limit by IP is no longer only for SSH keys.

See " IP allow lists are now generally available " (March 2020)

IP allow lists are now generally available for GitHub Enterprise Cloud customers – allowing enterprise and organization owners to limit access to enterprise assets to an allowed set of source IPs.

All authorization credential types, including personal access tokens and SSH keys, are filtered by IP allow lists for all apps, users, and roles with access to enterprise organizations.

You may also use IP allow lists with GitHub Actions self-hosted runners .

See more at " Managing allowed IP addresses for organizations in your enterprise account ".

You could edit the file etc/gitlab/gitlab.rb then find the whitelist variable, uncomment it and add the ip

gitlab_rails['monitoring_whitelist'] = ['xxx.xxx.xxx.xxx']

And find and edit the custom_gitlab_server_config variable with the ip

nginx['custom_gitlab_server_config'] = "
 allow xxx.xxx.xxx.xxx;
 deny all;
 location ~ /.well-known {
  allow all;
 }
"

Finally, reconfigure your gitlab with

gitlab-ctl reconfigure

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM