admin管理员组

文章数量:1122846

Is there a way to hash a string in the OS version of Varnish 7? For example using SHA256.

Basically I need an equivalent of this:

import digest;

sub vcl_hash {
    hash_data(req.url);
    hash_data(req.http.Host);

    if (req.http.Client-Cert) {
        hash_data(digest.hash_sha256(req.http.Client-Cert));
    }

    return (lookup);
}

but the digest VMOD is from the enterprise version and not found in the OS edition :/

I'm using the Docker version to be precise.

Is there a way to hash a string in the OS version of Varnish 7? For example using SHA256.

Basically I need an equivalent of this:

import digest;

sub vcl_hash {
    hash_data(req.url);
    hash_data(req.http.Host);

    if (req.http.Client-Cert) {
        hash_data(digest.hash_sha256(req.http.Client-Cert));
    }

    return (lookup);
}

but the digest VMOD is from the enterprise version and not found in the OS edition :/

I'm using the Docker version to be precise.

Share Improve this question edited Nov 22, 2024 at 10:16 Martynas Jusevičius asked Nov 22, 2024 at 10:10 Martynas JusevičiusMartynas Jusevičius 6122 gold badges10 silver badges25 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

You can find the source code here: https://github.com/varnish/libvmod-digest.

You'll have to compile it from source yourself though. Varnish Enterprise packages this VMOD for your convenience.

However vmod_digest isn't even Varnish Enterprise's main cryptographic VMOD. vmod_crypto actually has a lot more to offer.

If you can compile vmod_digest yourself, you'll probably be fine. If you need help, just contact Varnish Software here: https://www.varnish-software.com/contact-us/

本文标签: Hashing data in Varnish 7 opensourceStack Overflow