415 Commits

Author SHA1 Message Date
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
ohdearaugustin
ea3043cdcb cmd: Add error check for Persistent Flags 2021-07-25 16:26:15 +02:00
ohdearaugustin
04dffcc4ae Refactor cli commands 2021-07-25 15:14:09 +02:00
ohdearaugustin
3a07360b6e Add root cmd 2021-07-25 15:10:34 +02:00
ohdearaugustin
b97d6f71b1 Refactor version cmd 2021-07-25 15:09:53 +02:00
ohdearaugustin
4915902e04 Refactor server cmd 2021-07-25 15:09:33 +02:00
ohdearaugustin
d87a4c87cc Refactor routes cmd 2021-07-25 15:08:40 +02:00
ohdearaugustin
e56755fd67 Refactor preauthkeys cmd 2021-07-25 15:07:27 +02:00
ohdearaugustin
2862c2034b Refactor nodes cmd 2021-07-25 15:04:06 +02:00
ohdearaugustin
53185eaa9e Refactor namespaces cmd 2021-07-25 15:03:45 +02:00
ohdearaugustin
48ec51d166 Refactor cmdVersion to cli package 2021-07-25 02:02:05 +02:00
Aaron Bieber
69d77f6e9d Add a 'tls_letsencrypt_listen' config option
Currently the default (and non-configurable) Let's Encrypt listener will
bind to all IPs. This isn't ideal if we want to run headscale on a specific
IP only.

