-
Notifications
You must be signed in to change notification settings - Fork 929
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
Add GPG support for reading router.db #674
Conversation
crypto = GPGME::Crypto.new :password => @cfg.gpg_password | ||
file = crypto.decrypt(File.open(@cfg.file)).to_s | ||
else | ||
file = open(File.expand_path @cfg.file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps
file = File.expand_path(@cfg.file)
file = if @cfg.gpg?
crypto = GPGME::Crypto.new password: @cfg.gpg_password
crypto.decrypt(file)
else
open(file)
end
``` | ||
source: | ||
default: csv | ||
csv: | ||
file: ~/.config/oxidized/router.db | ||
delimiter: !ruby/regexp /:/ | ||
gpg: 'false' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gpg: false
not string false
@@ -1,3 +1,3 @@ | |||
source 'https://rubygems.org' | |||
|
|||
gem 'gpgme' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't put requirements in Gemfile, they're in spec file. But I would not want to mandate installing gpgme
. I would put it in CVS#setup
as require 'gpgme' if @cfg.gpg
, so that we only load it, if user is actually using it.
@ytti apologies :) hows that looking? |
@@ -10,15 +10,23 @@ def setup | |||
Oxidized.asetus.user.source.csv.file = File.join(Config::Root, 'router.db') | |||
Oxidized.asetus.user.source.csv.delimiter = /:/ | |||
Oxidized.asetus.user.source.csv.map.name = 0 | |||
Oxidized.asetus.user.source.csv.map.model = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this line being removed intentionally? If so, can you try to elaborate why.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry! Back in again :)
Many thanks! |
Add support for GPG encryption for router.db, open for feedback!