破解 GitLab的核心
- 使用 GitLab-License-Generator 生成许可证
由于 GitLab-License-Generator 被 DMCA takedown 了,所以我们需要手动运行它:
apt install ruby-full
gem install bundler
gem install gitlab-license
git clone https://github.com/Lakr233/GitLab-License-Generator.git
cd GitLab-License-Generator
然后编辑 src/scan.features.rb
粘贴以下内容:
#!/usr/bin/env ruby
# encoding: utf-8
require 'json'
require 'optparse'
OptionParser.new do |opts|
opts.banner = "Usage: scan.features.rb [options]"
opts.on("-s", "--src-dir PATH", "Specify gitlab source dir (required if --features-file is ommited)") do |v|
GITLAB_FEATURES_FILE="#{File.expand_path(v)}/ee/app/models/gitlab_subscriptions/features.rb"
end
opts.on("-f", "--features-file PATH", "Specify gitlab features path (required if --src-dir is ommited)") do |v|
GITLAB_FEATURES_FILE = File.expand_path(v)
end
opts.on("-o", "--output PATH", "Output to json file (required)") do |v|
EXPORT_JSON_FILE = File.expand_path(v)
end
opts.on("-h", "--help", "Prints this help") do
puts opts
exit
end
end
.parse!
if GITLAB_FEATURES_FILE.nil? || EXPORT_JSON_FILE.nil?
puts "[!] missing required options"
puts "[!] use -h for help"
exit 1
end
puts "Reading features from #{GITLAB_FEATURES_FILE}"
def ignore_exception
begin
yield
rescue Exception
end
end
puts "[*] loading features.rb..."
ignore_exception do
require_relative "#{GITLAB_FEATURES_FILE}"
end
ALL_FEATURES = []
GitlabSubscriptions::Features.constants.each do |const_name|
puts "[*] gathering features from #{const_name}"
if const_name.to_s.include? 'FEATURE'
ALL_FEATURES.concat(GitlabSubscriptions::Features.const_get(const_name))
else
puts "[?] unrecognized constant #{const_name}"
end
end
ALL_FEATURES.uniq!
ALL_FEATURES.sort_by! { |feature| feature }
puts "[*] total features: #{ALL_FEATURES.size}"
puts "[*] writing to #{EXPORT_JSON_FILE}"
File.write(EXPORT_JSON_FILE, JSON.pretty_generate(ALL_FEATURES))
puts "[*] done"
生成许可证(按需求修改LICENSE变量):
chmod +x src/scan.features.rb
注册的信息如下:
LICENSE_NAME="Tim Cook"
LICENSE_COMPANY="Apple Computer, Inc."
LICENSE_EMAIL="tcook@apple.com"
LICENSE_PLAN="ultimate"
LICENSE_USER_COUNT="2147483647"
LICENSE_EXPIRE_YEAR="2500"
./make.sh
生成的许可证在 build
文件夹下。
要使用的文件有 public.key
和 result.gitlab-license
。
我们要使用生成的 public.key
替换 GitLab 的 .license_encryption_key.pub
。
docker exec -it gitlab bash
rm /opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub
# 执行完下面这行将 public.key 的内容粘贴进去按一下回车就将内容写入 .license_encryption_key.pub 了。按 control + c 退出即可
cat > /opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub
gitlab-ctl reconfigure
gitlab-ctl restart
将 result.gitlab-license
的内容粘贴至
https://你的GitLab域名/admin/application_settings/general 点击 Add License 选择 Enter license key 粘贴你 result.gitlab-license
里的内容。
选择接受 TOS 点击 Add license。
经过测试 gitlab-ee 18.1.1 破解成功而且是 ultimate版本, 网上其他的版本都是Starter
参考: https://blog.mengguyi.com/articles/GitLab-Install-Docker.html