Commit graph

61 commits

Author SHA1 Message Date
Elle Mouton
0503cfd433
session_rpcsever: thread context through 2025-01-13 07:03:28 +02:00
bitromortac
5129b95fd5
rules+rpcserver: handle unknown rules
This is to tolerate unknown rules sent from the autopilot for the
`autopilot features` command.

Otherwise, when trying to register a feature that requires an upgrade, a
more user friendly error is returned.
2024-04-25 18:19:48 +02:00
bitromortac
9e20dc4078
rpcserver: marshal privacy flags 2024-04-25 14:49:47 +02:00
bitromortac
8248f2650b
rpcserver: accept and send privacy flags
For autopilot session registration, we accept default recommendations
from autopilot in order to weaken privacy obfuscation for the requested
features. Default privacy flags are supplied by ListFeatures and by
flags passed to the AddAutopilotSession request.

Privacy flags are ORed to combine to the weakest aggregated privacy
obfuscation in order to allow for multiple feature registration. In
order to preserve high privacy settings for a feature it should be
registered in an isolated manner.
2024-04-25 14:49:46 +02:00
bitromortac
76333beaae
rpcserver: show privacy flags in ListFeatures 2024-04-25 14:49:46 +02:00
bitromortac
c961472789
firewall: obfuscate config depending on flags 2024-04-25 14:49:46 +02:00
bitromortac
1636bb2bd6
firewall+rules: map with privacy flags
We change the rule mapping to accept the newly added privacy flags. Peer
and channel restrictions can be controlled with privacy flags.
2024-04-25 14:49:46 +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
eb58941e76
rpcserver+firewall: obfuscate configuration
We obfuscate pubkeys, channel points and ids entered in configurations.

The channel id lengths for different block heights can be checked with:
```python
len(str(1 << 40 | 2923 << 16 | 30))
len(str(10_000_000 << 40 | 2923 << 16 | 30))
```
2023-09-05 13:03:58 +02:00
bitromortac
6e30ecaa69
litcli+rpcserver: session registration with config
We add command line flags to litcli in order to be able to submit
feature configurations when registering a session.
2023-09-01 08:03:21 +02:00
bitromortac
1049de549e
litrpc+server: show cfg in ListAutopilotFeatures
We pass on default configuration to litrpc in order to display them in
the list features call.
2023-09-01 08:03:21 +02:00
Elle Mouton
7bb4d3be5f
session_rpcserver: pass all known pairs to RealToPseudo
In this commit, we keep track of all known privacy map pairs for a
session along with any new pairs to be persisted.
2023-08-31 16:56:59 +02:00
Elle Mouton
8b5289953a
rules: let RealToPseudo take in a PrivacyMapReader
This commit expands the RealToPseudo methods to take in a privacy map db
reader. This allows the methods to check if the privacy map db already
contains an entry for a "real" string before generating a new one.

For now, only an empty PrivacyMapReader is ever provided to the
RealToPseudo call. This will be changed in the following commit.
2023-08-31 16:56:59 +02:00
Elle Mouton
5882a21df8
multi: allow client to link autopilot sessions 2023-08-30 12:34:29 +02:00
Elle Mouton
60c10bd91d
multi: use group ID for PrivacyMapConversion query 2023-08-30 12:34:29 +02:00
Elle Mouton
bd9a99c5d4
multi: allow querying actions by group ID 2023-08-30 12:34:29 +02:00
Elle Mouton
73110b6472
multi: give firewallDB access to session ID index 2023-08-30 12:34:29 +02:00
Elle Mouton
477a5115dd
session_rpcserver: marshal new Session fields
Marshal the new Session fields into the proto Session struct.
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
c9c396d89d
autopilotserver: update to send linked session info
Update the autopilot server client to send the new session linking
fields if they are provided. Currently, they are not yet provided.
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
e0747b5354
litrpc+rpcserver: add firewall service comments and cli directives 2023-03-19 17:41:04 +02:00
Elle Mouton
c3d9338365
multi: use URIs in session macaroon instead of perms
Also includes an itest to assert that sessions work with very large
headers.
2023-02-13 19:33:55 +02:00
Elle Mouton
ab347dd6f1
multi: add privacy mapper conversion helper 2023-01-27 06:47:13 +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
164ade0e8c
multi: expose Actions
This commit adds a Lit grpc service and uses it to expose a ListActions
method. Litcli is also updated to make use of this method.
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
46745ce892
session_rpcserver: marshal RevokedAt field 2023-01-10 10:43:26 +02:00
Elle Mouton
fbe32230b1
session_rpcserver: nil check on MacaroonRecipe 2022-12-05 09:00:15 +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
Elle Mouton
00357fd2d1
session_rpcserver: dedup session permissions 2022-12-01 13:08:50 +02:00
Elle Mouton
beb2546f9d
multi: allow custom session with all read-only perms
In this commit, a special case is added to the creation of a custom
session to allow the user to specify custom URIs as well as the
permissions for all read-only endpoints.
2022-11-29 12:44:59 +02:00
Elle Mouton
15cd1bdef9
multi: support regex URIs
With this commit, a user can now specify a regex when specifying custom
permissions for an LNC session. This regex will be used to select
permissions for URIs that match the regex.
2022-11-29 12:32:14 +02:00
Elle Mouton
d41f796f8e
multi: move permissions' manager to perms folder 2022-11-22 17:44:59 +07:00
Elle Mouton
3864ebb6eb
session_rpcserver: allow sessions with custom permissions 2022-10-26 09:26:09 +02:00
Elle Mouton
c2eb98db38
multi: add PermissionsManager
In this commit, a new PermissionsManager is added. It handles all the
active permissions that Lit has access to. This moves us away from using
global variables for permission lists. This change might seem overkill
on its own but hugely simplifies the permission management once we add
lnd subserver permissions.
2022-09-01 13:04:06 +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
Elle Mouton
8777794bcb
session_rpcserver: add session expiry as macaroon caveat
Bake the session expiry into the macaroon as a caveat. This will allow
the client of a session to get an idea of how long they will be able to
use the session for.
2022-06-13 12:52:09 +02:00
Elle Mouton
6ebab93063
multi: deprecate UIPassword session type 2022-06-07 11:47:01 +02:00
Elle Mouton
1aee59426e
multi: extract sessionRPCserver stuff into its own struct
Let sessionRpcServer handle the session db and session server instead of
LightningTerminal handling those direclty. Then start the
sessionRpcServer as if it was a subserver like loop/pool.
2022-06-05 10:51:32 +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