Class: SystemCheck::App::AuthorizedKeysPermissionCheck

Inherits:
BaseCheck
  • Object
show all
Defined in:
lib/system_check/app/authorized_keys_permission_check.rb

Instance Attribute Summary

Attributes inherited from BaseCheck

#skip_reason

Instance Method Summary collapse

Methods inherited from BaseCheck

#can_repair?, #can_skip?, check_fail, check_pass, display_name, #multi_check, #multi_check?, set_check_fail, set_check_pass, set_name, set_skip_reason, skip_reason

Methods included from Helpers

#finished_checking, #fix_and_rerun, #for_more_information, #omnibus_gitlab?, #sanitized_message, #see_installation_guide_section, #should_sanitize?, #start_checking, #sudo_gitlab, #try_fixing_it

Methods included from Gitlab::TaskHelpers

#all_repos, #ask_to_continue, #checkout_or_clone_version, #checkout_version, #clone_repo, #get_version, #gid_for, #gitlab_user, #gitlab_user?, #invoke_and_time_task, #os_name, #prompt, #repository_storage_paths_args, #run_and_match, #run_command, #run_command!, #uid_for, #user_home, #warn_user_is_not_gitlab

Methods included from Gitlab::Utils::StrongMemoize

#clear_memoization, #strong_memoize, #strong_memoized?

Instance Method Details

#check?Boolean

Returns:

  • (Boolean)

13
14
15
# File 'lib/system_check/app/authorized_keys_permission_check.rb', line 13

def check?
  authorized_keys.accessible?
end

#repair!Object


17
18
19
# File 'lib/system_check/app/authorized_keys_permission_check.rb', line 17

def repair!
  authorized_keys.create
end

#show_errorObject


21
22
23
24
25
26
27
28
# File 'lib/system_check/app/authorized_keys_permission_check.rb', line 21

def show_error
  try_fixing_it([
    "sudo chmod 700 #{File.dirname(authorized_keys.file)}",
    "touch #{authorized_keys.file}",
    "sudo chmod 600 #{authorized_keys.file}"
  ])
  fix_and_rerun
end

#skip?Boolean

Returns:

  • (Boolean)

9
10
11
# File 'lib/system_check/app/authorized_keys_permission_check.rb', line 9

def skip?
  !authorized_keys_enabled?
end