new package: hash-slinger

This commit is contained in:
Tee KOBAYASHI 2022-04-08 18:32:34 +09:00 committed by xtkoba
parent d3cdc0f713
commit 6b2259e24c
3 changed files with 107 additions and 0 deletions

View File

@ -0,0 +1,34 @@
TERMUX_PKG_HOMEPAGE=https://github.com/letoams/hash-slinger
TERMUX_PKG_DESCRIPTION="Various tools to generate special DNS records"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=3.1
TERMUX_PKG_SRCURL=https://github.com/letoams/hash-slinger/archive/refs/tags/${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=2f0de62d561e585747732e44ce9ea5fcef93c75c95d66b684bd13b4e70374df6
TERMUX_PKG_DEPENDS="ca-certificates, gnupg, openssh, python, swig, unbound"
TERMUX_PKG_PLATFORM_INDEPENDENT=true
TERMUX_PKG_BUILD_IN_SRC=true
termux_step_pre_configure() {
_PKG_PYTHON_DEPENDS="dnspython ipaddr m2crypto python-gnupg"
}
termux_step_make() {
:
}
termux_step_make_install() {
local f
for f in openpgpkey sshfp tlsa; do
install -Dm700 -t $TERMUX_PREFIX/bin ${f}
install -Dm600 -t $TERMUX_PREFIX/share/man/man1 ${f}.1
done
}
termux_step_create_debscripts() {
cat <<- EOF > ./postinst
#!$TERMUX_PREFIX/bin/sh
echo "Installing dependencies through pip..."
pip3 install ${_PKG_PYTHON_DEPENDS}
EOF
}

View File

@ -0,0 +1,31 @@
--- a/openpgpkey
+++ b/openpgpkey
@@ -94,8 +94,8 @@
parser.add_argument('--version', action='version', version='openpgpkey version: %s'%VERSION, help='show version and exit')
parser.add_argument('--insecure', action='store_true', default=False, help='Allow use of non-dnssec secured answers')
- parser.add_argument('--resolvconf', action='store', default='', help='Use a recursive resolver listed in a resolv.conf file (default: /etc/resolv.conf)')
- parser.add_argument('--rootanchor', action='store', default='', help='Location of the unbound compatible DNSSEC root.anchor (default: /var/lib/unbound/root.anchor)')
+ parser.add_argument('--resolvconf', action='store', default='', help='Use a recursive resolver listed in a resolv.conf file (default: @TERMUX_PREFIX@/etc/resolv.conf)')
+ parser.add_argument('--rootanchor', action='store', default='', help='Location of the unbound compatible DNSSEC root.anchor (default: @TERMUX_PREFIX@/var/lib/unbound/root.anchor)')
parser.add_argument('email', metavar="email")
parser.add_argument('--uid', action='store', default='', help='override the uid (email address) within the key')
@@ -116,7 +116,7 @@
# unbound setup, only for verify
global ctx
ctx = unbound.ub_ctx()
- resolvconf = "/etc/resolv.conf"
+ resolvconf = "@TERMUX_PREFIX@/etc/resolv.conf"
rootanchor = None
if args.rootanchor:
if os.path.isfile(args.rootanchor):
@@ -125,7 +125,7 @@
print('openpgpkey: %s is not a file. Unable to use it as rootanchor' % args.rootanchor, file=sys.stdout)
sys.exit(1)
else:
- cauldron = ( "/var/lib/unbound/root.anchor", "/var/lib/unbound/root.key", "/etc/unbound/root.key" )
+ cauldron = ( "@TERMUX_PREFIX@/var/lib/unbound/root.anchor", "@TERMUX_PREFIX@/var/lib/unbound/root.key", "@TERMUX_PREFIX@/etc/unbound/root.key" )
for root in cauldron:
if os.path.isfile(root):
rootanchor=root

View File

@ -0,0 +1,42 @@
--- a/tlsa
+++ b/tlsa
@@ -37,7 +37,7 @@
from ipaddress import IPv4Address, IPv6Address
ROOTKEY="none"
-cauldron = ( "/var/lib/unbound/root.anchor", "/var/lib/unbound/root.key", "/etc/unbound/root.key" )
+cauldron = ( "@TERMUX_PREFIX@/var/lib/unbound/root.anchor", "@TERMUX_PREFIX@/var/lib/unbound/root.key", "@TERMUX_PREFIX@/etc/unbound/root.key" )
for root in cauldron:
if os.path.isfile(root):
ROOTKEY=root
@@ -188,7 +188,7 @@
except:
unbound.ub_ctx_trustedkeys(ctx,ROOTKEY)
# Use the local cache and emulate /etc/hosts
- ctx.hosts("/etc/hosts")
+ ctx.hosts("@TERMUX_PREFIX@/etc/hosts")
if resolvconf and not noresolver:
ctx.resolvconf(resolvconf)
@@ -627,7 +627,7 @@
parser.add_argument('-4', '--ipv4', dest='ipv4', action='store_true',help='use ipv4 networking only')
parser.add_argument('-6', '--ipv6', dest='ipv6', action='store_true',help='use ipv6 networking only')
parser.add_argument('--insecure', action='store_true', default=False, help='Allow use of non-dnssec secured answers')
- parser.add_argument('--resolvconf', metavar='/PATH/TO/RESOLV.CONF', action='store', default='/etc/resolv.conf', help='Use a recursive resolver listed in a resolv.conf file (default: /etc/resolv.conf)')
+ parser.add_argument('--resolvconf', metavar='/PATH/TO/RESOLV.CONF', action='store', default='@TERMUX_PREFIX@/etc/resolv.conf', help='Use a recursive resolver listed in a resolv.conf file (default: @TERMUX_PREFIX@/etc/resolv.conf)')
parser.add_argument('host', metavar="hostname")
parser.add_argument('--port', '-p', action='store', default='443', help='The port, or \'*\' where running TLS is located (default: %(default)s).')
@@ -636,10 +636,8 @@
parser.add_argument('--only-rr', action='store_true', help='Only verify that the TLSA resource record is correct (do not check certificate)')
parser.add_argument('--rootkey', metavar='/PATH/TO/ROOT.KEY', action='store', help='Specify file location containing the DNSSEC root key')
- if os.path.isdir("/etc/pki/tls/certs/"):
- cadir = "/etc/pki/tls/certs/"
- elif os.path.isdir("/etc/ssl/certs/"):
- cadir = "/etc/ssl/certs/"
+ if os.path.isdir("@TERMUX_PREFIX@/etc/tls/certs/"):
+ cadir = "@TERMUX_PREFIX@/etc/tls/certs/"
else:
cadir = "."
print ("warning: no system wide CAdir found, using current directory")