summaryrefslogtreecommitdiffhomepage
path: root/mullvad-cli/src
AgeCommit message (Collapse)AuthorFilesLines
2024-01-22Better error message for failed shell completionsSebastian Holmin1-3/+2
2024-01-22Move logic of toggling disabled access methods on use to the daemonMarkus Pettersson1-6/+1
2024-01-18Update the tunnel state on lockdown mode change.Sebastian Holmin1-8/+17
The printing of lockdown mode by `mullvad status` does not reflect the current setting unless the tunnel state has also been updated.
2024-01-18Print if lockdown mode is enabled when disconnected for `mullvad status`Sebastian Holmin2-7/+20
Add `locked_down` field to disconnected tunnel state.
2024-01-12Validate SOCKS5 credentialsMarkus Pettersson3-85/+70
Validate SOCKS credentials by checking that both `username` and `password` both have a length between 1 and 255 bytes. Link to RFC detailing SOCKS5 username/password authentication: https://datatracker.ietf.org/doc/html/rfc1929
2024-01-11Simplify CLI patch module slightlyDavid Lönnhager1-25/+19
2024-01-10Simplify JSON import and export in the CLIDavid Lönnhager1-106/+20
2024-01-10Print help if no argument is provided to export-settings or import-settings ↵David Lönnhager1-0/+2
in the CLI
2024-01-10Add CLI export-settings commandDavid Lönnhager2-5/+57
2024-01-10Add patch export to the management interfaceDavid Lönnhager3-5/+5
2024-01-08Add new internal daemon event `AccessMethodEvent`Markus Pettersson1-0/+5
Add a new `InternalDaemonEvent` for announcing when the current API access method changes.
2024-01-05Run `cargo +nightly fmt`Sebastian Holmin2-4/+6
2024-01-04Add workspace level lintsLinus Färnstrand1-2/+0
2024-01-03Allow app to use custom socks5 and shadwosocks proxiesJonathan4-389/+462
This PR has a couple of different purposes - Allow users to use socks5 local proxies with the CLI without having to be root nor use split-tunneling. This only works for OpenVPN. - Unify the types used by different proxy parts of the codebase, such as the Access Methods as well as some already existing OpenVPN proxy code. This PR changes the firewall on all desktop platforms as well as changes the routing table slightly on MacOS and Windows. On Linux the firewall code is modified to apply the appropriate firewall marks to all packages that go to a remote endpoint corresponding to the remote part of a local socks5 proxy. The firewall marks will allow the routing to be done without having to modify the routing table. On MacOS and Windows the routing table is modified to allow packages to go to that same endpoint to pass outside the VPN tunnel, it will additionally punch a hole in the firewall. The PR also migrates the settings file from version 7 to version 8 in order to properly and neatly unify Proxy related types. Finally it provides some slight extensions to the gRPC interface in order to allow for control over the custom proxy settings.
2023-12-29Show account id in the CLI with 'mullvad account get -v'David Lönnhager1-10/+16
2023-12-21Handle am.i.mullvad.net with internal daemon eventSebastian Holmin2-4/+2
Add `geoip::GeoIpHandler`, which sends an `InternalDaemonEvent::LocationEvent` when the location arrives. It also handles aborting in-flight requests and retries.
2023-12-21Remove `GetCurrentLocation`.Sebastian Holmin2-44/+44
Make the daemon send two tunnel state updates, one with out IP being empty, and another with it being filled when am.i.mullvad.net responds. Update CLI for this change. Other front ends are left out.
2023-12-04Perform testing of access methods asynchronouslyMarkus Pettersson1-2/+2
Perform testing of access methods asynchronously in a separate `tokio` task as to not block the daemon from handling other daemon events during the testing window
2023-12-04Move access method testing logic to `mullvad-daemon`Markus Pettersson1-28/+13
Move access method testing logic to `mullvad-daemon`, which means that the implementation details of how the test works is opaque to whatever frontend which wants to issue a test of some (configured) access method.
2023-11-23Remove unused crate `env_logger`Sebastian Holmin1-2/+0
2023-11-23Add `mullvad debug block-connection` commandSebastian Holmin3-3/+50
2023-11-23Add subcommand level `entry` to `wireguard`Sebastian Holmin1-11/+18
The command `relay set tunnel wireguard entry-location` is replaced with `relay set tunnel wireguard entry location` and `relay set tunnel wireguard custom-list` is replaced with `relay set tunnel wireguard entry custom-list`. This is intended to communicate that the `custom-list` also affects the entry relay and are mutually exclusive.
2023-11-23Improve feedback and error handling for custom-listsSebastian Holmin1-12/+21
2023-11-23Add `resolve_location_constraint` fnSebastian Holmin3-94/+141
The fn exists and returns error on hostname having wrong server type. Allow any host in custom-lists, only the currently configured tunnel protocol for `relay set location`, only bridges for the `bridge` subcommand and only wireguard servers in for the `wireguard` entry command. Reduce repeated init of rpc client Refactor inconsistent filtering on hostname
2023-11-23Refactor match statementSebastian Holmin1-10/+7
2023-11-23Simplify relay filter fnSebastian Holmin1-31/+31
Refactor: Unwrap result return type Refactor: for loop to iter map
2023-11-17Add CLI interface for applying JSON settings patchesDavid Lönnhager3-0/+109
2023-11-13Warn if setting relay overrides for non-existent hostname in the CLIDavid Lönnhager3-19/+45
2023-11-13Add CLI for relay overridesDavid Lönnhager3-29/+227
2023-11-07Add configurable transport protocol to local SOCKS5 access methodMarkus Pettersson1-7/+41
2023-11-06Remove `from_args` constructors for `access_methods` datatypesMarkus Pettersson1-66/+36
In particular, `access_methods::Socks5Local`, `access_methods::Socks5Remote` & `access_methods::Shadowsocks` have got new constructors which are all infallible.
2023-11-06Prefix remote `ip` and `port` with `remote_` in Socks5Local contextsMarkus Pettersson1-9/+12
2023-10-31Replace UpdateRelaySettings with SetRelaySettingsDavid Lönnhager1-35/+43
2023-10-27Make username+password authentication optional in SOCKS5 remote configurationMarkus Pettersson1-2/+3
SOCKS5 optionally supports username+password authentication, which has been implemented previously. This commit addresses a bug in the argument parsing, which made username+password required arguments when adding a remote SOCKS5 api access method using `mullvad api-access add socks5 remote`. Apparently, this is a known pitfall with `clap`: https://github.com/clap-rs/clap/issues/5092
2023-10-20`cipher` is now a `long` `clap` argument without default valueMarkus Pettersson1-1/+1
i.e. the user has to explicitly pass the `--cipher` flag to `mullvad api-access add shadowsocks ..` subcommand to configure a non-default cipher.
2023-10-20`remote_port` is no longer optionalMarkus Pettersson1-3/+2
This allow us to move the `remote_port` argument next to the `remote_ip` argument.
2023-10-20Do not set default password for custom `shadowsocks` access methodMarkus Pettersson1-3/+2
2023-10-09UX improvements for `mullvad api-access`Markus Pettersson2-56/+138
- Re-phrase help texts for a lot of `mullvad api-access` commands - Add to help texts for some `mullvad api-access` commands - Compact the output of `mullvad api-access test` - `mullvad api-access status` is changed to `mullvad api-access get` to align with other `mullvad` commands. - `mullvad api-access get` does not print the enabled/disabled status of the shown access method - Rotate access method if the currently active one is updated or removed - Fix reset access method after `mullvad api-access test` After running `mullvad api-access test`, the previously used access method should be used, which was not the case previously. - Fix `mullvad api-access use` API connectivity check - `mullvad api-access use` now runs a test-routine to check that the new access method will function before comitting to it. If this check fails, the previously used access method will be used instead - guarantee that `set_api_access_method` has finished upon returning. Make `mullvad_api::rest::next_api_endpoint` `async` and send a message upon completion. This is propagated to the caller of `next_api_endpoint` which can `await` the result
2023-10-09Add authentication with username+password for SOCKS5 access methodMarkus Pettersson1-14/+61
Add the option to authenticate against remote SOCKS5 proxies with a username+password combination. It was an oversight that this was not added from the start.
2023-10-09Code cleanupMarkus Pettersson1-17/+14
- Get rid of extraneous calls to `clone` - Address nit: combine similar match arms into a single match arm - Fix `clippy` lint "unused `async` for function with no await statements" - Fix protobuf field numbers should start from 1 - This was not the case for `Socks5Local` & `Shadowsocks` - Refactor code for opening proxy connections - Cut down on duplicated code for setting up a proxied connection in `mullvad-api`. The difference between different connection modes is how they wrap the underlying `TCP` stream. - Remove `enable_access_method` & `disable_access_method` from RPC-client
2023-10-09Add `GetCurrentApiAccessMethod` to show the current API access methodMarkus Pettersson1-0/+12
- Add a new RPC message: `GetCurrentApiAccessMethod`. This message may be used to retrieve the access method which is currently in use by the daemon for connecting to the Mullvad API. - Add `mullvad api-access status` for showing the API access method in use
2023-10-09Allow the user to specify if a new access method should be disabled when addedMarkus Pettersson1-2/+23
Adds the `-d | --disabled` flag to `mullvad api-access add <access-method>` command. If the `-d | --disable` is set, the access method is *not* enabled from the start. Note that it may still be tested using the `mullvad api-access test` command, even if it is principally marked as `disabled`.
2023-10-09Split up `mullvad api-access add` command for SOCKS5-proxyMarkus Pettersson1-50/+62
Split up `mullvad api-access add` command for SOCKS5-proxy into "local" and "remote".
2023-10-09Code cleanupMarkus Pettersson1-131/+106
- Rename `mullvad_types::api_access.rs` -> `mullvad_types::access_method.rs` - Rename `ApiAccessMethodId` to simply `Id` Prefer to prefix with module name `access_method` to disambiguate use of `Id` instead, like `access_method::Id` - Remove dead code - Remove `AccessMethodSettingsUpdate` - Remove the `retry_attempt` struct field from `ApiConnectionModeProvider`, as it is no longer used for anything. - Fix typos - `GetApiAddressess` is now correctly spelled `GetApiAddresses` (a single trailing "s") - Deprecate the name `ApiAccessMethod` in favor of `AccessMethodSetting` - To decrease the confusion between `AccessMethod` & `ApiAccessMethod`. `AccessMethodSetting` adds some app-specific settings details on top of an `AccessMethod`, which is not too far fetched with the new naming convention. - Refactor proto file - Rename protobuf message `AccessMethodSettingAdd` to `NewAccessMethodSetting` - `AccessMethod` is now its own message - `AccessMethods` is removed - Add `ApiAccessMethodAdd` protobuf message - The `ApiAccessMethodAdd` returns a `UUID` for the . One important change is that new `AccessMethodSetting`s are created in the daemon, rather than in the CLI/other clients. This means that the daemon now has full control over generating new `AccessMethodSetting`s from `AccessMethod`s. - Clean up conversion code to/from `AccessMethod` protobuf types - Simplify `UpdateApiAccessMethod` RPC - Remove the extranous `ApiAccessMethodUpdate` data type - get rid of `ApiAccessMethodUpdate` protobuf message. Use `UUID` of `ApiAccessMethod` to identify which struct to edit. - get rid of `ApiAccessMethodUpdate` struct
2023-10-09Rename `ApiAccessMethod` to `AccessMethodSetting`Markus Pettersson1-18/+22
`ApiAccessMethod` was just an app-centric wrapper around `AccessMethod`.
2023-10-09Code cleanupMarkus Pettersson1-15/+13
- Refactor `RemoveApiAccessMethod` to be based on UUID - Remove debug-prints in `mullvad api-access list` et al - Get rid of `GetApiAccessMethods` RPC - Use the more generic RPC `GetSettings` to get hold of all API access methods instead - Rename `mullvad_types::access_method` to `mullvad_types::api_access` - Remove (unjustified) `#[inline(always)]` attributes
2023-10-09Refrain from using the word `proxy` where it does not make senseMarkus Pettersson2-14/+14
Do not use the word "proxy" in the context of API access methods, but only in the context where we are actually refering to a proxy (such as `SOCKS5` or `Shadowsocks` proxies).
2023-10-09Refactor protobuf `ApiAccessMethod` definitionsMarkus Pettersson1-55/+42
- Replace rpcs `ReplaceApiAccessMethod` and `ToggleApiAccessMethod` in favor of a commmon `UpdateApiAccessMethod` (which resembles `ReplaceApiAccessMethod` in a lot of ways). - `UpdateApiAccessMethod` works with unique identifiers instead of array indices to pinpoint which API access method to update. - Toggling an API access method to be enabled/disabled now happens via `UpdateApiAccessMethod` - Add the useful `UUID` protobuf type definition, which conveys more information that a raw string. - Refactor `SetApiAccessMethod` to use API access method ID - Update `ApiAcessMethod` messages to use `UUID` type for uuid values - Use unique id for removing custom `ApiAccessMethods`
2023-10-09CleanupMarkus Pettersson3-209/+165
- General code cleanup - Fix some typos - Add some doc comments - Address several `TODO` comments - Fix `clippy` warnings - Removed unused dependency `mullvad-api` from `mullvad-cli` - Removed unused dependency `rand` from `mullvad-daemon` - Rename `mullvad proxy` to `mullvad api-access` - Rename `mullvad_types::api_access_method` -> `mullvad_types::access_method` - Remove unused `mullvad api-access edit` arguments - Fix `Display` for `ProxyConfig` printing arguments in the wrong order - Re-phrase `mullvad api-access test` - If the API call failed, point out which tested access method that did not work. - Fix missing `socket_bypass_tx` value for Android - Refactor `ApiAccessMethod` proto definition - Simplify protobuf definitions of `SOCKS5` api access methods - Remove the `Socks5` enum in favor of implementing `Socks5Local` and `Socks5Remote` directly. - Move `enabled` and `name` out of the individual messages and put them next to the `oneof access_method` in `ApiAccessMethod` proto definition - Use derived `PartialEq` and `Hash` from `AccessMethod` - Instead of hand-rolling `Hash` and implementing an ad-hoc version of half of `PartialEq`, these can now be derived and used as one would imaging due to the refactoring wherer `name` and `enabled` was moved out of `AccessMethod` into `ApiAccessMethod`.
2023-10-09Add `mullvad proxy test`Markus Pettersson1-0/+34
For quickly assessing whether an api access method can reach the API or not.