Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Operator node reachability scanner #506

Merged
merged 7 commits into from
Apr 30, 2024
Merged

Operator node reachability scanner #506

merged 7 commits into from
Apr 30, 2024

Conversation

pschork
Copy link
Contributor

@pschork pschork commented Apr 20, 2024

The EigenDA Node Reachability Scanner allows Operators to initiate port scans from the EigenDA backend to validate e2e reachability.

┌─────────────────────────────────────────────┐               ┌─────────────────────────────────────────────┐
│                                             │               │                                             │
│            EigenDA Operator Node            │               │            EigenDA Operator Node            │
│                                             │               │                                             │
│                                             │               │                                             │
└───────┬────────▲────────────────▲───────────┘               └───────┬─────────────────────────────────────┘
┌───────┴────────┴────────────────┴───────────┐               ┌───────┴─────────────────────────────────────┐
│       Operator Firewall Allowing 32005      │               │       Operator Firewall Blocking 32005      │
└───────┬────────┬────────────────┬───────────┘               └───────┬─────────────────────────────────────┘
        │        │                │                                   │        X                X
    PortCheck    │                │                               PortCheck    │                │
     Request     │                │                                Request     │                │
                 │                │                                            │                │
        │        │                │                                   │        │                │
        │        │                │                                   │        │                │
        │        │                │                                   │        │                │
        │        │                │                                   │        │                │
        │  Reachability       Dispersal                               │  Reachability       Dispersal
        │      Check           Request                                │      Check           Request
        │      32005            32005                                 │      32005            32005
┌───────┴────────┴────────────────┴───────────┐               ┌───────┴────────┴────────────────┴───────────┐
│                  Nat Gateway                │               │                  Nat Gateway                │
└───────┬────────┬────────────────┬───────────┘               └───────┬────────┬────────────────┬───────────┘
┌───────┼────────┼────────────────┼───────────┐               ┌───────┼────────┼────────────────┼───────────┐
│       │        │                │           │               │       │        │                │           │
│       ▼        │                │           │               │       ▼        │                │           │
│ ┌──────────────┴────┐┌──────────┴────────┐  │               │ ┌──────────────┴────┐┌──────────┴────────┐  │
│ │                   ││                   │  │               │ │                   ││                   │  │
│ │      dataapi      ││     disperser     │  │               │ │      dataapi      ││     disperser     │  │
│ │                   ││                   │  │               │ │                   ││                   │  │
│ └───────────────────┘└───────────────────┘  │               │ └───────────────────┘└───────────────────┘  │
│                EigenDA VPC                  │               │                EigenDA VPC                  │
└─────────────────────────────────────────────┘               └─────────────────────────────────────────────┘

@pschork pschork requested review from siddimore, dmanc and jianoaix April 20, 2024 01:45
Copy link
Contributor

@jianoaix jianoaix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just add an API to dataapi for this check? It shouldn't need another server and new interface under api/

scanner/metrics.go Outdated Show resolved Hide resolved
scanner/scanner.go Outdated Show resolved Hide resolved
scanner/scanner.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ian-shim ian-shim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments:

  1. Can we move this under tools/ directory?
  2. I think it should have some automated testing

scanner/grpc/server.go Outdated Show resolved Hide resolved
scanner/grpc/server.go Outdated Show resolved Hide resolved
scanner/grpc/server.go Outdated Show resolved Hide resolved
api/proto/scanner/scanner.proto Outdated Show resolved Hide resolved
scanner/grpc/server.go Outdated Show resolved Hide resolved
@pschork pschork force-pushed the pschork/scanner branch 2 times, most recently from 8ce4434 to e2236b4 Compare April 25, 2024 17:02
@jianoaix
Copy link
Contributor

Can we just add an API to dataapi for this check? It shouldn't need another server and new interface under api/

@pschork

@pschork pschork force-pushed the pschork/scanner branch 3 times, most recently from e9eb1bd to fdc52a8 Compare April 26, 2024 01:13
Copy link
Contributor

@jianoaix jianoaix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@@ -586,6 +599,36 @@ func (s *server) FetchDeregisteredOperators(c *gin.Context) {
})
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need another API which takes the socket as parameter? That could be used by CLI before registration.

This OperatorPortCheck will still be useful for creating a metric at Node to check reachability periodically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding generic socket port check opens the door to it being abused as a general purpose penetration testing service. Forcing operator_id avoids a swath of potential attacks on the endpoint/dataapi in general.

