-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added openvpn-update-systemd-resolved v1.3.0
- Loading branch information
Showing
4 changed files
with
84 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#Maintainer: max-k <max-k AT post DOT com> | ||
pkgname=openvpn-update-systemd-resolved | ||
pkgver=1.3.0 | ||
pkgrel=4 | ||
pkgdesc="OpenVPN systemd-resolved Updater" | ||
arch=("any") | ||
url="https://github.com/jonathanio/update-systemd-resolved" | ||
license=("GPL") | ||
depends=("openvpn" "bash" "iproute2" "systemd>229") | ||
source=("https://github.com/jonathanio/update-systemd-resolved/archive/v${pkgver}.tar.gz" | ||
'openvpn-update-systemd-resolved.install' | ||
'openvpn-update-systemd-resolved.rules') | ||
install=$pkgname.install | ||
sha256sums=('ee88c1862cb7d197adfcb0e088530993e092f7035fdd95693827d6526f2817af' | ||
'2a84e0d96fab9735454007053df4946aa7890cd63981087944d5b4d8906fdd07' | ||
'b8a4d95c950a0efd12a3270a5f14077710adeff1a82cad74df8bd254a00c1169') | ||
|
||
package() { | ||
install -d -m750 "${pkgdir}/usr/share/polkit-1/rules.d" | ||
install -D -m644 openvpn-update-systemd-resolved.rules "${pkgdir}/usr/share/polkit-1/rules.d/00-openvpn-systemd-resolved.rules" | ||
|
||
cd "${srcdir}/update-systemd-resolved-${pkgver}" | ||
install -D -m755 update-systemd-resolved "${pkgdir}/usr/bin/update-systemd-resolved" | ||
install -D -m644 update-systemd-resolved.conf "${pkgdir}/usr/share/doc/openvpn/update-systemd-resolved.conf" | ||
} | ||
|
||
# vim:set ts=2 sw=2 et: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
make_srcinfo () { | ||
makepkg --printsrcinfo > .SRCINFO | ||
} | ||
|
||
build () { | ||
updpkgsums && makepkg -s "${@}" | ||
} | ||
|
||
clean () { | ||
rm -rf *.pkg.tar.xz *.tar.gz ; rm -rf ./pkg ./src ; true | ||
} | ||
|
||
main () { | ||
clean && build "${@}" && make_srcinfo | ||
} | ||
|
||
main "$@" |
26 changes: 26 additions & 0 deletions
26
packages/openvpn-update-systemd-resolved/openvpn-update-systemd-resolved.install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
post_install() { | ||
echo | ||
echo "To complete the installation, please add this script to your OpenVPN" | ||
echo "settings for each of the VPNs you wish it to manage the DNS for:" | ||
echo " script-security 2" | ||
echo " up /usr/bin/update-systemd-resolved" | ||
echo " up-restart" | ||
echo " down /usr/bin/update-systemd-resolved" | ||
echo " down-pre" | ||
echo | ||
} | ||
|
||
post_upgrade() { | ||
post_install | ||
echo | ||
echo "The path to the script has changed. Please ensure you update all your" | ||
echo "configuration files to match this:" | ||
echo " up /usr/bin/update-systemd-resolved" | ||
echo " down /usr/bin/update-systemd-resolved" | ||
echo | ||
echo "If you are using persist-tun and ping-restart, you should add up-restart" | ||
echo "to your configuration so that update-systemd-resolved is called when" | ||
echo "there is a partial restart of the connection. Otherwise, or your DNS" | ||
echo "configuration may not be restored." | ||
echo | ||
} |
12 changes: 12 additions & 0 deletions
12
packages/openvpn-update-systemd-resolved/openvpn-update-systemd-resolved.rules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Allow the OpenVPN user to manage DNS via systemd-resolved | ||
// as part of the openvpn-update-systemd-resolved package | ||
polkit.addRule(function(action, subject) { | ||
if (action.id == 'org.freedesktop.resolve1.set-dns-servers' || | ||
action.id == 'org.freedesktop.resolve1.set-domains' || | ||
// action.id == 'org.freedesktop.resolve1.set-default-route' || | ||
action.id == 'org.freedesktop.resolve1.set-dnssec') { | ||
if (subject.user == 'openvpn') { | ||
return polkit.Result.YES; | ||
} | ||
} | ||
}); |