TRK has quite a few ways you can customise it or have custom scripts be run. These scripts can run automatically because I ‘ve built in numerous placeholders for them which I call “triggers”
If you are a regular user of Trinity Rescue Kit, you might find it useful to have some default parameters set according to your environment i.e. lan
Ever since TRK 3.1, there ‘s a feature that makes your lan “TRK-aware” since a system administrator can configure his lan in a way any TRK3 can take advantage of it in terms of proxy configurations and user optional script executing, a much wanted feature from the past, but hard to implement since you ‘re working with read-only media.
Finally, the solution is kind of revolutionary: by activating an otherwise unused parameter in you DHCP server, you can have a TRK point to a server where it can find its config and scripts.
This option is from an obsolete RFC from 1983 called ‘Resource location server’, which was a UDP protocol that could tell you where to find things like routes and smtp servers. I ‘m using it now to provide TRK with an IP-address where it can find a simple webserver on which resides /trk/trk3options.conf
If you ‘re running ISC dhcpd, add this line to /etc/dhcpd.conf:
option resource-location-servers your-trk-webserver-ip-address;
On a Windows server, go to Administrative tools=>DHCP => go to your scope => scope options => option 11 Resource Location Servers.
I wouldn ‘t worry too much about enabling this option to break something in your network. I ‘ve been running this for some time now at my office where there are about 100 Windows PCs on dhcp. Nobody hasn ‘t complained so far.
Anyway, when a TRK 3.2 boots and finds a ‘resource location server‘ from DHCP, it will indeed look for resources from this configuration file.
Below is an example of such config file, it more or less speaks for itself.
The file is /var/www/html/trk/trk3options.conf on my local webserver
TRKSECTION WGET BEGIN
timeout = 10
tries = 2
TRKSECTION WGET END
TRKSECTION LINKS BEGIN
TRKSECTION LINKS END
TRKSECTION CHECKUPDATESARGS BEGIN
TRKSECTION CHECKUPDATESARGS END
TRKSECTION TRKSCRIPT BEGIN
if [ -f /etc/proxy.conf ]; then
echo “Setting proxy params in freshclam.conf”
if [ ! -f /etc/freshclam.conf.bak ]; then
cp -f /etc/freshclam.conf /etc/freshclam.conf.bak
if ! [ “rjohndoe” = “r” ]; then
sed “s/# Proxy settings/nHTTPProxyServer 10.34.5.201nHTTPProxyPort 8080nHTTPProxyUsername johndoenHTTPProxyPassword doesinc/” /etc/freshclam.conf > /etc/fresclam.conf~
sed “s/# Proxy settings/nHTTPProxyServer 10.34.5.201nHTTPProxyPort 8080/” /etc/freshclam.conf > /etc/fresclam.conf~
mv -f /etc/fresclam.conf~ /etc/freshclam.conf
chmod 700 /etc/freshclam.conf
if [ -f /etc/avg.conf ]; then
echo “Setting proxy params in avg.conf”
if [ -f /etc/avg.conf.bak ]; then
# Take a backup of the original avg.conf if necessary
cp -f /etc/avg.conf /etc/avg.conf.bak
sed -e s’/proxy = off/proxy = 10.34.5.201:8080/’ /etc/avg.conf > /etc/avg.conf~
mv -f /etc/avg.conf~ /etc/avg.conf
chmod 700 /etc/avg.conf
sed -e s’/proxyLogin = off/proxyLogin = johndoe:doesinc/’ /etc/avg.conf > /etc/avg.conf~
mv -f /etc/avg.conf~ /etc/avg.conf
if [ -f /opt/BitDefender-scanner/etc/bdscan.conf ]; then
echo “Setting proxy params in bdscan.conf”
if [ ! -f /opt/BitDefender-scanner/etc/bdscan.conf.bak ]; then
cp -f /opt/BitDefender-scanner/etc/bdscan.conf /opt/BitDefender-scanner/etc/bdscan.conf.bak 2>/dev/null
sed “s/#HttpProxy =/nHttpProxy = johndoe:firstname.lastname@example.org:8080/” /opt/BitDefender-scanner/etc/bdscan.conf > /opt/BitDefender-scanner/etc/bdscan.conf~
mv /opt/BitDefender-scanner/etc/bdscan.conf~ /opt/BitDefender-scanner/etc/bdscan.conf
TRKSECTION TRKSCRIPT END
-TRKSCRIPT is a section where you can do basically anything you want, so be very carefull with what you put in here because it will have an effect on any machine you boot with TRK3 . It will basically execute as a script in the same environment from the last script run by TRK, /etc/init.d/trklocal
What I put in the example here is to download an adapted version of the ClamAV config file ‘freshclam.conf’. Refer to the ClamAV manpages for help on this file, but in here I ‘ve put my proxy parameters too.
I don ‘t need to tell you what other opportunities this opens up.
If you think this file is too complicated for you to create, don ‘t worry: just start a TRK, run ‘setproxy’ and this will generate the file /etc/trk3options.conf
Copy this file to your webserver and you ‘re all set.
If you run setproxy afterwards, you will override alls settings given by your trk3optionsserver.