gitlab-ee破解

上一篇中介绍了如何安装gitlab企业版,本文介绍如何破解,毕竟白嫖使我快乐。

环境

1
2
3
4
5
6
7
8
9
sudo apt install ruby
sudo gem install gitlab-license

Fetching gitlab-license-2.4.0.gem
Successfully installed gitlab-license-2.4.0
Parsing documentation for gitlab-license-2.4.0
Installing ri documentation for gitlab-license-2.4.0
Done installing documentation for gitlab-license after 0 seconds
1 gem installed

破解

创建新脚本license.rb,修改时间

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
require "openssl"
require "gitlab/license"

key_pair = OpenSSL::PKey::RSA.generate(2048)
File.open("license_key", "w") { |f| f.write(key_pair.to_pem) }

public_key = key_pair.public_key
File.open("license_key.pub", "w") { |f| f.write(public_key.to_pem) }

private_key = OpenSSL::PKey::RSA.new File.read("license_key")
Gitlab::License.encryption_key = private_key

license = Gitlab::License.new
license.licensee = {
"Name" => "none",
"Company" => "none",
"Email" => "example@test.com",
}
license.starts_at = Date.new(2024, 5, 24) # 开始时间
license.expires_at = Date.new(2099, 12, 31) # 结束时间
license.notify_admins_at = Date.new(2099, 12, 1)
license.notify_users_at = Date.new(2099, 12, 1)
license.block_changes_at = Date.new(2099, 12, 31)
license.restrictions = {
active_user_count: 10000,
}

puts "License:"
puts license

data = license.export
puts "Exported license:"
puts data
File.open("GitLabBV.gitlab-license", "w") { |f| f.write(data) }

public_key = OpenSSL::PKey::RSA.new File.read("license_key.pub")
Gitlab::License.encryption_key = public_key

data = File.read("GitLabBV.gitlab-license")
$license = Gitlab::License.import(data)

puts "Imported license:"
puts $license

unless $license
raise "The license is invalid."
end

if $license.restricted?(:active_user_count)
active_user_count = 10000
if active_user_count > $license.restrictions[:active_user_count]
raise "The active user count exceeds the allowed amount!"
end
end

if $license.notify_admins?
puts "The license is due to expire on #{$license.expires_at}."
end

if $license.notify_users?
puts "The license is due to expire on #{$license.expires_at}."
end

module Gitlab
class GitAccess
def check(cmd, changes = nil)
if $license.block_changes?
return build_status_object(false, "License expired")
end
end
end
end

puts "This instance of GitLab Enterprise Edition is licensed to:"
$license.licensee.each do |key, value|
puts "#{key}: #{value}"
end

if $license.expired?
puts "The license expired on #{$license.expires_at}"
elsif $license.will_expire?
puts "The license will expire on #{$license.expires_at}"
else
puts "The license will never expire."
end

