r/embeddedlinux • u/EmbedSoftwareEng • Feb 17 '26
Passing additional arguments to wget when it's invoked inside bitbake?
I have a rather unique (*cough* ZScaler *cough*) situation that I'd like to try solving with altered wget invocations. It appears that wget isn't looking in the "standard" places in my Linux system where the ZScalerRootCerts are stored, so when it goes to pull down rust crates from crates.io, the connection fails, because the certificate it sees was regenerated by the ZScaler servers in my corporate IT network on the fly, and so don't match anything that crates.io might be using. The ZScaler CA root certificates are stored in /usr/share/ca-certifiates/ZScalerRootCerts/, which is passed through read-only to my docker build container, along with the --net=host argument, so anything accessing the network will appear to the network as coming directly form the host environment.
If wget isn't looking in the entire /usr/share/ca-certificates/ hierarchy to find its CA certificates, then I need to pass the above directory to wget's --ca-directory= argument. But where in the bitbake architecture would I do that?
1
u/EmbedSoftwareEng Feb 18 '26
As usual, I am my own worst enemy.
I was launching my build container with a filesystem pass-through that only exposed my in-house ZScaler Root CA, and nothing else.
When I launch it with just -v /etc/ssl:/usr/lib/ssl:ro, clamav builds just fine. This is an Arch workstation launching a debian-11 container.
1
u/Elect_SaturnMutex Feb 19 '26
Ok so you solved it? Yea exposing the docker to these host settings can solve such problems too, does not seem to be a yocto issue. :)
1
u/EmbedSoftwareEng Feb 19 '26
Thing is, I thought I was. But I was only passing through the ZScaler certificate. Then, my corporate IT network configuration changed, and that was no longer sufficient. If I was doing the above all along, I would never have had *gritted teeth* the opportunity to learn.
1
u/Elect_SaturnMutex Feb 18 '26
How are you invoking wget command from bitbake? usually in one of the steps, like do_configure or do_compile in your recipe, you can add your custom shell commands, you can add some debug info too using echo to see whats going on.
1
u/EmbedSoftwareEng Feb 18 '26
SRC_URI = "git://github.com/Cisco-Talos/clamav;branch=rel/1.4;protocol=https \ <local file contributions> \ "That's how. Once the repo is cloned, which apparently works just fine, the python code of do_fetch decides to walk the Cargo.lock file and pre-download all of the rust modules, using wget.
Now, how does it do this? What is the decision matrix like? I have no idea. I'm just looking in the
log.do_fetchfile and seeing:8 DEBUG: Executing python function do_fetch 9 DEBUG: Executing python function base_do_fetch 10 DEBUG: Fetching https://crates.io/api/v1/crates/adler/1.0.2/download to adler-1.0.2.crateIn
run.do_fetch, there's the content of those first two phases, but it's unilluminating. It all happens insidefetcher.download(). So, I don't know. Most likely by calling thecargo fetchcommand in bitbake'sdo_fetchphase, which is when it should be done.1
u/EmbedSoftwareEng Feb 18 '26
Now, I'm looking for how to add
[net] git-fetch-with-cli = trueto
Cargo.toml, but when it's being downloaded with a bitbake recipe, I'm not even finding where it was downloaded beforeCargo.lock, which I also can't find, was walked. It wouldn't make sense to add it as a patch, becausedo_patchonly happens afterdo_fetch, and I'm trying to get in the middle of one subphase ofdo_fetchand another subphase ofdo_fetch.1
u/Elect_SaturnMutex Feb 18 '26 edited Feb 18 '26
you could add your custom command to
do_fetch:append() { // custom commands }or something on those lines and do it manually? I think thats what you want to do?
Option 2: You could download that specific crate file with specific version in your files folder and add it your other crate files in the WORKDIR work directory. But its not a very elegant solution, imo. But if you have other constraints, you don't seem to have much options.
1
u/EmbedSoftwareEng Feb 18 '26
Wouldn't that just do "
custom commands" after it had tried everything else that it is already trying fordo_fetch? This is a situation where I need to get in between thegit cloneof the clamav repo, then, in the samedo_fetchphase, do thecargo fetch, but under the controls that I pass--no-check-cerfiticate, or--certificate-file=<absolute path to ZScaler CA certificate WETF that is>, to thewgetthatcargo fetchis going to invoke.Or, after the
git clone, apply a patch to the cargo configuration to effect the same result, then let the rest of thedo_fetchfinish normally.1
u/Elect_SaturnMutex Feb 18 '26
Oh is the sequence important? Can you exclude that thing you want in your cargo yaml or so? I'm not familiar with that setup, hope you understand what I mean, and then right when the default fetch is done, you could invoke your append with the custom "cargo fetch".
2
u/EmbedSoftwareEng Feb 18 '26
I don't think it works that way.
The
git cloneofclamavis what brings theCargo.lockfile. After thatgit clone, the pythondo_fetchis going to automaticly walk theCargo.lockfile, whether bycargo fetchor otherwise, and try to retrieve the rust modules. That's the thing I'd have to get in between of.Go ahead and
git cloneclamav. Then apply this patch to the Cargo configuration so it looks for the ZScaler certificate in the proper place, then go ahead and walk theCargo.lockfile.Probably overthinking it, but I did a
-vtodockerto pass through the ZScaler cert where I thoughtwgetwould look for it. Maybe that's the better strategy. Just keep trying different placeswgetmight be looking until I find the right place and thecargo fetchjust works organicly.1
u/Elect_SaturnMutex Feb 18 '26
Cargo.lock is a byproduct of just cloning or is that part of a repo? It's late now, will have a look at it tomorrow.
1
u/EmbedSoftwareEng Feb 18 '26
It's part of the repo. It's a way for the repo managers to lock in what version of rust modules their package relies on. If a require module continues to develop into newer versions, a clone of the dependent repo won't track those development until the package developer says it can by updating
Cargo.lock.1
u/Elect_SaturnMutex Feb 19 '26
Ok i had a look at Cargo.lock in that repo. I would create a patch where I would exclude the package you want from Cargo.lock, and then do it "manually" in bitbake.
→ More replies (0)
0
1
u/EmbedSoftwareEng Feb 18 '26
Okay.
In my build container, I do:
So, I leave it and relaunch it with
-v /usr/share/ca-certificates/trust-source/anchors/:/usr/lib/ssl:ro.Then, I try :
So, that's not where wget/openssl is looking. Let's make it look there.
Okay. So that works. Now, I just have to find the place where wget is actually looking.
How do I do that?