@pschork pschork force-pushed the pschork/scanner branch 2 times, most recently from aba080f to 2734155 Compare April 26, 2024 20:46
@pschork
Copy link
Contributor Author

pschork commented Apr 26, 2024

200 OK

curl -X 'GET' \
  'https://dataapi-preprod-holesky.eigenda.xyz/api/v1/operators-info/port-check?operator_id=0xa96bfb4a7ca981ad365220f336dc5a3de0816ebd5130b79bbc85aca94bc9b6ab' \
  -H 'accept: application/json'
{
  "operator_id": "0xa96bfb4a7ca981ad365220f336dc5a3de0816ebd5130b79bbc85aca94bc9b6ab",
  "disperser_socket": "23.93.76.39:32005",
  "retriever_socket": "23.93.76.39:32004",
  "disperser_online": true,
  "retriever_online": true
}

404 Not Found

curl -X 'GET' \
  'https://dataapi-preprod-holesky.eigenda.xyz/api/v1/operators-info/port-check?operator_id=asdf' \
  -H 'accept: application/json'
{
"error": "not found"
}

@pschork pschork marked this pull request as ready for review April 26, 2024 21:29
@pschork pschork force-pushed the pschork/scanner branch 3 times, most recently from 272d5f8 to 1063b0a Compare April 26, 2024 21:41
Copy link
Contributor

@jianoaix jianoaix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! We can add a metric to node based on this API

disperser/dataapi/docs/swagger.yaml Outdated Show resolved Hide resolved
disperser/dataapi/docs/swagger.yaml Outdated Show resolved Hide resolved
@pschork pschork force-pushed the pschork/scanner branch 2 times, most recently from 2e697bd to 07e5a6f Compare April 27, 2024 00:19
pschork added 3 commits April 29, 2024 16:54
…rt scans from the EigenDA backend to validate e2e reachability.

```
┌─────────────────────────────────────────────┐               ┌─────────────────────────────────────────────┐
│                                             │               │                                             │
│            EigenDA Operator Node            │               │            EigenDA Operator Node            │
│                                             │               │                                             │
│                                             │               │                                             │
└───────┬────────▲────────────────▲───────────┘               └───────┬─────────────────────────────────────┘
┌───────┴────────┴────────────────┴───────────┐               ┌───────┴─────────────────────────────────────┐
│       Operator Firewall Allowing 32005      │               │       Operator Firewall Blocking 32005      │
└───────┬────────┬────────────────┬───────────┘               └───────┬─────────────────────────────────────┘
        │        │                │                                   │        X                X
    PortCheck    │                │                               PortCheck    │                │
     Request     │                │                                Request     │                │
      32005      │                │                                 32005      │                │
        │        │                │                                   │        │                │
        │        │                │                                   │        │                │
        │        │                │                                   │        │                │
        │        │                │                                   │        │                │
        │  Reachability       Dispersal                               │  Reachability       Dispersal
        │      Check           Request                                │      Check           Request
        │      32005            32005                                 │      32005            32005
┌───────┴────────┴────────────────┴───────────┐               ┌───────┴────────┴────────────────┴───────────┐
│                  Nat Gateway                │               │                  Nat Gateway                │
└───────┬────────┬────────────────┬───────────┘               └───────┬────────┬────────────────┬───────────┘
┌───────┼────────┼────────────────┼───────────┐               ┌───────┼────────┼────────────────┼───────────┐
│       │        │                │           │               │       │        │                │           │
│       ▼        │                │           │               │       ▼        │                │           │
│ ┌──────────────┴────┐┌──────────┴────────┐  │               │ ┌──────────────┴────┐┌──────────┴────────┐  │
│ │                   ││                   │  │               │ │                   ││                   │  │
│ │      dataapi      ││     disperser     │  │               │ │      dataapi      ││     disperser     │  │
│ │                   ││                   │  │               │ │                   ││                   │  │
│ └───────────────────┘└───────────────────┘  │               │ └───────────────────┘└───────────────────┘  │
│                EigenDA VPC                  │               │                EigenDA VPC                  │
└─────────────────────────────────────────────┘               └─────────────────────────────────────────────┘
```
Fix tests
@pschork pschork merged commit 979707d into master Apr 30, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants