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

Illegal SNI hostname received [49, 48, 46, 48, 46, 48, 46, 52] #94

Closed
huguesBouvier opened this issue Jan 13, 2022 · 1 comment
Closed

Comments

@huguesBouvier
Copy link

I am getting Illegal SNI hostname received [49, 48, 46, 48, 46, 48, 46, 52] when hooking up a server to a legacy system.

This is my configuration:

let tls_cfg = {
    // Load public certificate.
    let server_cert = X509::stack_from_pem(server_cert.as_bytes()).unwrap();

    let mut server_certs: Vec<Certificate> = Vec::new();
    for x509 in server_cert {
        let certificate = tokio_rustls::rustls::Certificate(x509.to_der().unwrap());
        server_certs.push(certificate);
    } 

    // Load private key.
    let server_key = pem_parser::pem_to_der(server_key);
    let server_key = tokio_rustls::rustls::PrivateKey(server_key);                
    // Do not use client certificate authentication.
    let mut cfg = ServerConfig::builder()
        .with_safe_defaults()
        .with_no_client_auth()
        .with_single_cert(server_certs, server_key)
        .unwrap();

    // Configure ALPN to accept HTTP/2, HTTP/1.1 in that order.
    //cfg.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()];
    sync::Arc::new(cfg)
};
let acceptor = tokio_rustls::TlsAcceptor::from(tls_cfg);
let client_stream = acceptor.accept_with(client_stream, session).await.unwrap();

Is there a way to ignore that illegal SNI message since I cannot change the code the generates it?

@djc
Copy link
Contributor

djc commented Jan 13, 2022

This should probably be filed against rustls, not tokio-rustls.

There is no way to ignore an illegal message. The hostname you posted is actually an IP address (10.0.0.4), which rustls doesn't support yet.

@djc djc closed this as completed Jan 13, 2022
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