This also allows for one to set the listener to something other than
port 80. This is useful for OSs like OpenBSD which only allow root to
bind the lower port ranges (and don't have `setcap`) as we can now run
`headscale` as a non-privileged user while still using the baked in ACME
magic. Obviously this configuration would also require a reverse proxy
or firewall rule to redirect traffic. I attempted to outline that in the
README change.
2021-07-23 16:12:01 -06:00
Juan Font
1af9c11bdd
Merge pull request #54 from juanfont/delete-nodes
Implement node deletion
2021-07-19 16:18:09 +02:00
Juan Font Alonso
57c115e60a Fix linting error: 2021-07-17 11:17:42 +02:00
Juan Font Alonso
0f649aae8b Ask for confirmation before deleting 2021-07-17 11:09:42 +02:00
Ward Vandewege
9a24340bd4 Turn the combination of TLS-ALPN-01 and listen_addr on a port other than
443 into a warning, not an error, refs #53.
2021-07-16 22:02:05 -04:00
Juan Font Alonso
9ca2ae7fc5 Implemented delete nodes (#52) 2021-07-17 00:23:12 +02:00
Juan Font Alonso
7d46dfe012 Only load ACLs if a path is present 2021-07-11 15:10:11 +02:00
Juan Font Alonso
db20985b06 Show N/A in reusable when key is ephemeral 2021-07-11 13:14:25 +02:00
Juan Font
19443669bf Fixed linting issues 2021-07-04 13:33:00 +02:00
Juan Font
202d6b506f Load ACL policy on headscale startup 2021-07-04 13:24:05 +02:00
Juan Font Alonso
f5b8a3f710 Make all commands a plural word 2021-06-28 20:04:05 +02:00
Casey Marshall
fdcd3bb574
Fix nil dereference in nodes list command.
Fixes a nil pointer dereference observed when listing nodes that have
not yet connected.

```
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xb931a4]

goroutine 1 [running]:
github.com/juanfont/headscale/cmd/headscale/cli.glob..func8(0x13c93e0, 0xc0004c4220, 0x0, 0x2)
	/go/src/headscale/cmd/headscale/cli/nodes.go:74 +0x364
github.com/spf13/cobra.(*Command).execute(0x13c93e0, 0xc0004c41e0, 0x2, 0x2, 0x13c93e0, 0xc0004c41e0)
	/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:856 +0x2c2
github.com/spf13/cobra.(*Command).ExecuteC(0x13ca2e0, 0xc000497110, 0xe76416, 0x6)
	/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:960 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/cobra@v1.1.3/command.go:897
main.main()
	/go/src/headscale/cmd/headscale/headscale.go:89 +0x805
command terminated with exit code 2
```
2021-06-19 18:20:27 -05:00
Juan Font Alonso
0fcd92fcce Minor fix to help testing 2021-06-05 11:13:28 +02:00
Ward Vandewege
d1c3faae5f Remove superfluous test support code. Fix bug in node list cli command.
Add tests.
2021-05-23 09:55:15 -04:00
Ward Vandewege
41f6740ddd Add support for ephemeral nodes via a special type of pre-auth key. Add
tests for that feature.

Other fixes: clean up a few typos in comments. Fix a bug that caused the
tests to run four times each. Be more consistent in the use of log
rather than fmt to print errors and notices.
2021-05-22 20:18:29 -04:00
Juan Font Alonso
13b7b3ee8a Fix tests 2021-05-18 23:33:18 +02:00
Juan Font Alonso
5a42bace67 Use OS-independent paths for the abs method 2021-05-18 23:33:08 +02:00
Juan Font Alonso
460a23cf2b Check for abs/rel path in db_path 2021-05-19 01:28:47 +02:00
Juan Font Alonso
da9a07ddf3 Added tests for the sqlite-based config 2021-05-15 14:36:13 +02:00
Juan Font Alonso
216c6d85b2 Added support for sqlite as database backend 2021-05-15 14:32:26 +02:00
Ward Vandewege
b20b664353 Add a DestroyNamespace command and tests for the Namespace functions. 2021-05-09 11:12:39 -04:00
Juan Font Alonso
8ad366f977 Use JsonOutput in version too 2021-05-08 17:06:36 +02:00
Juan Font Alonso
abde7dddb7 More json output 2021-05-08 13:58:51 +02:00
Juan Font Alonso
3b34f715ce Adding support for JSON-formatted output 1/n 2021-05-08 13:28:22 +02:00
Juan Font
13f809be87
Merge pull request #19 from juanfont/node-cmd-improve
List nodes in namespace + register under node command
2021-05-02 23:04:46 +02:00
Juan Font Alonso
45e9001787 Register cmd under node 2021-05-01 20:05:10 +02:00
Juan Font Alonso
c71c13366f Minor fix 2021-05-01 20:04:03 +02:00
Juan Font Alonso
404fee8361 Added list node functionality 2021-05-01 20:00:25 +02:00
Juan Font
8198d2f8ed
Merge pull request #18 from cure/add-actions
Add a basic CI workflow with github actions
2021-04-30 10:45:11 +02:00
Juan Font Alonso
68c21faf64 Check persistnt flag errors 2021-04-30 09:55:39 +02:00
Ward Vandewege
491fb0adb3 Fix a few linter errors. 2021-04-29 21:14:50 -04:00
Juan Font Alonso
b83318bfb3 Namespace is now a flag for all the commands 2021-04-30 00:23:26 +02:00
Juan Font Alonso
7646bd8fd4 CLI stuff should be in the cmd/ path 2021-04-28 16:55:29 +02:00
Juan Font Alonso
77e5255fdd Move the CLI functiontionality to the CLI package 2021-04-28 16:15:45 +02:00
Ward Vandewege
f5010fd75b Add test for our config validation rules. 2021-04-26 20:30:06 -04:00
Ward Vandewege
37601f6b4d Add a very simple test. 2021-04-26 19:22:28 -04:00
Ward Vandewege
6aedc1111b Add a Makefile with a few targets. The default is 'build'. The build
target calls the new version-at-commit.sh script which will
automatically populate the version variable inside the Headscale binary.

Once we start tagging releases on the git tree, that will come in handy.

The Makefile also has a 'test' target (does nothing yet, no tests yet)
and a 'dev' target, which runs linters, tests, and finally builds.
2021-04-25 10:31:52 -04:00
Ward Vandewege
f7c7b4873a Address a bunch of golangci-lint warnings. 2021-04-24 11:41:29 -04:00
Ward Vandewege
426b4fd98a Add support for automatic TLS certificates via Let's Encrypt. Add a
configuration reference to the README.md file.
2021-04-23 22:55:01 -04:00
Ward Vandewege
1b30874cf8 Check for errors from the Serve() function. 2021-04-23 17:18:14 -04:00
Ward Vandewege
252c68c50a Add HTTPS support for the web endpoint with manually configured
certificate/key files.
2021-04-23 17:18:00 -04:00
Ward Vandewege
c5a3d0b01c In absPath, skip empty paths. 2021-04-23 16:42:27 -04:00
Ward Vandewege
683b151f19 If the configuration file contains relative paths (e.g. in the values
for private_key_path or derp_map_path), interpret them as relative to
the directory where the config.json file was read from.
2021-04-22 21:10:50 -04:00
Juan Font Alonso
9c40e829ec Create preauthkeys kinda working (not usable yet) 2021-04-23 00:40:42 +02:00
Juan Font Alonso
176eea4a84 WIP on PreAuthKeys 2021-04-23 00:25:01 +02:00
Ward Vandewege
a71387f9d2 Add additional locations to look for the config.json file:
/etc/headscale and $HOME/.headscale
2021-04-21 17:33:09 -04:00
Juan Font Alonso
1fad8e6e5b Added basic routes functionality 2021-03-14 11:38:42 +01:00
Juan Font Alonso
fc13f74851 Minor output fix & README improvements 2021-02-28 20:29:31 +01:00
Juan Font Alonso
b7655b1f68 Initial multi-user support using namespaces 2021-02-28 00:58:09 +01:00
Juan Font Alonso
b1d06f3ffd headscale now has a CLI - registration of machines occurs there 2021-02-21 01:30:03 +01:00
Juan Font Alonso
a6100dc4d0 Load DERP servers from file 2021-02-20 23:57:06 +01:00
Juan Font Alonso
1ddb4febe8 Embedding frontend via Pkger 2020-07-04 13:38:58 +02:00
Juan Font Alonso
8187085e39 Added missing cmd 2020-06-21 12:33:43 +02:00