A torture test for gemini servers.
Python 3.7 or newer.
Tests that inspect TLS certificates additionally require that the pyca/cryptography library be installed.
This script originated from an idea on the gemini mailing list that it would be nice to have a gemini "torture test" to uncover bugs and unhandled edge cases in new server implementations. It was originally called jetforce-diagnostics and was bundled with the jetforce server. Now it has been moved to its own repository and operates as a separate project.
usage: gemini-diagnostics [host] [port] [--help] A diagnostic tool for gemini servers. This program will barrage your server with a series of requests in an attempt to uncover unexpected behavior. Not all of these checks adhere strictly to the gemini specification. Some of them are general best practices, and some trigger undefined behavior. Results should be taken with a grain of salt and analyzed on their own merit. positional arguments: host server hostname (default: localhost) port server port (default: 1965) optional arguments: -h, --help show this help message and exit --checks CHECKS comma separated list of checks to apply --show-checks display the complete list of checks and exit --delay DELAY seconds to sleep between checks (default: 2)
- Establish a connection over an IPv4 address.
- Establish a connection over an IPv6 address.
- Server must negotiate at least TLS v1.2, ideally TLS v1.3.
- Certificate claims must be valid.
- Certificate should be self-signed or have a trusted issuer.
- Server should send a close_notify alert before closing the connection.
- Non-TLS requests should be refused.
- Server should support concurrent connections.
- Validate the response header and body for the root URL.
- The root URL should return the same resource with or without the trailing slash..
- Request a gemini URL that does not exist.
- A request without a should timeout.
- Send the URL with the port explicitly defined.
- A URL without a scheme should result in a 59 Bad Request.
- Send the URL using the IPv4 address.
- Send a URL containing a non-UTF8 byte sequence.
- Send a 1024 byte URL, the maximum allowed size.
- Send a 1025 byte URL, above the maximum allowed size.
- A URL with an incorrect port number should be rejected.
- A URL with a foreign hostname should be rejected.
- Send a URL with an HTTP scheme.
- Send a URL with an HTTPS scheme.
- Send a URL with a Gopher scheme.
- Empty URLs should not be accepted by the server.
- Relative URLs should not be accepted by the server.
- Random text should not be accepted by the server.
- A URL should not be able to escape the root using dot notation.
Contributions are welcome!