Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 4983  / 3 Years ago, tue, august 17, 2021, 3:50:36

I am using tsocks to socksify my connections. When I run the following commands, apt-get isn't socksified:



$ . tsocks -on
$ sudo apt-get update


However, when I run the whole thing in one line like the following, it works.



sudo tsocks apt-get update


I have verified that when I type . tsocks -on, my LD_PRELOAD environment variable is set to /usr/lib/libtsocks.so.



Why doesn't the former work?


More From » apt

 Answers
4

Per the answer given by @creveti-mihai, I looked at the sudoers man page. Unfortunately, as the man page says, it is not possible to preserve LD_* variables. Here is what the man page says:




 Note that the dynamic linker on most operating systems will remove
variables that can control dynamic linking from the environment of setuid
executables, including sudo. Depending on the operating system this may
include _RLD*, DYLD_*, LD_*, LDR_*, LIBPATH, SHLIB_PATH, and others.
These type of variables are removed from the environment before sudo even
begins execution and, as such, it is not possible for sudo to preserve
them.



So, I'll have to look at specifying the proxy in apt's own configuration files using Acquire::http::proxy and Acquire::https::proxy.


[#22479] Tuesday, August 17, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ularousand

Total Points: 380
Total Questions: 109
Total Answers: 101

Location: England
Member since Tue, Sep 8, 2020
4 Years ago
;