Commit Graph

161 Commits (hosts-selinux)

Author SHA1 Message Date
Brian Schwind 817376bdfa Remove unused ClientError struct 2024-05-04 19:19:45 +09:00
Ryan Gonzalez 9011c36da6 hostsfile: Copy the SELinux context to the temp file before overwrite
On SELinux-enabled systems, /etc/hosts has a different type `net_conf_t`
than the other files in /etc, so the temporary file that overwrites it
ends up with the wrong context, resulting in many system services
becoming unable to access the file. To fix this, manually look up the
context /etc/hosts has and copy it to the temporary file before
the rename.

In order to avoid depending on libselinux on systems that don't use it,
this support is gated behind the new "selinux" feature. It *is*
installed and enabled in the Dockerfile, however, in order to ensure
that it still builds.
2024-05-04 19:08:56 +09:00
Ryo Kawaguchi 3c69de4e4e
Add a new client / server command to rename CIDR (#310)
* Add a new client / server command to rename CIDR.

* Add a docker test case

* Apply suggestions from code review

Co-authored-by: Matěj Laitl <matej@laitl.cz>
Co-authored-by: Jake McGinty <me@jakebot.org>

---------

Co-authored-by: Matěj Laitl <matej@laitl.cz>
Co-authored-by: Jake McGinty <me@jakebot.org>
2024-04-23 06:12:36 +09:00
Linus Kendall aa1ac515e8
Add CLI parameters for disable/enable peer (#248)
* Add CLI parameters for disable/enable peer

Fixes tonarino/innernet#214.

* Formatting

* Remove redundant clones

* Require name for yes param

Yes param only makes sense if name is provided.

* Formatting
2024-01-15 22:43:00 +01:00
Brian Schwind 489f505f67
meta: release v1.6.1 (#295)
Co-authored-by: straylight-annex-portal <tonari@straylight-annex-portal>
2023-12-27 12:42:31 +09:00
Matěj Laitl 8d058c8d87
meta: release v1.6.0 (ran on Linux) (#270)
* meta: release v1.6.0

* README: update release steps
2023-06-14 10:49:16 +02:00
Matěj Laitl c629e01076
meta: add Brian, Ryo, Matěj as authors, canonicalize Jake's email (#267)
* meta: add Brian, Ryo, Matěj as authors, canonicalize Jake's email

Follow-up to #252.

* Also update shared/Cargo.toml

Co-authored-by: Jake McGinty <me@jakebot.org>

---------

Co-authored-by: Jake McGinty <me@jakebot.org>
2023-06-06 12:21:11 +09:00
Matěj Laitl b3a9718abc
Drop warning about using the inn symlink (#266)
Follow-up to just-merged #175. We no longer install the `inn` symlink, so users doing that manually should know what they are doing.
2023-06-02 09:56:56 +02:00
Caleb Maclennan 68df161264
build: drop 'inn' symlink from deb/rpm packaging (#175) 2023-06-02 08:45:40 +02:00
Eva Pace de7ec99ad9
Optimize /etc/hosts writes (#259)
* hostsfile: change internal map from hash to btree

This change makes the innernet section of /etc/hosts always ordered and
deterministic. We can take advantage of that to avoid writes, that will
be done in another commit.

* hostsfile: reduce number of writes if content hasn't changed

* hostsfile: return bool to inform if file has been written

This commit also makes the logs print accordingly to the new behavior.

* hostsfile: remove has_content_changed in favor of comparing old and new sections

* hostsfile: print the correct hosts path in log message

* hostsfile: remove unnecessary intermediate variable
2023-06-02 08:42:54 +02:00
Jake McGinty 33cee129d1
Various dependency updates (#265)
* update netlink-*, toml, clap, other small dependencies
* switch back to x25519-dalek from curve25519-dalek
2023-06-01 01:25:46 -05:00
Brian Schwind 0057a703ff
Turn ChangeString into a PeerChange enum (#263)
* Turn ChangeString into a PeerChange enum, don't print NAT traversal reattempt as a modification

* Remove the ChangeString type

* Fix a stupid copy-paste error
2023-06-01 12:11:31 +09:00
Brian Schwind bd4aabe787
Reset peer's endpoint when NAT traversal fails to connect to any endpoint candidates (#262)
* Add a missing call to reset a peer's endpoint when NAT traversal fails to connect to any endpoint candidates

* Simplify the process of resetting a peer to its server-reported endpoint
2023-05-31 11:48:52 +09:00
Jake McGinty ebeac3db76 migrate from lazy_static to once_cell across project 2023-05-30 11:24:40 +02:00
Jake McGinty b4df350b1c meta: update jake's email address 2023-04-15 08:45:11 +02:00
Matěj Laitl 55beed3c2d Remove extraneous into_iter() (clippy 1.68 fix)
https://doc.rust-lang.org/std/fs/fn.read_dir.html already returns an Iterator (`ReadDir`s IntoIter implementation returns `self`)
2023-03-28 16:03:56 +02:00
Matěj Laitl 0dc92de722 Auto-apply clippy lint fixes from Rust 1.67 2023-02-05 03:13:54 +09:00
Matěj Laitl 2859684864 cargo clippy --fix --all-targets (clippy 1.66)
This is exclusively (if I look correctly) redundant referencing.
2023-01-03 22:42:50 +01:00
Jake McGinty eac6071d7a meta: release v1.5.5 2022-09-23 23:16:35 -05:00
Jake McGinty b39b77aa5a meta: appease clippy 2022-09-23 23:43:33 -04:00
Jake McGinty 1fb5874527 meta: appease clippy 2022-08-10 16:39:09 -06:00
Jakob-Niklas See 15594d4458
server: Implement disable-peer and enable-peer commands (#226)
* client: Update enable_or_disable_peer exit message to be more accurate

* server: Implement disable-peer and enable-peer commands

* server: Immediately apply enable- and disable-peer to device
2022-08-11 06:13:55 +09:00
Matěj Laitl 144c2f654e Fix clippy warnings
Especially https://rust-lang.github.io/rust-clippy/master/index.html#format_push_string was a bit
more involved, review requested.
2022-08-01 10:57:11 +02:00
Jake McGinty a6c918a581 meta: release v1.5.4 2022-03-16 18:17:37 +09:00
Jake McGinty be8786a11c meta: release v1.5.4-beta.5 2022-03-15 11:15:56 +09:00
Jake McGinty e544391303 meta: update dependencies 2022-03-15 10:47:52 +09:00
Jake McGinty 3bfd81d8ed meta: release v1.5.4-beta.4 2022-02-18 10:57:22 +09:00
Jake McGinty 123977be34 meta: cargo update 2022-02-17 09:53:59 +09:00
Jake McGinty 80a070baae meta: release v1.5.4-beta.3 2022-02-05 04:18:39 +09:00
Jake McGinty c7a2f7391c meta: release v1.5.4-beta.2 2022-02-03 01:50:39 +09:00
Jake McGinty 6d26385ba3
client: re-attempt NAT traversal on all unconnected peers (#195)
fixes #173
2022-02-03 01:49:51 +09:00
Jake McGinty f7df6bab01 meta: release v1.5.4-beta.1 2022-02-01 14:04:11 +09:00
Jake McGinty a77cbb4f49
meta: switch from ipnetwork to ipnet (#193) 2022-02-01 14:01:21 +09:00
Jake McGinty 110bace5c7
client: enable IPv6 NAT candidate reporting (#192) 2022-02-01 12:21:31 +09:00
Jake McGinty 4715cd0c87 meta: release v1.5.3 2022-02-01 04:56:11 +09:00
Jake McGinty ddac328ae5 client: make more commands automation-friendly
Fixes #190
2022-01-31 06:10:45 +00:00
Jake McGinty e11b73972c client: stop uninstall from prompting if network doesn't exist 2022-01-24 01:46:37 +00:00
Jake McGinty 4000d84648 meta: release v1.5.3-beta.5 2022-01-22 18:08:31 +00:00
Jake McGinty 16ac280807 meta: release v1.5.3-beta.4 2022-01-18 15:56:36 +09:00
Jake McGinty b53376b9c8 meta: release v1.5.3-beta.3 2022-01-18 15:19:53 +09:00
Jake McGinty ce23bbdf63 meta: release v1.5.3-beta.2 2022-01-12 16:31:31 -06:00
Jake McGinty b15b541669 meta: release v1.5.3-beta.1 2022-01-11 14:18:19 -06:00
Matěj Laitl 1b260823f9
client, server systemd units: make Restart=always truly respected (#184)
Surprisingly, Restart=always may not _always_ restart the unit if it restarts too fast.

Set a combination of options which should make systemd truly restart innernet always.
See https://unix.stackexchange.com/q/289629/352972.

The `RestartSec=60` is the main and important one which would prevent systemd from ever failing
to restart innernet in the default settings (because with it it would never exceed the default
limit of 5 restarts in 10 seconds).

`StartLimitIntervalSec=0` option is a complementary one for explicitly disabling the logic, and
may be removed from this PR if deemed unnecessary.
2022-01-12 04:58:28 +09:00
Jake McGinty 0423e78683 server: cargo fmt 2022-01-11 01:54:59 -06:00
Jake McGinty 5c72592069 meta: rust edition 2018 -> 2021 2022-01-11 01:54:43 -06:00
Jake McGinty 8dd11977af meta: structopt 0.3 -> clap 3 2022-01-11 01:51:32 -06:00
Jake McGinty 09e68c2c01
(linux) wireguard-control: migrate from `wireguard-control-sys` to `netlink` crates (#177)
also introduces a new `netlink-request` crate to help modularize the netlink code. this currently depends on a fork of the `netlink` project, but we should be able to use the official version soon.
2022-01-07 18:35:21 +09:00
Jake McGinty 6be3e61074 meta: release v1.5.2 2021-12-06 02:35:18 +09:00
Jake McGinty d2a2e881e5 add warning when binary is called with 'inn' shortcut 2021-11-30 04:16:44 +09:00
Jake McGinty 2c31a4b6ec client: run 'up' on all interfaces when none is specified 2021-11-23 23:07:57 -07:00