commit - 1b626eae837ad61f2cd56fbd310ab9397b522c3a
commit + 1cdea97b6c74ec86e202431a208b5c99343f7273
blob - b9f997020363f4ffcab3c88d14cba9cee46477e8
blob + 09293f799a4b046ae685c292c58fd9a13de6d743
--- gmid.1
+++ gmid.1
Allow the proxying only from clients that provide a certificate
signed by the CA certificate in
.Ar file .
+.It Ic sni Ar hostname
+Use the given
+.Ar hostname
+instead of the one extracted from the
+.Ic relay-to
+rule for the TLS handshake with the proxied gemini server.
.It Ic use-tls Ar bool
Specify whether to use TLS when connecting to the proxied host.
Enabled by default.
blob - 2abdce04ab1750b7fbdebaafa01606ff9063ac32
blob + b2aa170ec80fee36d5c742ddad81606e572ffb70
--- gmid.c
+++ gmid.c
free(p->match_proto);
free(p->match_host);
free(p->host);
+ free(p->sni);
tls_unload_file(p->cert, p->certlen);
tls_unload_file(p->key, p->keylen);
free(p);
blob - 1dde21a616c047ea0605f1e9303d0df9417be29d
blob + a6741bf4fd67f104871baa9f9210d8b9d2eee535
--- gmid.h
+++ gmid.h
char *host;
const char *port;
+ char *sni;
int notls;
uint32_t protocols;
int noverifyname;
blob - 57cf3f5c72c7f07008879881d2a19bf18cb0cbb0
blob + d24005d6f7700dd639ac3a06de950dc67d8bf26f
--- parse.y
+++ parse.y
%token OCSP OFF ON
%token PARAM PORT PREFORK PROTO PROTOCOLS PROXY
%token RELAY_TO REQUIRE RETURN ROOT
-%token SERVER SPAWN STRIP
+%token SERVER SNI SPAWN STRIP
%token TCP TOEXT TYPE
%token USE_TLS USER
%token VERIFYNAME
if ((proxy->reqca = load_ca($4)) == NULL)
yyerror("couldn't load ca cert: %s", $4);
free($4);
+ }
+ | SNI string {
+ only_once(proxy->sni, "proxy sni");
+ free(proxy->sni);
+ proxy->sni = $2;
}
| USE_TLS bool {
proxy->notls = !$2;
{"return", RETURN},
{"root", ROOT},
{"server", SERVER},
+ {"sni", SNI},
{"spawn", SPAWN},
{"strip", STRIP},
{"tcp", TCP},
blob - 97d32578cf96864ca118af922cfd31755de4ed64
blob + 1a30531dd3cd6492113b4aca40aede35641985a2
--- proxy.c
+++ proxy.c
{
struct proxy *p = c->proxy;
struct tls_config *conf = NULL;
+ const char *hn;
if ((conf = tls_config_new()) == NULL)
return -1;
if (tls_configure(c->proxyctx, conf) == -1)
goto err;
- if (tls_connect_socket(c->proxyctx, c->pfd, p->host) == -1)
+ if ((hn = p->sni) == NULL)
+ hn = p->host;
+ if (tls_connect_socket(c->proxyctx, c->pfd, hn) == -1)
goto err;
c->proxyevset = 1;