Commit graph

46 commits

Author SHA1 Message Date
zhoufanjin
a97e73ee2c refactor: using slices.Contains to simplify the code
Signed-off-by: zhoufanjin <shuangcui@live.cn>
2025-01-09 15:38:45 +08:00
bitromortac
66e6d63349
firewall: obfuscate ConnectPeer
Also adds a privacy flag that controls obfuscation of network addresses.
2024-07-02 18:21:42 +02:00
bitromortac
ef84753f6b
firewall: obfuscate ClosedChannels
For closes we need to know the close type and settle balances to know
which peers should be avoided in the future.
2024-07-02 18:21:42 +02:00
bitromortac
772b62689f
session: add debug output to flags error 2024-07-01 11:36:00 +02:00
bitromortac
1e83df2225
session: add privacy flags to session tlvs
Privacy flags are stored within the session.
2024-04-25 14:49:45 +02:00
bitromortac
a4c1f59f86
session: add privacy flag type
We add a privacy flag type that can be used to serialize/deserialize
from a uint64. This is the source for which privacy flags are
available.
2024-04-25 14:49:45 +02:00
bitromortac
7011706e74
session: fix linter issues 2024-04-25 14:49:45 +02:00
Oliver Gugger
322a96133d
multi: fix linter issues 2023-10-03 19:52:02 +02:00
Elle Mouton
3b5007c399
session: ensure past linked sessions are not active
This commit adds logic to the CreateSession method that checks that a
all the past sessions in a linked set are no longer active.
2023-08-30 12:34:29 +02:00
Elle Mouton
71cac8672f
session: add a CheckSessionGroupPredicate method
This method can be used to check that each session in a group passes for
a given predicate.
2023-08-30 12:34:29 +02:00
Elle Mouton
cc95a01923
session: add GetGroupID and GetSessionIDs methods
This commit adds new getters: `GetGroupID` and `GetSessionIDs` to the
session store which can be used to query the newly added indexes to get
the associated group ID for a session ID or the associated set of
session IDs for a group ID.
2023-08-30 12:34:28 +02:00
Elle Mouton
e90df06d58
session: migration to populate group ID to session ID indexes
This commit adds a migration to the session store to back-fill the new
session ID to group ID and group ID to session IDs indexes.
2023-08-30 12:34:28 +02:00
Elle Mouton
a802759f4e
session: add session ID to group ID indexes
This commit adds two new indexes to the session store. One from session
ID to group ID and one from groupID to a set of session IDs. This commit
only adds the new logic and starts writing the the new indexes from the
`StoreSession` method. The next commit will add a migration to back-fill
the new indexes.
2023-08-30 12:34:28 +02:00
Elle Mouton
4bd8a5c03a
session: add GroupID field to Session
Add the new `GroupID1` field to the `Session` struct and ensure that the
new fields are properly serialised and deserialised.  The `GroupID` is
the ID of the first Session in a set of linked sessions.
2023-08-30 11:46:33 +02:00
Elle Mouton
c8b78bd10d
session: add new ID-to-key index
This commit does a few things:

1. Instead of deriving IDs using the first 4 bytes of the session's
   serialised local pub key, we instead use bytes [1:5] in order to skip
   the first byte which is either 0x02 or 0x03. This results in a
   greater entropy set.
2. We also add a new index from ID to key and we write to this index
   each time a new session is added.
3. We add a `ReserveNewSessionID` method to the session store which will
   grind through private keys until it finds one that does not clash
   with the current ID set.
4. A migration is added to back-fill the ID-to-key index. If any old
   sessions are found that _do_ have a colliding ID, they are sorted by
   created time and all but the newest session is revoked. Only an entry
   for the newest session will be added to the ID-to-key index.
