首页 >php教程 >php手册 >GITLAB Fingerprint cannot be generated

GITLAB Fingerprint cannot be generated

WBOY
WBOY原创
2016-06-06 20:11:342909浏览

坑1: 在个人上传公钥的时候,提示生成指纹失败,没有什么能够阻挡俺们运维的脚步,gitlab web端是基于 On Rails的,也是个MVC典型框架, 看他这么像是一个flash效果 根据这点蛛丝马迹找处理方法去 log: Started POST /profile/keys for 127.0.0.1 at 2013-

坑1:

QQ图片20131118125307

在个人上传公钥的时候,提示生成指纹失败,没有什么能够阻挡俺们运维的脚步,gitlab web端是基于 On Rails的,也是个MVC典型框架,

看他这么像是一个flash效果

根据这点蛛丝马迹找处理方法去

log:

Started POST “/profile/keys” for 127.0.0.1 at 2013-11-15 12:37:36 +0800
Processing by Profiles::KeysController#create as HTML
Parameters: {“utf8″=>”?”, “authenticity_token”=>”a3SQrp7gXosUavont2fQajVYLHQh0C1NXVQEVGNYTEM=”, “key”=>{“title”=>”pcoffice”, “key”=>”ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEA75YFeVv2T0MxPlEcqYz2ajueinVwB/tbvgC1t5mFngkegPKbMyXU7zI5eqnZYDqLGcaf7rL7BwvkFjY++fvQCm7ohwHZi9ZEcU0xGH1izUvPLlHHGYsJG1FgBSYzHZvNw4KL5fo8STuC3JN96rtLkbhKtpOuc9AZ8o7tpAqpr6E= rsa-key-20131115″}}
Rendered profiles/keys/_form.html.haml (4.8ms)
Rendered profiles/keys/new.html.haml within layouts/profile (5.8ms)
Rendered layouts/_head.html.haml (2.4ms)
Rendered layouts/_search.html.haml (16.5ms)
Rendered layouts/_head_panel.html.haml (22.8ms)
Rendered layouts/_flash.html.haml (0.2ms)
Rendered layouts/nav/_profile.html.haml (3.2ms)
Completed 200 OK in 91ms (Views: 35.1ms | ActiveRecord: 3.1ms)

在app/model/key.rb模型类里找处理:

validates :fingerprint, uniqueness: true, presence: { message: ‘cannot be generated.. because of uniqueness!’ }

是这个validates触发了flash提示,

生成指纹的方法:

这个模型中有一个生成的方法,在校验的时候就会生成不了指纹,打印

?def generate_fingerpint
self.fingerprint = nil
return unless key.present?

cmd_status = 0
cmd_output = ”
Tempfile.open(‘gitlab_key_file’) do |file|
file.puts key
file.rewind
cmd_output, cmd_status = popen(“ssh-keygen -lf #{file.path}”, ‘/home/git/.ssh’)
end
puts cmd_output
puts cmd_status
if cmd_status.zero?
cmd_output.gsub /([\d\h]{2}:)+[\d\h]{2}/ do |match|
self.fingerprint = match
end
end
end

/tmp/gitlab_key_file20131115-26416-4buuyk is not a public key file.

结果最后!!

是因为selinux开着,需要setenforce=0即可。。。

因为selinux开着的话,中间的?popen(“ssh-keygen -lf #{file.path}”, 这个ssh-keygen -lf #{file.path}? 过程在服务器上怎么测试都不对,而服务器自身生成的默认的id_rsa.pub是可以打印出指纹的,后来发现,在selinux开着的情况下,路径只能是 ~.ssh/下的才能进行校验,关闭之后就可以根据其他路径的公钥来生成指纹了

QQ图片20131118125550

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn