Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jwillikers/tailscale-online-target
A systemd network-online.target for Tailscale
https://github.com/jwillikers/tailscale-online-target
network nushell online systemd tailscale
Last synced: 8 days ago
JSON representation
A systemd network-online.target for Tailscale
- Host: GitHub
- URL: https://github.com/jwillikers/tailscale-online-target
- Owner: jwillikers
- License: other
- Created: 2024-02-10T19:43:14.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-06-09T16:54:59.000Z (5 months ago)
- Last Synced: 2024-06-09T18:18:54.070Z (5 months ago)
- Topics: network, nushell, online, systemd, tailscale
- Language: Nushell
- Homepage:
- Size: 52.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE.adoc
- Code of conduct: CODE_OF_CONDUCT.adoc
Awesome Lists containing this project
README
= Tailscale Online Target
Jordan Williams
:experimental:
:icons: font
:keywords: network nushell online systemd tailscale target
ifdef::env-github[]
:tip-caption: :bulb:
:note-caption: :information_source:
:important-caption: :heavy_exclamation_mark:
:caution-caption: :fire:
:warning-caption: :warning:
endif::[]
:just: https://github.com/casey/just[just]
:Nushell: http://www.nushell.sh/[Nushell]
:nushell-version: 0.94.2
:systemd: https://systemd.io/[systemd]
:Tailscale: https://tailscale.com/[Tailscale]The Tailscale Online Target is a {systemd} `network-online.target` for {Tailscale}.
This makes it possible to add systemd dependencies on the Tailscale network.
This is based off of the post https://forum.tailscale.com/t/mount-share-only-if-connected-to-tailscale/3027/6[Mount share only if connected to Tailscale] from the Tailscale Forum.
I've ported over the script to use Nushell and made it possible to add dependencies on specific devices being available on the Tailscale network.== Install
These are the steps to install Tailscale, Nushell, and the Tailscale Online Target.
These instructions are intended for Debian and Fedora Atomic systems.. Install {just} by following the instructions in the https://github.com/casey/just?tab=readme-ov-file#installation[installation section].
. Clone the repository.
+
[,sh]
----
git clone https://codeberg.org/jwillikers/tailscale-online-target.git
----. Change to the repository's directory.
+
[,sh]
----
cd tailscale-online-target
----. Install everything by running `just install`.
+
[,sh]
----
just install
----. Bring Tailscale online.
I use an exit node to route all traffic through Tailscale.
Modify or omit the `--exit-node` flag as necessary.
+
[,sh]
----
sudo tailscale up --exit-node=fd7a:115c:a1e0:ab12:4843:cd96:625f:e80c
----. Start the desired system timers.
Here I start the global timer as well as a timer for a specific instance.
+
System::
+
[,sh]
----
sudo systemctl enable --now tailscale-dispatcher.timer [email protected]
----User::
+
[,sh]
----
systemctl --user enable --now tailscale-dispatcher.timer [email protected]
----. Add a dependency on the specific `tailscale-online.target` as necessary for any systemd units.
=== Dependent Filesystems
Adding a dependency for filesystems is a bit more complicated than a regular systemd unit.
The instructions here describe how to do add a dependency on the Tailscale Online Target for a filesystem, such as an NFS mount.fstab:: In `/etc/fstab`, use the `x-systemd.requires` mount option to specify the dependency as in the following example.
+
./etc/fstab
[source]
----
nfs.jwillikers.io:/container-volumes /var/home/core/container-volumes nfs defaults,_netdev,context="system_u:object_r:container_file_t:s0",noatime,nodev,noexec,nofail,nosuid,soft,user,x-systemd.automount,x-systemd.idle-timeout=5min,x-systemd.mount-timeout=30s,[email protected] 0 0
----mount units:: Add the dependency manually to systemd mount and automount units.
+
--
[,sh]
----
sudo systemctl edit var-home-core-Media.mount
----./etc/systemd/system/var-home-core-Media.mount.d/override.conf
[,systemd]
----
[Unit]
[email protected]
[email protected]
----[,sh]
----
sudo systemctl edit var-home-core-Media.automount
----./etc/systemd/system/var-home-core-Media.automount.d/override.conf
[,systemd]
----
[Unit]
[email protected]
[email protected]
----
--== References
* https://systemd.io/NETWORK_ONLINE/[systemd: Network Configuration Synchronization Points]
== Code of Conduct
The project's Code of Conduct is available in the link:CODE_OF_CONDUCT.adoc[Code of Conduct] file.
== License
This repository is licensed under the https://www.gnu.org/licenses/gpl-3.0.html[GPLv3].
Please refer to the bundled link:LICENSE.adoc[license].© 2024 Jordan Williams
== Authors
mailto:{email}[{author}]