• 破解Gitlab EE 15


    安装gitlab-ee

    参考我的文章 鹏叔的IT技术博客空间 - gitlab安装升级及迁移

    环境说明

    当前我的gitlab版本及环境如下:

    gitlab-ee版本为: 15.0.2-ee

    
    $gitlab-rake gitlab:env:info
    
    output:
    
    System information
    System:
    Proxy:          no
    Current User:   git
    Using RVM:      no
    Ruby Version:   2.7.5p203
    Gem Version:    3.1.4
    Bundler Version:2.2.33
    Rake Version:   13.0.6
    Redis Version:  6.2.6
    Sidekiq Version:6.4.0
    Go Version:     unknown
    
    GitLab information
    Version:        15.0.2-ee
    Revision:       94267b33436
    DB Adapter:     PostgreSQL
    DB Version:     12.10
    Elasticsearch:  no
    Geo:            no
    Using LDAP:     no
    Using Omniauth: yes
    Omniauth Providers:
    
    

    安装必要软件

    安装ruby

    • 安装ruby:

      # 查看ruby版本
      yum list ruby --showduplicates | sort -r
      
    • 在Centos7.3中,通过yum安装ruby的版本是2.0.0,但是本破解过程需要2.5或以上版本的ruby环境
      所以需要先添加yum源再安装ruby

      yum install centos-release-scl-rh    //会在/etc/yum.repos.d/目录下多出一个CentOS-SCLo-scl-rh.repo源
      
      yum install rh-ruby25 -y   //直接yum安装即可  
      
      scl  enable  rh-ruby25 bash //必要一步
      
      ruby -v //查看安装版本
      # ruby 2.5.9p229 (2021-04-05 revision 67939) [x86_64-linux]
      
      gem -v //查看gem安装版本
      
      

    安装gitlab-license

    gem install gitlab-license
    

    破解方法

    • 创建一个rb文件

      cd /var/opt/gitlab/backups
      cat > license.rb
      
    • 将如下内容拷贝到license.rb

      
          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(2021, 1, 1) # 开始时间
          license.expires_at = Date.new(2050, 1, 1) # 结束时间
          license.notify_admins_at = Date.new(2049, 12, 1)
          license.notify_users_at = Date.new(2049, 12, 1)
          license.block_changes_at = Date.new(2050, 1, 1)
          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
      
      
    • 生成 GitLabBV.gitlab-license license_key license_key.pub 这三个文件。

      cd /var/opt/gitlab/backups
      ruby license.rb
      
    • 使用许可证

      • 首先备份 /opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub

          cp /opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub /opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub.backup
        
      • 用 license_key.pub 文件替换 /opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub 中的内容

      • GitLabBV.gitlab-license 即是许可证,填入 http://${your_gitlab_server_address}/admin/application_settings/general 例如:http://localhost:8080/admin/license 勾选Terms of service 并点击add license按钮, 当看到这段话, 表示成功。The license was successfully uploaded and is now active. You can see the details below.

    • 修改等级

        --- /opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb
        +++ /opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb
        @@ -367,7 +367,7 @@
        end
      
        def plan
        -    restricted_attr(:plan).presence || STARTER_PLAN
        +    restricted_attr(:plan).presence || ULTIMATE_PLAN
        end
      
        def edition
      
    • 重启gitlab

       gitlab-ctl restart
      

    参考文档

    破解Gitlab EE
    docker安装gitlab-ee并破解

  • 相关阅读:
    问题 A: 【递归入门】全排列
    第一个struct2程序(2)
    第一个struct2程序
    Java学习 第二节
    重学Java
    Servlet过滤器
    struct2
    Java web struct入门基础知识
    one by one 项目 part 6
    软件工程导论 桩模块和驱动模块
  • 原文地址:https://www.cnblogs.com/guoapeng/p/16816476.html
Copyright © 2020-2023  润新知