Skip to content
Snippets Groups Projects
Commit ff33debb authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Ability to clear authorized_keys file

parent 768ae8eb
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -72,3 +72,7 @@ Remove key
 
./bin/gitlab-keys rm-key key-23 "ssh-rsa AAAAx321..."
 
Remoev all keys from authorized_keys file
./bin/gitlab-keys clear
Loading
Loading
@@ -10,6 +10,8 @@ require_relative '../lib/gitlab_init'
#
# /bin/gitlab-keys rm-key key-23 "ssh-rsa AAAAx321..."
#
# /bin/gitlab-keys clear"
#
 
require File.join(ROOT_PATH, 'lib', 'gitlab_keys')
 
Loading
Loading
Loading
Loading
@@ -17,6 +17,7 @@ class GitlabKeys
case @command
when 'add-key'; add_key
when 'rm-key'; rm_key
when 'clear'; clear
else
$logger.warn "Attempt to execute invalid gitlab-keys command #{@command.inspect}."
puts 'not allowed'
Loading
Loading
@@ -38,4 +39,8 @@ class GitlabKeys
cmd = "sed -i '/shell #{@key_id}\"/d' #{auth_file}"
system(cmd)
end
def clear
system("echo '# Managed by gitlab-shell' > #{auth_file}")
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment