Skip to content

Commit

Permalink
fixes #1: refined key file check and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
timegrid committed Sep 11, 2015
1 parent fe64460 commit 1a558ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Administrators
Adding an existing private PGP key server-side
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#. Export the private PGP key (ascii armored) and save it into a file on the server
#. Export the private PGP key (ascii armored, from ``-----BEGIN PGP PRIVATE KEY BLOCK-----`` to ``-----END PGP PRIVATE KEY BLOCK-----``) and save it into a file on the server

#. Login as the user owning the redmine process (important for using the right gpg key ring)

Expand Down Expand Up @@ -210,7 +210,7 @@ Uninstallation

#. Downgrade the database

``$RAILS_ENV=production rake redmine:plugins:migrate NAME=openpgp VERSION=0``
``$RAILS_ENV=production bundle exec rake redmine:plugins:migrate NAME=openpgp VERSION=0``

#. Remove the files

Expand Down
2 changes: 1 addition & 1 deletion lib/tasks/update_redmine_pgpkey.rake
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace :redmine do

# open and validate keyfile
@key = File.open(keyfile, "rb").read
regex = /^\A\s*-----BEGIN PGP PRIVATE KEY BLOCK-----.*-----END PGP PRIVATE KEY BLOCK-----\s*?\z/m
regex = /^\A\s*-----BEGIN PGP PRIVATE KEY BLOCK-----(?:(?!-----BEGIN).)*?-----END PGP PRIVATE KEY BLOCK-----\s*\z/m
abort 'Error: PGP key not valid (it should start with "-----BEGIN PGP PRIVATE KEY BLOCK-----" and end with "-----END PGP PRIVATE KEY BLOCK-----")' if not @key.match(regex)
puts '... PGP key seems to be valid.'

Expand Down

0 comments on commit 1a558ac

Please sign in to comment.