Skip to content

Invalid SSH private keys in database throws 500 Internal Server Error #305

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rchady opened this issue Oct 30, 2014 · 1 comment
Closed
Assignees
Labels

Comments

@rchady
Copy link

rchady commented Oct 30, 2014

If you have a database you are bringing to a new installation and the SSH keys for it are no longer valid, instead of displaying the page with red exclamation marks, you get a 500 Internal Server Error. This makes it impossible to update the data without directly manipulating it in the database. The error you receive is:

ActionView::Template::Error (No such file or directory - keyfile.pub):
    86:
    87:   <tr>
    88:     <td><%= l(:label_mirroring_keys_installed) %></td>
    89:     <td><%= image_tag (RedmineGitolite::GitoliteWrapper.mirroring_keys_installed?(:reset => true) ? 'true.png' : 'exclamation.png') %></td>
    90:   </tr>
    91:
    92:   <tr>

This is because in lib/redmine_gitolite/gitolite_modules/mirroring.rb, the install_private_key and install_public_key methods try to read the file blindly in the sudo_install_file() call:
sudo_install_file(File.read(gitolite_ssh_private_key), gitolite_ssh_private_key_dest_path, '600')

The fix for this is trivial, toss a begin/rescue block around that call and it works as expected.

@n-rodriguez n-rodriguez added the bug label Nov 8, 2014
@n-rodriguez n-rodriguez self-assigned this Nov 8, 2014
@n-rodriguez
Copy link
Contributor

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants