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

Botan assert error crashing server #1918

Closed
WebFreak001 opened this issue Sep 7, 2017 · 1 comment
Closed

Botan assert error crashing server #1918

WebFreak001 opened this issue Sep 7, 2017 · 1 comment

Comments

@WebFreak001
Copy link
Contributor

source/app.d:

import vibe.d;

shared static this()
{
	auto settings = new HTTPServerSettings;
	settings.port = 8080;
	settings.bindAddresses = ["::1", "127.0.0.1"];
	settings.tlsContext = createTLSContext(TLSContextKind.server);
	settings.tlsContext.useCertificateChainFile("testing.crt");
	settings.tlsContext.usePrivateKeyFile("testing.key");

	auto router = new URLRouter;
	router.get("*", serveStaticFiles("./public"));

	listenHTTP(settings, router);
}

dub.json:

{
	"dependencies": {
		"vibe-d": "~>0.8.1",
		"vibe-d:tls": "*"
	},
	"versions": [
		"VibeDefaultMain"
	],
	"subConfigurations": {
		"vibe-d:tls": "botan"
	},
	"name": "test-app"
}

Generate local test keys script:

#!/bin/bash
NAME=${1:-testing}

openssl req \
  -newkey rsa:4096 \
  -days 1001 \
  -nodes \
  -x509 \
  -subj "/C=US/ST=California/L=San Francisco/O=Twitch/OU=web/CN=localhost" \
  -extensions SAN \
  -config <( cat $( [[ "Darwin" = "$(uname -s)" ]]  && echo /System/Library/OpenSSL/openssl.cnf || echo /etc/ssl/openssl.cnf  ) \
    <(printf "[SAN]\nsubjectAltName='DNS:localhost'")) \
  -keyout "${NAME}.key" \
  -out "${NAME}.crt"

echo ""
echo "Generated $NAME.key and $NAME.crt files in local directory"
echo ""

if [[ "$OSTYPE" == "darwin"* ]]; then
  echo "Installing cert into local Keychain."
  echo "To see or modify, run 'Keychain Access' app and look in the 'System' Folder"
  sudo security add-trusted-cert -d -p ssl -r trustRoot -k "/Library/Keychains/System.keychain" "${NAME}.crt"
else
  echo "Please install and trust cert at $PWD/$NAME.crt"
fi

Generate the keys using that shell script, run the server and try accessing https://127.0.0.1:8080/ - the server will crash with this exception:

core.exception.AssertError@../../.dub/packages/vibe-d-0.8.1/vibe-d/tls/vibe/stream/botan.d(70): Incompatible interface method requested
----------------
??:? _d_assert_msg [0xc315f3ce]
??:? @property @safe vibe.stream.tls.TLSCertificateInformation vibe.stream.botan.BotanTLSStream.peerCertificate() [0xc2d90072]
??:? @safe bool vibe.http.server.handleRequest(vibe.core.stream.Stream, vibe.core.net.TCPConnection, vibe.http.server.HTTPListenInfo, ref vibe.http.server.HTTPServerSettings, ref bool, scope std.experimental.allocator.IAllocator) [0xc2cd6b00]
??:? @trusted void vibe.http.server.handleHTTPConnection(vibe.core.net.TCPConnection, vibe.http.server.HTTPListenInfo).__lambda4() [0xc2cd66e0]
??:? @safe void vibe.http.server.handleHTTPConnection(vibe.core.net.TCPConnection, vibe.http.server.HTTPListenInfo) [0xc2cd6541]
??:? nothrow @safe void vibe.http.server.listenHTTPPlain(vibe.http.server.HTTPServerSettings, vibe.http.server.HTTPServerContext).doListen(vibe.http.server.HTTPListenInfo, vibe.http.server.HTTPServerContext, bool, bool).__lambda6(vibe.core.net.TCPConnection) [0xc2cd5d50]
??:? void vibe.core.drivers.libevent2_tcp.ClientTask.execute() [0xc312dbc7]
??:? void vibe.core.core.makeTaskFuncInfo!(void delegate()).makeTaskFuncInfo(ref void delegate()).callDelegate(vibe.core.core.TaskFuncInfo*) [0xc30c4f77]
??:? void vibe.core.core.CoreTask.run() [0xc30c06fa]
??:? void core.thread.Fiber.run() [0xc31ac8ab]
??:? fiber_entryPoint [0xc31ac60a]
??:? [0xffffffff]
@Geod24
Copy link
Contributor

Geod24 commented Oct 21, 2017

Happened to me with a client request (requestHTTP("https://...")) as well:

core.exception.AssertError@../../../../home/geod24/.dub/packages/vibe-d-0.8.2-alpha.2/vibe-d/tls/vibe/stream/botan.d(70): Incompatible interface method requested
----------------
??:? _d_assert_msg [0xe6bfaf4a]
??:? @property @safe vibe.stream.tls.TLSCertificateInformation vibe.stream.botan.BotanTLSStream.peerCertificate() [0x591df1f2]
??:? @trusted bool vibe.http.client.HTTPClient.doRequest(scope void delegate(vibe.http.client.HTTPClientRequest), ref bool, bool, std.datetime.systime.SysTime).__lambda10() [0x5912e87f]
??:? @safe bool vibe.http.client.HTTPClient.doRequest(scope void delegate(vibe.http.client.HTTPClientRequest), ref bool, bool, std.datetime.systime.SysTime) [0x5912e504]
??:? @safe bool vibe.http.client.HTTPClient.doRequestWithRetry(scope void delegate(vibe.http.client.HTTPClientRequest), bool, out bool, out std.datetime.systime.SysTime) [0x5912def5]
??:? @trusted void vibe.http.client.HTTPClient.request(scope void delegate(scope vibe.http.client.HTTPClientRequest), scope void delegate(scope vibe.http.client.HTTPClientResponse)) [0x5912d904]
??:? @safe void vibe.http.client.requestHTTP(vibe.inet.url.URL, void delegate(scope vibe.http.client.HTTPClientRequest), scope void delegate(scope vibe.http.client.HTTPClientResponse), const(vibe.http.client.HTTPClientSettings)) [0x5912c7b1]
??:? @safe void vibe.http.client.requestHTTP(immutable(char)[], scope void delegate(scope vibe.http.client.HTTPClientRequest), scope void delegate(scope vibe.http.client.HTTPClientResponse), const(vibe.http.client.HTTPClientSettings)) [0x5912c471]
??:? void slacklib.Client.SlackClient.webr(const(char)[], const(char)[], const(char)[][]...).WebReq.request(scope void delegate(scope vibe.http.client.HTTPClientRequest), scope void delegate(scope vibe.http.client.HTTPClientResponse)) [0x5912ad12]
??:? slacklib.SlackClient slacklib.SlackClient.start(immutable(char)[]) [0x5912af4a]
??:? void app.startBot(immutable(char)[]) [0x591061af]
??:? void app._sharedStaticCtor1().__lambda1() [0x59106177]
??:? void vibe.core.core.makeTaskFuncInfo!(void delegate()).makeTaskFuncInfo(ref void delegate()).callDelegate(vibe.core.core.TaskFuncInfo*) [0x5911e903]
??:? void vibe.core.core.CoreTask.run() [0x5950ecce]
??:? void core.thread.Fiber.run() [0xe6bff807]
??:? fiber_entryPoint [0xe6bfec12]
??:? [0xffffffff]
Program exited with code 1

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

No branches or pull requests

2 participants