A new user interface for you! Read more...

File gitlab-generate-secrets of Package gitlab-common

#!/usr/bin/ruby

require 'securerandom'
require 'fileutils'

BASEDIR=ARGV.first || '/srv/www/vhosts/gitlab-ce'

def write_secret_file(secret_file, secret_size)
  secret_file=File.join(BASEDIR, secret_file)
  unless File.size?(secret_file)
    secret_token = SecureRandom.hex(secret_size)
    File.write(secret_file, secret_token)
  end
  FileUtils.chown 'root', 'gitlab', secret_file
end

def write_secret_base64_file(secret_file, secret_size)
  secret_file=File.join(BASEDIR, secret_file)
  unless File.size?(secret_file)
    secret_token = SecureRandom.base64(secret_size)
    File.write(secret_file, secret_token)
  end
  FileUtils.chown 'root', 'gitlab', secret_file
end

File.umask(027)

write_secret_file        '.gitlab_shell_secret',     16
write_secret_file        '.gitlab_pages_secret',     16
write_secret_base64_file '.gitlab_workhorse_secret', 32