Juan Font Alonso
dec51348e6
Minor status change
2022-06-20 20:29:42 +02:00
Juan Font Alonso
dedeb4c181
Remove Gin from the Registration handler
2022-06-20 12:30:41 +02:00
Juan Font Alonso
367da0fcc2
Remove Gin from simple endpoints for TS2019
2022-06-17 16:48:04 +02:00
Anton Schubert
34be10840c
add ability to set randomizeClientPort
2022-06-09 21:26:40 +02:00
Kristoffer Dalby
0676aa11a9
Merge branch 'main' into db-error-handling
2022-05-31 10:18:13 +02:00
Kristoffer Dalby
a09633e859
Check errors of more database calls
2022-05-30 15:39:24 +02:00
Kristoffer Dalby
9175aca094
Merge branch 'main' into rename-fixess
2022-05-30 15:29:50 +02:00
Kristoffer Dalby
ff5f31b87e
Disable logtail for clients
2022-05-30 14:52:50 +02:00
Kristoffer Dalby
802eb931d1
Make sure givenname is set for preauthkeys
2022-05-17 22:02:18 +02:00
Kristoffer Dalby
5fa3016703
Generate unique givennames for hosts joining (and debug added)
2022-05-16 20:32:38 +02:00
Kristoffer Dalby
8504d0d8ba
Move todo to correct file
2022-04-24 21:12:45 +01:00
Kristoffer Dalby
6e2768097a
Rename name -> hostname, nickname -> givenname
2022-04-24 20:54:38 +01:00
hdhoang
52fd13bfc4
Fix labels cardinality error when registering unknown pre-auth key
2022-03-21 15:49:14 +07:00
Mevan Samaratunga
082a852c5e
fixed linting recommendation
2022-03-10 10:40:20 -05:00
Mevan Samaratunga
af081e9fd3
fixed lint errors
2022-03-10 10:22:21 -05:00
Mevan Samaratunga
8b5e8b7dfc
Refresh expired machine on re-auth - closes #489
2022-03-10 08:59:28 -05:00
e-zk
c06689dec1
fix: make register html/template consistent with other html
...
- makes the html/template for /register follow the same formatting
as /apple and /windows
- adds a <title> element
- minor change for consistency's sake
2022-03-08 18:34:46 +10:00
Adrien Raffin-Caboisse
41efe98953
fix: apply fmt and fix missing name changes
2022-03-07 23:20:30 +01:00
Adrien Raffin-Caboisse
f19c048569
fix: change normalization function name
2022-03-07 22:55:54 +01:00
Adrien Raffin-Caboisse
6cc8bbc24f
feat(api): add normalisation at machine register step
2022-03-07 22:46:29 +01:00
Kristoffer Dalby
ef422e6988
Protect against expiry nil
2022-03-02 07:29:56 +00:00
Kristoffer Dalby
5e92ddad43
Remove redundant caches
...
This commit removes the two extra caches (oidc, requested time) and uses
the new central registration cache instead. The requested time is
unified into the main machine object and the oidc key is just added to
the same cache, as a string with the state as a key instead of machine
key.
2022-02-28 22:42:30 +00:00
Kristoffer Dalby
54cc3c067f
Implement new machine register parameter
2022-02-28 16:34:50 +00:00
Kristoffer Dalby
469551bc5d
Register new machines needing callback in memory
...
This commit stores temporary registration data in cache, instead of
memory allowing us to only have actually registered machines in the
database.
2022-02-28 08:06:39 +00:00
Kristoffer Dalby
ecc26432fd
Fix excessive replace
2022-02-27 18:48:12 +01:00
Kristoffer Dalby
acb945841c
Generalise registration for pre auth keys
2022-02-27 18:42:15 +01:00
Kristoffer Dalby
eda0a9f88a
Lock allocation of IP address
...
current logic is not safe as it will allow an IP that isnt persisted to
the DB to be given out multiple times if machines joins in quick
succession.
This adds a lock around the "get ip" and machine registration and save
to DB so we ensure thiis isnt happning.
Currently this had to be done three places, which is silly, and outlined
in #294 .
2022-02-24 13:18:18 +00:00
Adrien Raffin-Caboisse
9cedbbafd4
chore(all): update some files for linter
2022-02-17 09:32:51 +01:00
Csaba Sarkadi
1a6e5d8770
Add support for multiple IP prefixes
2022-01-16 14:18:22 +01:00
wakeful-cloud
1c7cb98042
Template Fixes
2021-12-22 19:43:53 -07: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
ff8c961dbb
Make sure comparison of nodekey is on the same format
2021-11-28 08:23:45 +00:00
Kristoffer Dalby
59aeaa8476
Ensure we always have the key prefix when needed
2021-11-27 20:25:12 +00: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
cec1e86b58
Add missing request arguemnt
2021-11-24 12:16:56 +00:00
Kristoffer Dalby
dcbf289470
Rename idKey to machineKey to keep consistency
2021-11-24 12:15:55 +00:00
Kristoffer Dalby
fdd64d98c8
Add missing iff to handle expired preauthkey machines
2021-11-24 12:15:32 +00:00
Kristoffer Dalby
68dc2a70db
Update neighbours if node is expired or refreshed
...
In addition, only pass the map of registered and not expired nodes to
clients.
2021-11-22 19:51:16 +00:00
Kristoffer Dalby
caf1b1cabc
Fix typo
2021-11-22 19:35:24 +00:00
Kristoffer Dalby
021c464148
Add cache for requested expiry times
...
This commit adds a sentral cache to keep track of clients whom has
requested an expiry time, but were we need to keep hold of it until the
second request comes in.
2021-11-22 19:32:52 +00:00
Kristoffer Dalby
e600ead3e9
Make sure nodes can reauthenticate
...
This commit fixes an issue where nodes were not able to reauthenticate.
2021-11-22 19:32:11 +00:00
Kristoffer Dalby
1687e3b03f
Removed unused parameter
2021-11-21 21:29:27 +00:00
Kristoffer Dalby
c2393685f1
Remove expiry update in expiry, we dont want to extend it just because they _try_ to connect
2021-11-21 21:14:40 +00:00
Kristoffer Dalby
fd5f42c2e6
Move handle expired machine to the end of registration
2021-11-21 21:14:13 +00:00
Kristoffer Dalby
bda2d9c3b0
Remove unused param
2021-11-21 14:00:48 +00:00
Kristoffer Dalby
c4ecc4db91
Simplify control flow in RegistrationHandler
...
This commits tries to dismantle the complicated "if and or" in the
RegistrationHandler by factoring out the "is Registrated" into a root
if.
This, together with some new comments, should hopefully make it a bit
easier to follow what is happening in all the different cases that needs
to be handled when a Node contacts the registration endpoint.
2021-11-21 13:59:24 +00:00
Kristoffer Dalby
8ccc51ae57
Remove special case for authkey
...
We no longer have weird expire behaviour, so we dont need this case
2021-11-21 13:45:19 +00:00
Kristoffer Dalby
9aac1fb255
Remove expiry logic, this needs to be redone
2021-11-19 09:02:29 +00:00
Kristoffer Dalby
106b1e7e8d
Create constants for other reg methods
2021-11-18 17:51:54 +00:00