Kristoffer Dalby
b4259fcd79
Add helper function for colouring expiries
2022-01-25 22:11:15 +00:00
Csaba Sarkadi
1a6e5d8770
Add support for multiple IP prefixes
2022-01-16 14:18:22 +01:00
Kristoffer Dalby
25b5eb8d7f
Update tests to aline with new config example
2022-01-02 23:17:42 +00:00
Kristoffer Dalby
8932133ae7
Merge branch 'main' into kradalby-patch-2
2021-11-28 09:28:32 +00:00
Kristoffer Dalby
34f4109fbd
Add back privatekey, but automatically generate it if it does not exist
2021-11-28 09:17:18 +00:00
Kristoffer Dalby
ef81845deb
Merge branch 'main' into kradalby-patch-2
2021-11-27 20:30:27 +00:00
Kristoffer Dalby
59aeaa8476
Ensure we always have the key prefix when needed
2021-11-27 20:25:12 +00:00
Ward Vandewege
cb2ea300ad
Fix linter errors.
2021-11-27 13:59:39 -05:00
Kristoffer Dalby
c38f00fab8
Unmarshal keys in the non-deprecated way
2021-11-26 23:50:42 +00:00
Kristoffer Dalby
cfd53bc4aa
Factor wgkey to types/key
...
This commit converts all the uses of wgkey to the new key interfaces.
It now has specific machine, node and discovery keys and we now should
use them correctly.
Please note the new logic which strips a key prefix (in utils.go) that
is now standard inside tailscale.
In theory we could put it in the database, but to preserve backwards
compatibility and not spend a lot of resources on accounting for both,
we just strip them.
2021-11-26 23:30:42 +00:00
Kristoffer Dalby
07418140a2
Remove config loading of private key path
2021-11-26 23:29:41 +00:00
Ward Vandewege
b6ae60cc44
The create-node
subcommand under debug
needs a 64 character key.
2021-11-26 14:49:51 -05:00
Ward Vandewege
c7f3e0632b
When creating a preauthkey, the default expiration was passed through as
...
a nil value, instead of the default value (1h). This resulted in the
preauthkey being created with expiration key '0001-01-01 00:00:00',
which meant the key would not work, because it was already expired.
This commit applies the default expiration time (1h) when a preauthkey
is created without a specific expiration. It also updates an integration
test to make sure this bug does not reoccur.
2021-11-26 10:04:26 -05:00
Kristoffer Dalby
e8faff4fe2
Use uint64 straight instead of converting
2021-11-22 17:22:22 +00:00
Kristoffer Dalby
fac33e46e1
Add long description for expire
2021-11-21 21:35:36 +00:00
Kristoffer Dalby
b152e53b13
Use correct type for nodes command
2021-11-21 21:34:03 +00:00
Kristoffer Dalby
a2b9f3bede
Add expire (logout) machine command
2021-11-21 13:40:44 +00:00
Kristoffer Dalby
f85a77edb5
Remove println statement
2021-11-21 09:48:59 +00:00
Kristoffer Dalby
1c7aff5dd9
Add expired column to machine list command
2021-11-21 09:44:38 +00:00
Kristoffer Dalby
6a9dd2029e
Remove expiry logic, this needs to be redone
2021-11-19 09:02:49 +00:00
Kristoffer Dalby
d6739386a0
Get rid of dynamic errors
2021-11-15 19:18:14 +00:00
Kristoffer Dalby
db8be91d8b
Add and fix forbidigo
2021-11-15 18:36:02 +00:00
Kristoffer Dalby
c4d4c9c4e4
Add and fix gosec
2021-11-15 18:31:52 +00:00
Kristoffer Dalby
715542ac1c
Add and fix stylecheck (golint replacement)
2021-11-15 17:24:24 +00:00
Kristoffer Dalby
0c45f8d252
Add and fix errorlint
2021-11-15 16:26:41 +00:00
Kristoffer Dalby
471c0b4993
Initial work eliminating one/two letter variables
2021-11-14 20:32:03 +01:00
Kristoffer Dalby
85f28a3f4a
Remove all instances of undefined numbers (gonmd)
2021-11-14 18:31:51 +01:00
Kristoffer Dalby
796072a5a4
Add and fix ifshort
2021-11-14 18:09:22 +01:00
Kristoffer Dalby
c9c16c7fb8
Remove unused params or returns
2021-11-14 18:03:21 +01:00
Kristoffer Dalby
19cd7a4eac
Add and fix exhaustive
2021-11-14 17:52:55 +01:00
Kristoffer Dalby
89eb13c6cb
Add and fix nlreturn (new line return)
2021-11-14 16:46:09 +01:00
Kristoffer Dalby
052883aa55
Fix merge conflict
2021-11-14 08:30:48 +00:00
Ward Vandewege
acf7e462ad
Improvements for namespace deletion: add a confirmation prompt, and make
...
sure to also delete any associated preauthkeys.
2021-11-13 14:01:05 -05:00
Kristoffer Dalby
2634215f12
golangci-lint --fix
2021-11-13 08:39:04 +00:00
Kristoffer Dalby
03b7ec62ca
Go format with shorter lines
2021-11-13 08:36:45 +00:00
Kristoffer Dalby
0803c407a9
Fix Reusable typo, add tests for Augustines scenario
2021-11-08 20:49:03 +00:00
Kristoffer Dalby
dce6b8d72e
Add test case and fix nil pointer in preauthkeys command without expiration
2021-11-08 08:02:01 +00:00
Kristoffer Dalby
d47b83f80b
Unwrap grpc errors to make nicer user facing errors
2021-11-07 10:15:32 +00:00
Kristoffer Dalby
b11acad1c9
Fix typo
2021-11-07 09:57:39 +00:00
Kristoffer Dalby
2dfd42f80c
Attempt to dry up CLI client, add proepr config
...
This commit is trying to DRY up the initiation of the gRPC client in
each command:
It renames the function to CLI instead of GRPC as it actually set up a
CLI client, not a generic grpc client
It also moves the configuration of address, timeout (which is now
consistent) and api to use Viper, allowing users to set it via env vars
and configuration file
2021-11-07 09:41:14 +00:00
Kristoffer Dalby
ce3f79a3bf
Add yaml to output help
2021-11-07 08:58:45 +00:00
Kristoffer Dalby
a249d3fe39
Fix color for current namespace in nodes command
2021-11-07 08:58:03 +00:00
Kristoffer Dalby
8df41b069f
Formatting
2021-11-04 22:45:08 +00:00
Kristoffer Dalby
be4256b1d0
Convert routes command to use gRPC
2021-11-04 22:44:59 +00:00
Kristoffer Dalby
77a973878c
Convert preauthkeys command to use gRPC
2021-11-04 22:44:49 +00:00
Kristoffer Dalby
7b0d2dfb4a
Convert nodes command to use gRPC
2021-11-04 22:44:35 +00:00
Kristoffer Dalby
79871d2463
Make namespace command use gRPC
...
This commit is a first in a series of commits migrating the command
interfaces to use the new gRPC client.
As a part of this commit, they have been streamlined and each command
_should_ be a bit more similar and use consistent output.
By using the new output function, we now make sure its always json
(errors and everything) if the user asks for JSON.
2021-11-04 22:42:21 +00:00
Kristoffer Dalby
dce82f4323
Use new json wrapper for version command
2021-11-04 22:41:55 +00:00
Kristoffer Dalby
9e9049307e
Simplify loglevel parser, turn off logs when machine output is set
2021-11-04 22:32:13 +00:00
Kristoffer Dalby
cd34a5d6f3
Expand json output to support yaml, make more generic
2021-11-04 22:31:47 +00:00
Kristoffer Dalby
4226da3d6b
Add "debug" command
...
This commit adds a debug command tree, intended to host commands used
for debugging and testing.
It adds a create node/machine command which will be used later to create
machines that can be used to test the registration command.
2021-11-04 22:08:45 +00:00
Kristoffer Dalby
12f2a7cee0
Move context per cure's suggestion
2021-10-31 16:26:51 +00:00
Kristoffer Dalby
264e5964f6
Resolve merge conflict
2021-10-31 09:40:43 +00:00
Kristoffer Dalby
cbf3f5d640
Resolve merge conflict
2021-10-30 15:33:01 +00:00
Kristoffer Dalby
018e42acad
Merge branch 'main' into initial-api-cli-work
2021-10-30 15:31:34 +01:00
Kristoffer Dalby
434fac52b7
Fix lint error
2021-10-30 14:29:03 +00:00
Kristoffer Dalby
6aacada852
Switch from gRPC localhost to socket
...
This commit changes the way CLI and grpc-gateway communicates with the
gRPC backend to socket, instead of localhost. Unauthenticated access now
goes on the socket, while the network interface will require API key (in
the future).
2021-10-30 14:08:16 +00:00
Kristoffer Dalby
72fd2a2780
Fix lint error
2021-10-29 17:36:11 +00:00
Kristoffer Dalby
9ef031f0f8
Port create, delete and list of namespace to grpc
2021-10-29 17:16:54 +00:00
Kristoffer Dalby
81b8610dff
Add helper function to setup grpc client for cli
2021-10-29 17:15:52 +00:00
Kristoffer Dalby
eefd82a574
Move config loading out of the headscale app setup
2021-10-29 17:09:06 +00:00
Kristoffer Dalby
002b5c1dad
Add grpc token auth struct
2021-10-29 17:08:21 +00:00
Raal Goff
2d252da221
suggested documentation and comments
2021-10-29 21:35:07 +08:00
Ward Vandewege
f9187bdfc4
Switch to named arguments for all nodes
subcommands. Update docs
...
accordingly. Fix integration test failure.
2021-10-28 09:31:15 -04:00
Ward Vandewege
b00a2729e3
Update cmd/headscale/cli/nodes.go
...
Co-authored-by: Kristoffer Dalby <kradalby@kradalby.no>
2021-10-28 08:39:42 -04:00
Ward Vandewege
6c01b86e4c
Update cmd/headscale/cli/nodes.go
...
Co-authored-by: Kristoffer Dalby <kradalby@kradalby.no>
2021-10-28 08:39:27 -04:00
Ward Vandewege
d086cf4691
Move the namespace argument back to a flag for the share and unshare
...
commands.
2021-10-27 17:51:42 -04:00
Ward Vandewege
f9ece0087d
Make the cli help a little more explicit for the nodes subcommand.
2021-10-26 08:50:25 -04:00
Ward Vandewege
dd7557850e
cli changes for the nodes
subcommand:
...
* when listing nodes, a namespace is now optional, when it is not
provided, all nodes are shown
* when deleting, and sharing a node, remove the `namespace` flag, it was
superfluous and unused
* when unsharing a node, specify the namespace as an argument not a
flag, making the UX the same as for sharing.
Also refactor the share/unshare code to reuse the shared bits.
2021-10-24 17:50:28 -04:00
Kristoffer Dalby
7da3d4ba50
Resolve merge conflict
2021-10-24 21:21:01 +01:00
Kristoffer Dalby
b85adbc40a
Remove the need for multiple config files
...
This commit removes the almost a 100% redundant tests (two fields were
checked differently) and makes a single example configuration for users.
2021-10-22 18:14:29 +01:00
Kristoffer Dalby
57f46ded83
Split derp into its own config struct
2021-10-22 16:55:14 +00:00
Kristoffer Dalby
2c5701917d
Merge branch 'main' into doc-reorg-v1
2021-10-21 18:46:29 +01:00
Juan Font Alonso
6b0f5da113
Separate config examples for sqlite and postgres for the time being
2021-10-20 23:27:59 +02:00
Juan Font
41c5a0ddf5
Apply suggestions from code review
...
Co-authored-by: Kristoffer Dalby <kradalby@kradalby.no>
2021-10-20 09:35:56 +02:00
Juan Font Alonso
18b00b5d8d
Add support for Split DNS (implements #179 )
2021-10-19 20:51:43 +02:00
Kristoffer Dalby
da14750396
Merge branch 'main' into main
2021-10-19 15:26:18 +01:00
Kristoffer Dalby
677bd9b657
Implement namespace matching
2021-10-18 19:27:52 +00:00
Ward Vandewege
9e3339b4f1
Add cli support for unsharing a node from a namespace.
2021-10-17 16:29:46 -04:00
Kristoffer Dalby
710616f118
Merge branch 'main' into main
2021-10-17 13:26:37 +01:00
Ward Vandewege
7dcf4a5147
Add support for renaming namespaces.
2021-10-16 11:20:06 -04:00
Raal Goff
d0cd5af419
fix incorrect merge
2021-10-16 22:34:11 +08:00
unreality
afbfc1d370
Merge branch 'main' into main
2021-10-16 22:31:37 +08:00
Juan Font Alonso
be3a379d10
Added --force flag on node delete ( fixes #164 )
2021-10-16 12:30:52 +02:00
Juan Font
654d2b9910
Merge branch 'main' into complete-expire-command
2021-10-16 09:41:14 +02:00
Juan Font Alonso
0d13e16fed
Improve help message to expire key ( fixes #161 )
2021-10-14 23:58:15 +02:00
Juan Font Alonso
91d135e069
Show JSON when error on expire key ( fixes #162 )
2021-10-14 23:54:07 +02:00
Juan Font
cc3e8705bd
Merge branch 'main' into better-pak-management
2021-10-13 23:04:00 +02:00
Juan Font
06ae2a6c50
Merge branch 'main' into better-pak-management
2021-10-13 23:00:38 +02:00
Juan Font
93517aa6f8
Apply suggestions from code review
...
Renamed AlreadyUsed to Used
Co-authored-by: Kristoffer Dalby <kradalby@kradalby.no>
2021-10-13 22:51:55 +02:00
Juan Font
5f0f3705c0
Merge branch 'main' into disable-version-check-on-json
2021-10-13 22:44:18 +02:00
Juan Font Alonso
30788e1a70
Add AlreadyUsed field to Auth Keys ( fixes #157 and #158 )
2021-10-13 18:13:26 +02:00
Juan Font Alonso
27947c6746
This commit disables the version checker when JSON output ( #153 )
2021-10-13 00:18:55 +02:00
Juan Font Alonso
6924b7bf4c
Output json when deleting node ( fixes #152 )
2021-10-12 23:48:08 +02:00
Raal Goff
74e6c1479e
updates from code review
2021-10-10 17:22:42 +08:00
Kristoffer Dalby
2997f4d251
Merge branch 'main' into main
2021-10-08 22:21:41 +01:00
Raal Goff
e407d423d4
updates from code review
2021-10-08 17:43:52 +08:00
Raal Goff
c487591437
use go-oidc instead of verifying and extracting tokens ourselves, rename oidc_endpoint to oidc_issuer to be more inline with spec
2021-10-06 17:19:15 +08:00
Juan Font Alonso
da4a9dadd5
Warn users when MagicDNS is set with no DNS servers
2021-10-04 22:16:53 +02:00
Juan Font
040a18e6f8
Merge branch 'main' into magic-dns-support
2021-10-04 19:45:12 +02:00
Juan Font Alonso
ec911981c2
Do not allow magicdns if not nameservers set up
2021-10-04 19:43:58 +02:00
Aaron Bieber
817cc1e567
these are not files!
2021-10-03 14:02:44 -06:00
Aaron Bieber
8fa0fe65ba
Add the ability to specify registration ACME email and ACME URL.
2021-10-03 12:26:38 -06:00
Juan Font
990ff153c0
Merge branch 'main' into magic-dns-support
2021-10-02 15:16:51 +02:00
Juan Font Alonso
19492650d4
Fixed error on assign
2021-10-02 13:03:08 +02:00
Juan Font Alonso
656237e167
Propagate dns config vales across Headscale
2021-10-02 11:20:42 +02:00
Juan Font Alonso
5dbf6b5127
Extended DNS config unit tests
2021-10-02 11:14:18 +02:00
Kristoffer Dalby
0393ab524c
Merge branch 'main' into main
2021-09-28 11:20:31 +01:00
Juan Font Alonso
3f3cfedffa
Add support for MagicDNS
2021-09-28 00:22:29 +02:00
Juan Font Alonso
a6adcdafa9
Added switch to disable the update checks
2021-09-27 17:24:34 +02:00
Juan Font Alonso
7c37086dd6
Handle lack of internet
2021-09-27 17:12:31 +02:00
Juan Font Alonso
2048e9e136
Added version checker on startup
2021-09-27 16:26:18 +02:00
Raal Goff
e7a2501fe8
initial work on OIDC (SSO) integration
2021-09-26 16:53:05 +08:00
Juan Font
5840f88251
Update tailscale dependencies to v1.14
2021-09-14 23:46:16 +02:00
Aaron Bieber
203e6bc6b2
Remove trace lines about NO_COLOR.
2021-09-12 07:30:35 -06:00
Juan Font
c4e6ad1ec7
Fixed some typos
2021-09-10 00:52:08 +02:00
Juan Font
263a3f1983
Merge branch 'main' into shared-nodes
2021-09-10 00:49:50 +02:00
Juan Font
bd6adfaec6
Changes a few more variables
2021-09-10 00:37:01 +02:00
Juan Font
55f3e07bd4
Apply suggestions from code review
...
Removed one letter variables
Co-authored-by: Kristoffer Dalby <kradalby@kradalby.no>
2021-09-10 00:26:46 +02:00
Juan Font
729cd54401
Renamed sharing function
2021-09-06 14:39:52 +02:00
Juan Font
7edd0cd14c
Added add node cli
2021-09-03 10:23:45 +02:00
Juan Font
d86de68b40
Show namespace in node list table
2021-09-02 17:06:47 +02:00
Silver Bullet
e4ef65be76
fix: check last seen time without possible null pointer
2021-09-02 05:44:42 +08:00
Kristoffer Dalby
8735e5675c
Add a test for the getdnsconfig function
2021-08-25 19:03:04 +01:00
Kristoffer Dalby
3f5e06a0f8
Dont add the portnumber to the ip
2021-08-25 18:43:13 +01:00
Kristoffer Dalby
b3732e7fb9
Add nameserver as resolver aswell
2021-08-25 07:04:48 +01:00
Kristoffer Dalby
e77c16b55a
Add DNSConfig to example and setup test
2021-08-24 07:10:09 +01:00
Kristoffer Dalby
987bbee1db
Add DNSConfig field to configuration
2021-08-24 07:09:47 +01:00
Juan Font
74d2fe1baa
Merge pull request #84 from kradalby/integration-tests-ci
...
Improve logic to keep nodes up to date with the network state
2021-08-23 09:42:07 +02:00
Kristoffer Dalby
4f97e077db
Add --all flag to routes enable command to enable all advertised routes
2021-08-21 15:04:30 +01:00
Kristoffer Dalby
c883e79884
Enhance route command with ptables and multiple routes
...
This commit rewrites the `routes list` command to use ptables to present
a slightly nicer list, including a new field if the route is enabled or
not (which is quite useful).
In addition, it reworks the enable command to support enabling multiple
routes (not only one route as per removed TODO). This allows users to
actually take advantage of exit-nodes and subnet relays.
2021-08-21 14:49:46 +01:00
Kristoffer Dalby
d93a7f2e02
Make Info default log level
2021-08-20 17:15:07 +01:00
Juan Font
bc2574680d
Linting
2021-08-15 23:35:03 +02:00
Juan Font
f194b41435
Better table in preauthkeys
2021-08-15 23:29:55 +02:00
Juan Font
350f7da55d
Better table in namespaces
2021-08-15 23:20:38 +02:00
Juan Font
55fe5b0b41
Use pterm table in node list
2021-08-15 23:10:39 +02:00
Juan Font
4c849539fc
Expire the ephemeral nodes in the Serve method
2021-08-12 21:44:12 +02:00
Kristoffer Dalby
c9e5048015
Merge remote-tracking branch 'upstream/main' into integration-tests
2021-08-08 17:57:28 +01:00
Kristoffer Dalby
91ffd10192
Remove "Keys: " from create auth key output
...
This is based on the premis that "the user know what command they
executed" and therefor know that the output is the key.
This makes the command a lot more useful in scripts.
2021-08-08 17:37:23 +01:00
Juan Font
05e08e0ac7
Added cmd to expire preauth keys (requested in #78 )
2021-08-08 00:10:30 +02:00
Kristoffer Dalby
73a00c89ff
Try to detect color support, make color configurable
...
This commit tries to detect if users can render colors in their terminal
and only enables color logs if that is true.
It also adds no-color.org's NO_COLOR env var support to allow it to be
disabled.
2021-08-06 07:29:57 +01:00
Juan Font
8a614dabc0
Headscale is from no-juan
2021-08-06 00:23:07 +02:00
Kristoffer Dalby
a8c8a358d0
Make log keys lowercase
2021-08-05 20:57:47 +01:00
Kristoffer Dalby
cd2ca137c0
Make log_level user configurable
2021-08-05 19:19:25 +01:00
Kristoffer Dalby
0660867a16
Correct url
2021-08-05 18:58:15 +01:00
Kristoffer Dalby
b1200140b8
Convert cli/utils.go
2021-08-05 18:26:49 +01:00
Kristoffer Dalby
309f868a21
Make IP prefix configurable
...
This commit makes the IP prefix used to generate addresses configurable
to users. This can be useful if you would like to use a smaller range or
if your current setup is overlapping with the current range.
The current range is left as a default
2021-08-02 20:06:26 +01:00
Juan Font
6c903d4a2f
Fixed missing nodes cmd
2021-07-31 23:14:24 +02:00
Juan Font Alonso
4fb55e1684
Use 8080 as default port, like in the Kubernetes yamls
2021-07-30 17:07:19 +02:00
Juan Font Alonso
91bfb481c1
Fix identation
2021-07-30 16:42:26 +02:00