2023-08-30 11:46:33 +02:00
Elle Mouton
d3a262600f
session: separate methods for creating vs updating a session 2023-08-25 16:02:13 +02:00
Elle Mouton
92575c8ed7
session: update the session Store interface 2023-08-25 14:20:12 +02:00
Elle Mouton
3b67325360
multi: implement lit-autopilot rpc server 2023-01-27 06:47:13 +02:00
Elle Mouton
f9ffc0cdef
session: add GetSession method 2023-01-27 06:47:13 +02:00
Elle Mouton
5255e952d8
session: add WithPrivacy to Session type 2023-01-27 06:47:13 +02:00
Elle Mouton
4639e7e5ba
session+rpcserver: add feature config to session type 2023-01-27 06:47:13 +02:00
Elle Mouton
b59888cfa4
multi: let request logger persist Actions 2023-01-27 06:47:12 +02:00
Elle Mouton
78c996a7a1
multi: add Session ID to struct
This commit adds an ID to the Session struct. The ID is not persisted
but is instead derived from the macaroon used for the session.
2023-01-27 06:47:10 +02:00
Elle Mouton
0f4f9f72bb
session: change revoked at to tlv type 16
In this commit, we change the tlv type number for the RevokedAt field to
16 and reserve types 14 and 15 for future use.
2023-01-11 09:19:39 +02:00
Elle Mouton
b73c3699d6
session: add RevokedAt field
This commit adds a RevokedAt field to the Session structure and sets the
value of the field to the current time when RevokeSession is called.
2023-01-10 10:43:26 +02:00
Elle Mouton
0311de1cb7
multi: change account session type and reserve type 4
In this commit, the Account session type is changed to be type 5 in
both the session proto and in the persisted Session. This is done so
that type 4 can be reserved for future use.
2022-12-06 12:50:27 +02:00
Oliver Gugger
fc4f4a4cca
multi: add account based LNC sessions 2022-12-02 10:10:02 +01:00
Oliver Gugger
cd741091be
session+accounts: add RPC server 2022-12-02 10:06:51 +01:00
Oliver Gugger
c3cad46aa2
multi: fix linter issues 2022-10-19 10:57:18 +02:00
Elle Mouton
d5c26045f7
multi: add deadline for first connection of new LNC conn
In this commit, we add a deadline for the initial connection of an LNC
connection. So with this, the user is forced to use their pairing phrase
within a certain time frame. After this initial connection, future
connections are made with the second handshake version meaning that the
pairing phrase is rendered useless. By adding a time limit to the time
in which a user can use their pairing phrase, we reduce the risk created
by the users pairing phrase being leaked. The default time limit is set
to 10 minutes but can be customsed with the new `firstlncconndeadline`
flag.
2022-08-23 09:31:18 +02:00
Elle Mouton
d23073f8b0
litrpc+session: add CreatedAt member to Session 2022-08-18 18:37:44 +02:00
Oliver Gugger
1444e7a180
multi: bump all dependencies to latest versions 2022-06-24 16:18:14 +02:00
Oliver Gugger
472d8f4602
multi: persist remote static key for handshakev2
This commit re-enables the second handshake for LNC.
2022-06-23 10:32:43 +02:00
Oliver Gugger
30d13ff7bb
Revert "multi: persist remote static key for handshakev2"
This reverts commit 31713c6e3d.
We will bump LNC to the latest version once the Terminal Web UI is ready
to persist the keys as well.
2022-04-20 14:42:26 +02:00
Elle Mouton
31713c6e3d
multi: persist remote static key for handshakev2
In this commit, we update the go mod to point to the version of LNC that
contains the logic for handshake version 2. This requires that we pass
in a call back that LNC can call to persist the remote static key once
it is received. This then needs to be provided each time we start up the
session again.
2022-04-19 09:49:08 +02:00
Oliver Gugger
46e9424bdf
Revert "multi: persist remote static key for handshakev2"
This reverts commit a2f1245020.
PR #342 was merged by accident before being fully reviewed and before
all dependent PRs were merged. Reverting.
2022-03-21 21:59:43 +01:00
Elle Mouton
a2f1245020
multi: persist remote static key for handshakev2
In this commit, we update the go mod to point to the version of LNC that
contains the logic for handshake version 2. This requires that we pass
in a call back that LNC can call to persist the remote static key once
it is received. This then needs to be provided each time we start up the
session again.
2022-03-21 14:18:40 +02:00
Oliver Gugger
5d4ae278ef
multi: add super mac validator to proxy 2022-02-17 15:00:41 +01:00
Oliver Gugger
1ff2411cfe
session: add super macaroon root key ID
Whenever we bake a supermacaroon, we want it to be recognizable as such.
For that we use the 64bit unsigned integer that is used as the
macaroon's storage ID (or root key ID) and set the first 4 bytes to a
specific value that we can detect later on.
2022-02-15 10:41:43 +00:00
Elle Mouton
72faf765a1
session: store macaroon recipe instead of macaroon
In this commit, the `macaroon` field of `Session` is removed and instead
a `MacaroonRecipe` is added.
2022-02-15 10:40:15 +00:00
Elle Mouton
511be4fab9
session: add 2 min mailbox ping
Ensure that the mailbox grpc connection sends a ping every 2 mins to
ensure that the connection remains open.
2022-02-08 12:14:54 +02:00
Oliver Gugger
954daad019
Merge pull request #300 from ellemouton/revokeExpiredSessions
multi: revoke expired sessions
2022-02-08 09:49:21 +01:00
Oliver Gugger
ecc0794da7
tools+session: run make fmt 2022-01-19 14:29:30 +01:00
Elle Mouton
259ad262b1 multi: add quit channel to mailboxSession
Add a quit channel to mailboxSession that will be closed on session
close. This is also returned from the StartSession function so that, in
a future commit, the channel can be listened on.
2022-01-17 17:13:58 +02:00
Oliver Gugger
0044b40c1c
session: fix uint64 overflow for dates in far future
This commit fixes an overflow that was caused by serializing the default
date the UI sends (Jan 1st, 9999) to unix nanoseconds.
2021-11-24 13:44:27 -05:00
Oliver Gugger
f6568ab8e8
session: add session package 2021-11-24 13:44:25 -05:00