Skip to content
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

Merged
merged 7 commits into from
Jan 24, 2017
Merged

Add GPG support for reading router.db #674

merged 7 commits into from
Jan 24, 2017

Conversation

elmobp
Copy link
Contributor

@elmobp elmobp commented Jan 24, 2017

Add support for GPG encryption for router.db, open for feedback!

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)
Copy link
Owner

@ytti ytti Jan 24, 2017

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'
Copy link
Owner

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'
Copy link
Owner

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.

@elmobp
Copy link
Contributor Author

elmobp commented Jan 24, 2017

@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
Copy link
Owner

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry! Back in again :)

@ytti
Copy link
Owner

ytti commented Jan 24, 2017

Many thanks!

@ytti ytti merged commit 2a69179 into ytti:master Jan 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants