diff options
author | William Hubbs <williamh@gentoo.org> | 2022-04-28 11:21:38 -0500 |
---|---|---|
committer | Yixun Lan <dlan@gentoo.org> | 2022-05-02 07:04:19 +0800 |
commit | b80f01fb2f6b22b9f06e57b9ae0531ba65f0d38f (patch) | |
tree | 09af64c4a713b570c76c6a7d815ffa601f9f0402 /net-vpn/headscale | |
parent | dev-ml/camlp5: Keyword 8.00.03 x86, #841446 (diff) | |
download | gentoo-b80f01fb2f6b22b9f06e57b9ae0531ba65f0d38f.tar.gz gentoo-b80f01fb2f6b22b9f06e57b9ae0531ba65f0d38f.tar.bz2 gentoo-b80f01fb2f6b22b9f06e57b9ae0531ba65f0d38f.zip |
net-vpn/headscale: 0.15.0-r1 bump
- install documentation
- patch example config so we know if upstream changes the config file
- install example config in the documentation directory
- name the service the same as the binary
Closes: https://bugs.gentoo.org/842018
Author-by: William Hubbs <williamh@gentoo.org>
Signed-off-by: Yixun Lan <dlan@gentoo.org>
Diffstat (limited to 'net-vpn/headscale')
-rw-r--r-- | net-vpn/headscale/files/config-socket.patch | 13 | ||||
-rw-r--r-- | net-vpn/headscale/files/config.yaml.example | 221 | ||||
-rw-r--r-- | net-vpn/headscale/files/headscale.confd (renamed from net-vpn/headscale/files/headscale.conf) | 0 | ||||
-rw-r--r-- | net-vpn/headscale/files/headscale.initd (renamed from net-vpn/headscale/files/headscaled.initd) | 2 | ||||
-rw-r--r-- | net-vpn/headscale/files/headscale.service (renamed from net-vpn/headscale/files/headscaled.service) | 0 | ||||
-rw-r--r-- | net-vpn/headscale/headscale-0.15.0-r1.ebuild | 49 | ||||
-rw-r--r-- | net-vpn/headscale/headscale-0.15.0.ebuild | 49 |
7 files changed, 63 insertions, 271 deletions
diff --git a/net-vpn/headscale/files/config-socket.patch b/net-vpn/headscale/files/config-socket.patch new file mode 100644 index 000000000000..4d6c90e3f0f5 --- /dev/null +++ b/net-vpn/headscale/files/config-socket.patch @@ -0,0 +1,13 @@ +diff --git a/config-example.yaml b/config-example.yaml +index dee25cb..007d8ec 100644 +--- a/config-example.yaml ++++ b/config-example.yaml +@@ -202,7 +202,7 @@ dns_config: + # Unix socket used for the CLI to connect without authentication + # Note: for local development, you probably want to change this to: + # unix_socket: ./headscale.sock +-unix_socket: /var/run/headscale.sock ++unix_socket: /run/headscale.sock + unix_socket_permission: "0770" + # + # headscale supports experimental OpenID connect support, diff --git a/net-vpn/headscale/files/config.yaml.example b/net-vpn/headscale/files/config.yaml.example deleted file mode 100644 index 603b941dac9d..000000000000 --- a/net-vpn/headscale/files/config.yaml.example +++ /dev/null @@ -1,221 +0,0 @@ ---- -# headscale will look for a configuration file named `config.yaml` (or `config.json`) in the following order: -# -# - `/etc/headscale` -# - `~/.headscale` -# - current working directory - -# The url clients will connect to. -# Typically this will be a domain like: -# -# https://myheadscale.example.com:443 -# -server_url: http://127.0.0.1:8080 - -# Address to listen to / bind to on the server -# -listen_addr: 0.0.0.0:8080 - -# Address to listen to /metrics, you may want -# to keep this endpoint private to your internal -# network -# -metrics_listen_addr: 127.0.0.1:9090 - -# Address to listen for gRPC. -# gRPC is used for controlling a headscale server -# remotely with the CLI -# Note: Remote access _only_ works if you have -# valid certificates. -grpc_listen_addr: 0.0.0.0:50443 - -# Allow the gRPC admin interface to run in INSECURE -# mode. This is not recommended as the traffic will -# be unencrypted. Only enable if you know what you -# are doing. -grpc_allow_insecure: false - -# Private key used encrypt the traffic between headscale -# and Tailscale clients. -# The private key file which will be -# autogenerated if it's missing -private_key_path: /var/lib/headscale/private.key - -# List of IP prefixes to allocate tailaddresses from. -# Each prefix consists of either an IPv4 or IPv6 address, -# and the associated prefix length, delimited by a slash. -ip_prefixes: - - fd7a:115c:a1e0::/48 - - 100.64.0.0/10 - -# DERP is a relay system that Tailscale uses when a direct -# connection cannot be established. -# https://tailscale.com/blog/how-tailscale-works/#encrypted-tcp-relays-derp -# -# headscale needs a list of DERP servers that can be presented -# to the clients. -derp: - server: - # If enabled, runs the embedded DERP server and merges it into the rest of the DERP config - # The Headscale server_url defined above MUST be using https, DERP requires TLS to be in place - enabled: false - - # Region ID to use for the embedded DERP server. - # The local DERP prevails if the region ID collides with other region ID coming from - # the regular DERP config. - region_id: 999 - - # Region code and name are displayed in the Tailscale UI to identify a DERP region - region_code: "headscale" - region_name: "Headscale Embedded DERP" - - # Listens in UDP at the configured address for STUN connections to help on NAT traversal. - # When the embedded DERP server is enabled stun_listen_addr MUST be defined. - # - # For more details on how this works, check this great article: https://tailscale.com/blog/how-tailscale-works/ - stun_listen_addr: "0.0.0.0:3478" - - # List of externally available DERP maps encoded in JSON - urls: - - https://controlplane.tailscale.com/derpmap/default - - # Locally available DERP map files encoded in YAML - # - # This option is mostly interesting for people hosting - # their own DERP servers: - # https://tailscale.com/kb/1118/custom-derp-servers/ - # - # paths: - # - /etc/headscale/derp-example.yaml - paths: [] - - # If enabled, a worker will be set up to periodically - # refresh the given sources and update the derpmap - # will be set up. - auto_update_enabled: true - - # How often should we check for DERP updates? - update_frequency: 24h - -# Disables the automatic check for headscale updates on startup -disable_check_updates: false - -# Time before an inactive ephemeral node is deleted? -ephemeral_node_inactivity_timeout: 30m - -# SQLite config -db_type: sqlite3 -db_path: /var/lib/headscale/db.sqlite - -# # Postgres config -# db_type: postgres -# db_host: localhost -# db_port: 5432 -# db_name: headscale -# db_user: foo -# db_pass: bar - -### TLS configuration -# -## Let's encrypt / ACME -# -# headscale supports automatically requesting and setting up -# TLS for a domain with Let's Encrypt. -# -# URL to ACME directory -acme_url: https://acme-v02.api.letsencrypt.org/directory - -# Email to register with ACME provider -acme_email: "" - -# Domain name to request a TLS certificate for: -tls_letsencrypt_hostname: "" - -# Client (Tailscale/Browser) authentication mode (mTLS) -# Acceptable values: -# - disabled: client authentication disabled -# - relaxed: client certificate is required but not verified -# - enforced: client certificate is required and verified -tls_client_auth_mode: relaxed - -# Path to store certificates and metadata needed by -# letsencrypt -tls_letsencrypt_cache_dir: /var/lib/headscale/cache - -# Type of ACME challenge to use, currently supported types: -# HTTP-01 or TLS-ALPN-01 -# See [docs/tls.md](docs/tls.md) for more information -tls_letsencrypt_challenge_type: HTTP-01 -# When HTTP-01 challenge is chosen, letsencrypt must set up a -# verification endpoint, and it will be listning on: -# :http = port 80 -tls_letsencrypt_listen: ":http" - -## Use already defined certificates: -tls_cert_path: "" -tls_key_path: "" - -log_level: info - -# Path to a file containg ACL policies. -# ACLs can be defined as YAML or HUJSON. -# https://tailscale.com/kb/1018/acls/ -acl_policy_path: "" - -## DNS -# -# headscale supports Tailscale's DNS configuration and MagicDNS. -# Please have a look to their KB to better understand the concepts: -# -# - https://tailscale.com/kb/1054/dns/ -# - https://tailscale.com/kb/1081/magicdns/ -# - https://tailscale.com/blog/2021-09-private-dns-with-magicdns/ -# -dns_config: - # List of DNS servers to expose to clients. - nameservers: - - 1.1.1.1 - - # Split DNS (see https://tailscale.com/kb/1054/dns/), - # list of search domains and the DNS to query for each one. - # - # restricted_nameservers: - # foo.bar.com: - # - 1.1.1.1 - # darp.headscale.net: - # - 1.1.1.1 - # - 8.8.8.8 - - # Search domains to inject. - domains: [] - - # Whether to use [MagicDNS](https://tailscale.com/kb/1081/magicdns/). - # Only works if there is at least a nameserver defined. - magic_dns: true - - # Defines the base domain to create the hostnames for MagicDNS. - # `base_domain` must be a FQDNs, without the trailing dot. - # The FQDN of the hosts will be - # `hostname.namespace.base_domain` (e.g., _myhost.mynamespace.example.com_). - base_domain: example.com - -# Unix socket used for the CLI to connect without authentication -# Note: for local development, you probably want to change this to: -unix_socket: /run/headscale/headscale.sock -unix_socket_permission: "0770" -# -# headscale supports experimental OpenID connect support, -# it is still being tested and might have some bugs, please -# help us test it. -# OpenID Connect -# oidc: -# issuer: "https://your-oidc.issuer.com/path" -# client_id: "your-oidc-client-id" -# client_secret: "your-oidc-client-secret" -# -# If `strip_email_domain` is set to `true`, the domain part of the username email address will be removed. -# This will transform `first-name.last-name@example.com` to the namespace `first-name.last-name` -# If `strip_email_domain` is set to `false` the domain part will NOT be removed resulting to the following -# namespace: `first-name.last-name.example.com` -# -# strip_email_domain: true diff --git a/net-vpn/headscale/files/headscale.conf b/net-vpn/headscale/files/headscale.confd index 5bf65c68e358..5bf65c68e358 100644 --- a/net-vpn/headscale/files/headscale.conf +++ b/net-vpn/headscale/files/headscale.confd diff --git a/net-vpn/headscale/files/headscaled.initd b/net-vpn/headscale/files/headscale.initd index 5a12887f444b..5a98c0e6cb34 100644 --- a/net-vpn/headscale/files/headscaled.initd +++ b/net-vpn/headscale/files/headscale.initd @@ -18,7 +18,7 @@ depend() { start_pre() { if [ ! -s /etc/headscale/config.yaml ] ; then eerror "Missing headscale configuration file" - eerror "Please use /etc/headscale/config.yaml.example as example" + eerror "Please check the documentation directory for an example" return 1 fi diff --git a/net-vpn/headscale/files/headscaled.service b/net-vpn/headscale/files/headscale.service index fb27b40d4e31..fb27b40d4e31 100644 --- a/net-vpn/headscale/files/headscaled.service +++ b/net-vpn/headscale/files/headscale.service diff --git a/net-vpn/headscale/headscale-0.15.0-r1.ebuild b/net-vpn/headscale/headscale-0.15.0-r1.ebuild new file mode 100644 index 000000000000..856fe17a4444 --- /dev/null +++ b/net-vpn/headscale/headscale-0.15.0-r1.ebuild @@ -0,0 +1,49 @@ +# Copyright 2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit go-module systemd + +DESCRIPTION="An open source, self-hosted implementation of the Tailscale control server" +HOMEPAGE="https://github.com/juanfont/headscale" +SRC_URI="https://github.com/juanfont/headscale/archive/v${PV}.tar.gz -> ${P}.tar.gz + https://dev.gentoo.org/~jsmolic/distfiles/net-vpn/headscale/${P}-deps.tar.xz +" + +LICENSE="BSD Apache-2.0 MIT" +SLOT="0" +KEYWORDS="~amd64" + +DEPEND=" + acct-group/headscale + acct-user/headscale +" +RDEPEND=" + ${DEPEND} + net-firewall/iptables +" + +PATCHES=( + "${FILESDIR}"/config-socket.patch +) + +src_compile() { + emake version=v${PV} +} + +src_install() { + dobin headscale + dodoc -r docs/* config-example.yaml + keepdir /etc/headscale /var/lib/headscale + systemd_dounit "${FILESDIR}"/headscale.service + newconfd "${FILESDIR}"/headscale.confd headscale + newinitd "${FILESDIR}"/headscale.initd headscale + fowners -R ${PN}:${PN} /etc/headscale /var/lib/headscale +} + +pkg_postinst() { + [[ -f "${EROOT}"/etc/headscale/config.yaml ]] && return + elog "Please create ${EROOT}/etc/headscale/config.yaml before starting the service" + elog "An example is in ${EROOT}/usr/share/doc/${PV}/config-example.yaml" +} diff --git a/net-vpn/headscale/headscale-0.15.0.ebuild b/net-vpn/headscale/headscale-0.15.0.ebuild deleted file mode 100644 index 93a52a9f0cde..000000000000 --- a/net-vpn/headscale/headscale-0.15.0.ebuild +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright 2022 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -inherit go-module systemd - -DESCRIPTION="An open source, self-hosted implementation of the Tailscale control server" -HOMEPAGE="https://github.com/juanfont/headscale" -SRC_URI=" - https://github.com/juanfont/headscale/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz - https://dev.gentoo.org/~jsmolic/distfiles/net-vpn/headscale/${P}-deps.tar.xz -" - -LICENSE="BSD Apache-2.0 MIT" -SLOT="0" -KEYWORDS="~amd64" - -DEPEND=" - acct-group/headscale - acct-user/headscale -" -RDEPEND=" - ${DEPEND} - net-firewall/iptables -" - -src_install() { - keepdir /var/lib/headscale - keepdir /etc/headscale - - dobin headscale - - insinto /etc/headscale - doins "${FILESDIR}"/config.yaml.example - - fowners -R ${PN}:${PN} /etc/headscale - fowners -R ${PN}:${PN} /var/lib/headscale - - systemd_dounit "${FILESDIR}"/headscaled.service - newinitd "${FILESDIR}"/headscaled.initd headscaled - newconfd "${FILESDIR}"/headscale.conf headscaled -} - -pkg_postinst() { - elog "You will need to set up your /etc/headscale/config.yaml file before starting the service" - elog "Please use /etc/headscale/config.yaml.example as example" - elog "More in the official documentation https://github.com/juanfont/headscale/tree/main/docs" -} |