生成证书

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
hyper@hyper-gitlab:~/Documents$ ruby license.rb
License:
#<Gitlab::License:0x000055cd4d95eb18>
Exported license:
eyJkYXRhIjoiZGI5Y3ovZkh4VTRvSmZyQncwR2RNZU5Ma0lRRDVVK2c0ZUVh
UHJFc053R0RONE04S1lWS09Id2VZdFJvXG5pZUpzb3JXaHl5Tm9lVEFsS2Nr
Z1F4TjlMTlduMFgvNWw1VWdEK1BWOWlidE9zRGRYNUQ0NGRCWHE1UDhcbmZY
NVRhWm9NdUdzdDllYjdnY3QxT1dzbysyWlRpKy9SbTFLSUFRMXQ0ck1LWTlI
OEpMdmNqbjdSMGtYMlxuMXFYVWp2TmR5T0luNDBreHNONlNpbHNUUGg4aGlU
ZGxNTVhUdytTUThxMFF6eDgxUktEN0JZanpJK0hhXG4ybGozYzl2MW52UGRu
dUJjOVQzR0tEa2Y4RENyVnBlMlpLcUZpSThGbG9ibHluWkxjN3lDSFUvdG9o
d0dcbmRuTmxoN2MrSUdQZVZmUTYzYm5PVGJuWG9Dd1dZbkFzY1Mvd1Z1aHp3
SVpXUWxSVzhIYVJCbzNPZm9ielxuTFBHOHZ6ZVh2M0Q2eG8wUy9QblhmN3Jw
MDVCeGk1VVhXRlkrSGlnVXE2WUlzVXhlek9DVVRQV2UrR0NOXG5XMXR0Zm1V
ZG1RUk0vU0hSbzBiZUl6VWl6ZHF6KzNiTGpnbE5qcTVSR1FhMG5ScHV5Vk1H
Qk0rd1gySjhcbjdSMVZJTkhSWno1Q2FDVFp2NmNzcFhLZ1hMMDhWcWt1MmU1
SnlpNHlUeXNiZ1N4YXg4aFhRWVlMOUZuUVxuYlRiaTlKanZMUHFDMGp1TC9G
bEtaTUZrVVN1WDEweDlMM3hWYUlLdFA0SXVmdXlhc01QcmdIaitRaE5nXG42
ZEF0aktDdE9GOExxSGJrN1JXd1MveXlWaThzOXB0NUtyZVJEY1JVdm11UEJF
cXd5Um5hYXNMaVcyWDRcblVWTml1YzhnNC9wS2NzVUpNUStETkFDWHhxcUcx
Y1dFV3ZsT2RZdlEvcjhyXG4iLCJrZXkiOiJsbk8yL0tEME1KOWRaZG02YU84
TXZiN0ZoQkNKbHh5QnJWdUNEUVV4aDBMUW1XVVRocGhueExTVU96RzBcbmFI
N2VTRVJ6MnJ1OTFWSGZTVFljeityNG5nUmFZUEhWcURscXNJek9tZytoelpo
RmVGUVlFaHJ4VGo2bVxuV1hDZjZreHRRY1duUUQwVEZuOXY1NW8zUkYxZU1t
RFAyVjZVTHdjWGZESnJXdmlXMXQ2ZDlabGpGVmZoXG5UOHIrV0dvNGR5cEYr
ajBZM0tSdjBBSElKT2I3WTJEOEk0bnoxTzcxeTk4WnJObGVacDdpRzRjMTY3
b1Rcbis5WVp3TDBxL1duWEU5SVVxcGZoczhxRFY5dG5mS2puYjdIWXRCOUxH
NzViZDV3d3N1S0tmVjEvWDB5L1xuMk93UWFFZVQwNUZvZUpUT1dNZTlzbWt4
YXRad1lyMVhSaXM4N1YvSHRBPT1cbiIsIml2IjoicVhqbHA3VjIwU2ppNkxU
Z092S2tQZz09XG4ifQ==
Imported license:
#<Gitlab::License:0x000055cd4d9566c0>
This instance of GitLab Enterprise Edition is licensed to:
Name: none
Company: none
Email: example@test.com
The license will expire on 2099-12-31

同时生成三个文件

破解文件

1
2
3
GitLabBV.gitlab-license
license_key
license_key.pub

破解

使用license_key.pub替换/opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub

1
sudo cp license_key.pub /opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub

重启gitlab以使用新密钥

打开http://127.0.0.1/admin/application_settings/general,找到Add License

添加密钥

选择GitLabBV.gitlab-license

激活后

激活状态

可以看到当前是Starter计划,修改/opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb,修改plan函数

1
2
3
def plan
restricted_attr(:plan).presence || STARTER_PLAN
end

1
2
3
def plan
restricted_attr(:plan).presence || ULTIMATE_PLAN
end

修改后

订阅计划


gitlab-ee破解
https://feater.top/gitlab/how-to-crack-gitlab-ee/
作者
JackeyLea
发布于
2024年6月13日
许可协议