2024-01-06 01:57:28 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# -*- mode: sh; fill-column: 75; tab-width: 8; coding: utf-8-unix -*-
|
|
|
|
|
|
|
|
# Dual Linux or msys64
|
|
|
|
|
|
|
|
prog=$( basename $0 .bash )
|
|
|
|
ROLE=proxy
|
|
|
|
|
|
|
|
PREFIX=/usr/local
|
|
|
|
[ -n "$MSYSTEM" ] && EXET=msys || EXET=sh
|
|
|
|
|
|
|
|
[ -f $PREFIX/etc/testforge/testforge.bash ] \
|
|
|
|
&& . /usr/local/etc/testforge/testforge.bash
|
|
|
|
|
|
|
|
# Dual Linux or msys64
|
|
|
|
|
|
|
|
PROXIES=""
|
|
|
|
if [ -d /etc/pacman.d/gnupg ] ; then
|
|
|
|
ROLE=msys64
|
|
|
|
HOMEDIR=/etc/pacman.d/gnupg
|
|
|
|
# proxy or striaght through
|
|
|
|
PROXIES="10.152.152.12"
|
|
|
|
elif [ -d /q/Pg64/Msys64/etc/pacman.d/gnupg ] ; then
|
|
|
|
ROLE=q
|
|
|
|
HOMEDIR=/q/Pg64/Msys64/etc/pacman.d/gnupg
|
|
|
|
ppl=/usr/local/bin/proxy_ping_lib.bash
|
|
|
|
# /sbin/ifconfig on Debian morons and /bin/ifconfig on Gentoo
|
|
|
|
[ "$USER" != root ] && export PATH=/sbin:$PATH
|
|
|
|
[ -z "$MODE" ] && MODE=$( $ppl proxy_ping_mode )
|
|
|
|
if [ "$MODE" = tor ] ; then
|
|
|
|
PROXIES="127.0.0.1:3128"
|
|
|
|
elif [ "$MODE" = whonix ] ; then
|
|
|
|
PROXIES="10.0.2.15:9128"
|
|
|
|
elif [ "$MODE" = gateway ] ; then
|
|
|
|
PROXIES="10.0.2.15:9128"
|
|
|
|
elif ps ax | grep -q polipo ; then
|
|
|
|
PROXIES="127.0.0.1:3128"
|
|
|
|
else
|
|
|
|
echo ERROR: unknown proxy
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
2024-01-09 15:35:38 +00:00
|
|
|
if [ ! -f /etc/dirmngr/dirmngr.conf ] || \
|
|
|
|
grep ^keyserver /etc/dirmngr/dirmngr.conf ; then
|
|
|
|
echo ERROR: no ^keyserver in /etc/dirmngr/dirmngr.conf
|
|
|
|
exit 1
|
|
|
|
fi
|
2024-01-06 01:57:28 +00:00
|
|
|
|
2024-01-09 15:35:38 +00:00
|
|
|
GPG="gpg --verbose --home $HOMEDIR"
|
2024-01-06 01:57:28 +00:00
|
|
|
$GPG --refresh-keys --verbose
|
|
|
|
|
|
|
|
ps ax | grep /usr/bin/dirmngr.bin|grep -v grep|sed -e 's/ .*//'|xargs kill
|
|
|
|
|
2024-01-09 15:35:38 +00:00
|
|
|
grep '^keyserver hkp' /etc/dirmngr/dirmngr.conf | \
|
2024-01-06 01:57:28 +00:00
|
|
|
sed -e 's@keyserver hkp://@@' | \
|
2024-01-09 15:35:38 +00:00
|
|
|
while read elt ; do
|
2024-01-06 01:57:28 +00:00
|
|
|
for proxy in $PROXIES; do
|
|
|
|
echo 1 | http_proxy=$proxy $GPG --yes \
|
|
|
|
--debug-level guru \
|
|
|
|
--keyserver hkp://$elt \
|
|
|
|
--search-keys abcdefghij || exit 3$?
|
|
|
|
echo INFO: $proxy $elt
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
2024-01-09 15:35:38 +00:00
|
|
|
/usr/local/bin/proxy_ping_test.bash dirmngr
|