summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Chimento2022-02-18 00:00:19 +0200
committerDouglas Chimento2022-02-18 00:00:19 +0200
commit81692f91d003701bcccdfd2f2fb1d163e2fc16fa (patch)
treeb8feaa5c13d2e6e299961f48ce0b2f2af046573c
downloadaur-81692f91d003701bcccdfd2f2fb1d163e2fc16fa.tar.gz
init 0.2.8
-rw-r--r--.SRCINFO34
-rw-r--r--.gitignore2
-rw-r--r--PKGBUILD33
-rw-r--r--charge-lnd-01-chown.hook12
-rw-r--r--charge-lnd.env5
-rw-r--r--charge-lnd.service40
-rw-r--r--charge-lnd.timer7
-rw-r--r--charge-lnd.user1
-rw-r--r--charge-lnd@.service41
9 files changed, 175 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..df8ccef79e2a
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,34 @@
+pkgbase = charge-lnd
+ pkgdesc = charge-lnd is a simple policy based fee manager for LND
+ pkgver = 0.2.8
+ pkgrel = 1
+ url = https://github.com/accumulator/charge-lnd
+ arch = any
+ license = GPL2
+ makedepends = python-pip
+ depends = python
+ depends = python-setuptools
+ depends = python-googleapis-common-protos
+ depends = python-grpcio
+ depends = python-protobuf
+ depends = python-six
+ depends = python-termcolor
+ depends = python-colorama
+ depends = python-aiorpcx
+ optdepends = lnd-bin
+ source = https://github.com/accumulator/charge-lnd/archive/refs/tags/v0.2.8.tar.gz
+ source = charge-lnd.service
+ source = charge-lnd@.service
+ source = charge-lnd.timer
+ source = charge-lnd.user
+ source = charge-lnd-01-chown.hook
+ source = charge-lnd.env
+ sha256sums = 8f6fff0a1ae9b5a20855cdb2dc2aeef3f1f3cb692b6a02684305e02ea3b1cd50
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+ sha256sums = SKIP
+
+pkgname = charge-lnd
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..71cd55ea32ca
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+*.zst
+*.gz
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..47afa3283a35
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,33 @@
+# Maintainer: Douglas Chimento <dchimento@gmail.com>
+pkgname=charge-lnd
+pkgver=0.2.8
+pkgrel=1
+pkgdesc="${pkgname} is a simple policy based fee manager for LND"
+url='https://github.com/accumulator/charge-lnd'
+depends=('python' 'python-setuptools' 'python-googleapis-common-protos' 'python-grpcio' 'python-protobuf' 'python-six' 'python-termcolor' 'python-colorama' 'python-aiorpcx')
+optdepends=('lnd-bin')
+makedepends=('python-pip')
+checkdepends=()
+license=('GPL2')
+arch=('any')
+source=("https://github.com/accumulator/charge-lnd/archive/refs/tags/v${pkgver}.tar.gz" "${pkgname}.service" "${pkgname}@.service" "${pkgname}.timer" "${pkgname}.user" "${pkgname}-01-chown.hook" "${pkgname}.env")
+sha256sums=('8f6fff0a1ae9b5a20855cdb2dc2aeef3f1f3cb692b6a02684305e02ea3b1cd50' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP')
+
+build() {
+ cd "$pkgname-$pkgver"
+ python setup.py build
+}
+
+package() {
+ cd "$pkgname-$pkgver"
+ python setup.py install --root="$pkgdir" --optimize=1
+ install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
+
+ install -Dm 644 "$srcdir/${pkgname}.env" "$pkgdir/etc/default/${pkgname}"
+ install -Dm 644 examples/* -t "$pkgdir/etc/charge-lnd"
+
+ install -Dm 644 "$srcdir/${pkgname}.user" "$pkgdir/usr/lib/sysusers.d/${pkgname}.conf"
+ msg2 'Installing pacman hooks...'
+ install -Dm 644 "$srcdir"/*.hook -t "$pkgdir/usr/share/libalpm/hooks"
+ install -Dm 644 "$srcdir"/*.service -t "$pkgdir/usr/lib/systemd/system"
+}
diff --git a/charge-lnd-01-chown.hook b/charge-lnd-01-chown.hook
new file mode 100644
index 000000000000..a2a38770e093
--- /dev/null
+++ b/charge-lnd-01-chown.hook
@@ -0,0 +1,12 @@
+[Trigger]
+Operation = Install
+Operation = Upgrade
+Type = Package
+Target = charge-lnd
+
+[Action]
+Description = Setting daemon user directory permissions...
+Depends = coreutils
+When = PostTransaction
+Exec = /usr/bin/chown -R charge-lnd:charge-lnd /etc/charge-lnd
+
diff --git a/charge-lnd.env b/charge-lnd.env
new file mode 100644
index 000000000000..c7970555ce00
--- /dev/null
+++ b/charge-lnd.env
@@ -0,0 +1,5 @@
+FLAGS=""
+# FLAGS="--verbose --check --dry-run"
+CONFIG=/etc/charge-lnd/all-channels-static.config
+LNDDIR=/var/lib/lnd
+GRPC=localhost:10009
diff --git a/charge-lnd.service b/charge-lnd.service
new file mode 100644
index 000000000000..3d319bd0d38d
--- /dev/null
+++ b/charge-lnd.service
@@ -0,0 +1,40 @@
+[Unit]
+Description=Manage fees on lnd channels
+Documentation=https://github.com/accumulator/charge-lnd/blob/master/README.md
+
+[Service]
+Type=oneshot
+EnvironmentFile=/etc/default/charge-lnd
+ExecStart=/usr/bin/charge-lnd \
+ --lnddir $LNDDIR \
+ --grpc $GRPC \
+ --config $CONFIG
+ $FLAGS
+
+User=charge-lnd
+Group=charge-lnd
+
+# https://www.freedesktop.org/software/systemd/man/systemd.exec.html#Sandboxing
+CapabilityBoundingSet=
+LockPersonality=true
+MemoryDenyWriteExecute=true
+NoNewPrivileges=true
+PrivateDevices=true
+PrivateTmp=true
+PrivateUsers=true
+ProtectClock=true
+ProtectControlGroups=true
+ProtectHome=true
+ProtectHostname=true
+ProtectKernelLogs=true
+ProtectKernelModules=true
+ProtectKernelTunables=true
+ProtectSystem=strict
+RemoveIPC=true
+RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
+RestrictNamespaces=true
+RestrictRealtime=true
+RestrictSUIDSGID=true
+SystemCallArchitectures=native
+SystemCallFilter=@system-service
+SystemCallFilter=~add_key clone3 get_mempolicy kcmp keyctl mbind move_pages name_to_handle_at personality process_vm_readv process_vm_writev request_key set_mempolicy setns unshare userfaultfd
diff --git a/charge-lnd.timer b/charge-lnd.timer
new file mode 100644
index 000000000000..dadbed54ded7
--- /dev/null
+++ b/charge-lnd.timer
@@ -0,0 +1,7 @@
+[Unit]
+Documentation=https://github.com/accumulator/charge-lnd/blob/master/README.md
+
+[Timer]
+# https://www.freedesktop.org/software/systemd/man/systemd.time.html#Calendar%20Events
+OnCalendar=*-*-* 04:00:00
+RandomizedDelaySec=1h
diff --git a/charge-lnd.user b/charge-lnd.user
new file mode 100644
index 000000000000..dc6acb1f8aa3
--- /dev/null
+++ b/charge-lnd.user
@@ -0,0 +1 @@
+u charge-lnd - "charge-lnd daemon user" /etc/charge-lnd -
diff --git a/charge-lnd@.service b/charge-lnd@.service
new file mode 100644
index 000000000000..d78abb471550
--- /dev/null
+++ b/charge-lnd@.service
@@ -0,0 +1,41 @@
+[Unit]
+Description=Manage fees on lnd channels with %i
+Documentation=https://github.com/accumulator/charge-lnd/blob/master/README.md
+ConditionPathExists=/etc/default/charge-lnd-%i
+
+[Service]
+Type=oneshot
+EnvironmentFile=/etc/default/charge-lnd-%i
+ExecStart=/usr/bin/charge-lnd \
+ --lnddir $LNDDIR \
+ --grpc $GRPC \
+ --config $CONFIG \
+ $FLAGS
+
+User=charge-lnd
+Group=charge-lnd
+
+# https://www.freedesktop.org/software/systemd/man/systemd.exec.html#Sandboxing
+CapabilityBoundingSet=
+LockPersonality=true
+MemoryDenyWriteExecute=true
+NoNewPrivileges=true
+PrivateDevices=true
+PrivateTmp=true
+PrivateUsers=true
+ProtectClock=true
+ProtectControlGroups=true
+ProtectHome=true
+ProtectHostname=true
+ProtectKernelLogs=true
+ProtectKernelModules=true
+ProtectKernelTunables=true
+ProtectSystem=strict
+RemoveIPC=true
+RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
+RestrictNamespaces=true
+RestrictRealtime=true
+RestrictSUIDSGID=true
+SystemCallArchitectures=native
+SystemCallFilter=@system-service
+SystemCallFilter=~add_key clone3 get_mempolicy kcmp keyctl mbind move_pages name_to_handle_at personality process_vm_readv process_vm_writev request_key set_mempolicy setns unshare userfaultfd