summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2018-02-05feature: enamble wkd lookupfeature/web-key-directoryAzul
fixes #1
2018-02-05feature: hand out other key types like katzenpost keysAzul
2017-11-04refactor: turn Hkp::Response into KeyResponserefactor/clarify-responseAzul
We now also use it from wkd and it seems like a generally useful kind of response.
2017-11-03fix: no expiration date means not outdatedAzul
We were using Time.at(expirationdate) even if it was nil which led to using the Time.at(0). Instead an unset expirationdate is meant to not expire the key at all. Our tests did not catch this because the assertions were in blocks that did not get run at all. (at least in the HKP integration test).
2017-09-23style: avoid endless elsif in KeyInfo#errorAzul
using an array of symbols representing the different checks now.
2017-09-23refactor: move error detection into key_infoAzul
Still needs something better than all these elsifs though
2017-09-23style: more rubocop fixesAzul
2017-09-23style: rubocop mostly auto-correctAzul
2017-09-23wkd: implement basic lookup of keys through wkdAzul
wkd is the web key directory. See the Readme.md in /lib/nickserver/wkd
2017-09-22fiX: tests need different names, warningsAzul
2017-09-22wkd: implement basic lookup of keys through wkdAzul
wkd is the web key directory. See the Readme.md in /lib/nickserver/wkd
2017-08-03Version 0.10.00.10.0Azul
This is a maintainance release - bugfixes and upgrades of dependencies. This release fixes a major issue with leaking file descriptors. Please upgrade as soon as possible. Ruby 2.1 is required - no other upgrade issues are known. bugfixes: * #3 handle domains without A-record * filedescriptor leak from http_adapters * send empty json object on 404 rather than nil * remote nicknym is on port 6425 * use user:password@ prefix in http basic auth upgrades: * require at least ruby 2.1 * upgrade bundled gems to latest available tests: * more meaningful error messages in case of failures * test bundle is up to date * regression test for nonexisting domain integration: * Add systemd service unit file * Restart nickserver automatically from systemd * gitignore: bundle dir cleanup: * old empty adapters and tests
2017-07-24fix: #3 handle domains without A-recordAzul
If a domain only has an mx record but no A record it will trigger a ConnectionError when attempting the nicknym key lookup. We need to detect and handle this in the http adapter already because once the exception is handled by Celluloid our actor will be terminated. So now we allow for handing a rescue option to the adapter with a string that is checked for inclusion in the error message. If the string is found the exception will be caught and the adapter returns nil. We only make use of this when checking the availability of nicknym so far. That should be the only http request going out.
2017-07-21fix: filedescriptor leak from http_adaptersAzul
Now we reuse a single adapter for all requests triggered by an incoming request. Then we .terminate the adapter. Includes a regression test.
2016-12-05bugfix: send empty json object on 404 rather than nilversion/0.9Azul
sending nothing was keeping the connection alive.
2016-12-02bugfix: remote nicknym is on port 6425Azul
We may use a different port in the config that is then mapped somehow. But this should not affect where we try to contact remote nicknym servers.
2016-12-02debug: raise error on 401Azul
This will get us more debug info in the logs if it happens again
2016-12-02bugfix: use user:password@ prefix in http basic authAzul
http.rb does not do this on its own.
2016-12-02cleanup: old empty adapters and testsAzul
2016-10-17Version 0.9.00.9.0Azul
Allow queries by fingerprint (using keyservers to reply) and support key lookup from other nickservers. This is a major rewrite both in terms of our dependencies and our architecture. We moved the server and http_client from eventmachine to Celluloid based libraries. This allows for a more concise syntax and proper https handling. In addition we now support ruby 2.3, use a Logger instead of stdout and handle network errors properly
2016-09-30change default adapter to CelluloidHttpAzul
Turns out without this nickserver will not respond to multiple concurrent requests.
2016-09-30logger: log celluloid errors to default logAzul
2016-09-30logger: log to STDOUT when run in foregroundAzul
2016-09-30logging: use proper loggerAzul
This way the logs do not interfere with test output
2016-09-29use stderr for errorsAzul
2016-09-29skip tests with ConnectionErrorsAzul
We handle these errors nicely in the dispatcher and have tests for that. Tests should fail or err out when running into exceptions we are not handling yet. But for these it's better to just skip.
2016-09-24log HTTP::ConnectionErrors, respond with json bodyAzul
2016-09-24use plain http.rb rather than celluloid i/oAzul
Turns out http.rb does not support celluloid i/o andymore and we were not making use of it anyway. Here's what https://github.com/httprb/http/wiki/Thread-Safety says: (NOTE: this gem previously supported Celluloid::IO, but that support was removed to add the current timeout backend. It may be added back in a future version) So now we have a plain http.rb adapter and use that as the default. This prevents actors from crashing in the adapter (as we don't have any).
2016-09-23basic logging and recovery from exceptions raisedAzul
2016-09-22return nil on 404 in hkp sourceAzul
This way the other RequestHandlers can give it a try. If none handles it we'll get a 404 anyway. But maybe there's been an exception before so a 502 should be send.
2016-09-22hand on connection errors to dispatcher so it can handle itAzul
2016-09-22feature: 502 on ConnectionErrorsAzul
If one source raises a 502 and no other handler has any result we'll respond with a 502 - bad gateway.
2016-09-21feature: activate nicknym lookupAzul
2016-09-21rescue and track exceptions in handler chainAzul
2016-09-19refactor: separate handler chain from dispatcherAzul
Handler Chain is of handlers that respond to call. Invoking handle(*args) on the chain will call the handlers with the given args until one of them returns a result that is truethy (i.e. not false or nil). Extracted from the dispatcher so we can also handle exceptions there in the future. (So that if one of the network connections to the request_handlers fails we can continue while still tracking the failed exception.)
2016-09-16deal with network issues in nicknym sourceAzul
This is a first step. In case the suspected nicknym server cannot be reached we will now move on and try other sources. It's robably not what we want in the long run. In order to know wether no key exists or we just failed to connect to some servers a different http response code would be nice if network errors occured. This simplifies testing such scenarios in the unit test and makes the remote tests skip on network failure.
2016-09-16bugfix: load order issue in server, include testAzul
Includes our first functional test. This one only makes sure loading the bin/nickserver actually works fine. Enough to catch this bug.
2016-09-16test: properly test nicknym source + fixesAzul
2016-09-12test: separate remote tests into own directoryAzul
Dropped the webmock dependency. We have our own http adapter. So we can stub that to inject a mock. As an added bonus this does not mess with other http requests. Also wrote down testing strategy. Not completely implemented yet.
2016-09-12[wip] nicknym source query implementedAzul
Also changed Nickserver::Response to not include the status code. This may be okay for error responses but in most cases we want to have a parsable message and not some status code prepended to it.
2016-09-10refactor: remove global require in test_helperAzul
require all the things we depend upon where we depend upon them.
2016-08-31wip: key lookup by address via leaps nicknymAzul
I added a RequestHandler that uses Nicknym::Source - but that has not been implemented yet.
2016-08-30refactor: make the RequestHandler classes callableAzul
Whenever a RequestHandler class is called we instantiate it with the request. Then we call handle on the instance. This way we can access the request and its content via accessors rather than only in the handle method.
2016-08-30refactor: rename EmailHandler to HkpEmailHandlerAzul
2016-08-30feature: keep trying if no Host header givenAzul
So far we would error out if no host was specified in the config or the request. It's true that we can't do local lookup if we don't know our own domain. However we can still use HKP. In the future we will query leaps own API for other providers. If the host was not set in the initial request we might even proxy a request to ourselves. Providing the Host header will prevent an infinite loop in that case.
2016-08-29refactor: split EmailHandler in 3Azul
InvalidEmailHandler - handle emails with an invalid format LocalEmailHandler - handle emails on the local domain EmailHandler - handle all other emails by using hkp This is a preparation to add leap provider email lookup and remove hkp eventually. But for now we keep the behaviour the same and only refactor.
2016-08-29cleanup: remove outdated ideasAzul
Lookup and InvalidSource were experiments for a design for the dispatching. Our new dispatcher seems better.
2016-08-29refactor: let handlers check if they are applicableAzul
Instead of testing the preconditions for each handler in the dispatcher the dispatcher hands a request to one handler after the other until one of them responds. This is similar to the Chain of Responsibility patter but we iterate over the 'handler_chain' array instead of a linked list. To change the order of handlers or add other handlers change the array in the handler_chain function.
2016-08-29refactor: split up ResponseHandlerAzul
Now we have a Dispatcher and two ResponseHandlers that have the same interface. Moving towards a Chain of Responsibility pattern.
2016-08-29expose Request class from RequestHandlerAzul
This way we can separate the EmailHandler and the FingerprintHandler as well.