diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | config/default.yml | 2 | ||||
-rw-r--r-- | lib/nickserver/config.rb | 2 | ||||
-rw-r--r-- | lib/nickserver/hkp/fetch_key.rb | 7 | ||||
-rw-r--r-- | lib/nickserver/hkp/fetch_key_info.rb | 2 | ||||
-rw-r--r-- | test/test_helper.rb | 4 |
6 files changed, 13 insertions, 6 deletions
@@ -54,6 +54,8 @@ Configuration Nickserver loads the configuration files `config/default.yml` and `/etc/leap/nickserver.yml`, if it exists. See `config/default.yml` for the available options. +The default HKP host is set to https://hkps.pool.sks-keyservers.net. The CA for this pool is available here https://sks-keyservers.net/sks-keyservers.netCA.pem + Usage ================================== diff --git a/config/default.yml b/config/default.yml index 4110b48..c72e3b7 100644 --- a/config/default.yml +++ b/config/default.yml @@ -1,5 +1,5 @@ couch_host: 'localhost' couch_port: 5984 couch_database: 'users' -sks_url: 'https://hkps.pool.sks-keyservers.net:/pks/lookup' +hkp_url: 'https://hkps.pool.sks-keyservers.net:/pks/lookup' port: 6425 diff --git a/lib/nickserver/config.rb b/lib/nickserver/config.rb index 56478e2..779f0a8 100644 --- a/lib/nickserver/config.rb +++ b/lib/nickserver/config.rb @@ -8,7 +8,7 @@ module Nickserver ] class << self - attr_accessor :sks_url + attr_accessor :hkp_url attr_accessor :couch_port attr_accessor :couch_host attr_accessor :couch_database diff --git a/lib/nickserver/hkp/fetch_key.rb b/lib/nickserver/hkp/fetch_key.rb index c72ee11..211ae92 100644 --- a/lib/nickserver/hkp/fetch_key.rb +++ b/lib/nickserver/hkp/fetch_key.rb @@ -1,5 +1,10 @@ require 'em-http' +# +# Fetch keys via HKP +# http://tools.ietf.org/html/draft-shaw-openpgp-hkp-00 +# + module Nickserver; module HKP class FetchKey @@ -22,7 +27,7 @@ module Nickserver; module HKP # def get_key_by_fingerprint(key_id) params = {:op => 'get', :search => "0x" + key_id, :exact => 'on', :options => 'mr'} - http = EventMachine::HttpRequest.new(Config.sks_url).get(:query => params) + http = EventMachine::HttpRequest.new(Config.hkp_url).get(:query => params) http.callback { if http.response_header.status != 200 self.fail http.response_header.status #"Request failed with #{http.response_header.status}: #{http.response}" diff --git a/lib/nickserver/hkp/fetch_key_info.rb b/lib/nickserver/hkp/fetch_key_info.rb index 48ef48a..dce0326 100644 --- a/lib/nickserver/hkp/fetch_key_info.rb +++ b/lib/nickserver/hkp/fetch_key_info.rb @@ -15,7 +15,7 @@ module Nickserver; module HKP def search(uid) # in practice, exact=on seems to have no effect params = {:op => 'vindex', :search => uid, :exact => 'on', :options => 'mr', :fingerprint => 'on'} - EventMachine::HttpRequest.new(Config.sks_url).get(:query => params).callback {|http| + EventMachine::HttpRequest.new(Config.hkp_url).get(:query => params).callback {|http| if http.response_header.status != 200 self.fail http.response_header.status else diff --git a/test/test_helper.rb b/test/test_helper.rb index 634f1a3..757bcd1 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -29,14 +29,14 @@ class MiniTest::Unit::TestCase def stub_sks_vindex_reponse(uid, opts = {}) options = {:status => 200, :body => ""}.merge(opts) - stub_http_request(:get, Nickserver::Config.sks_url).with( + stub_http_request(:get, Nickserver::Config.hkp_url).with( :query => {:op => 'vindex', :search => uid, :exact => 'on', :options => 'mr', :fingerprint => 'on'} ).to_return(options) end def stub_sks_get_reponse(key_id, opts = {}) options = {:status => 200, :body => ""}.merge(opts) - stub_http_request(:get, Nickserver::Config.sks_url).with( + stub_http_request(:get, Nickserver::Config.hkp_url).with( :query => {:op => 'get', :search => "0x"+key_id, :exact => 'on', :options => 'mr'} ).to_return(options) end |