Skip to content

Commit 451a6a3

Browse files
authored
Remove certificate (#48)
## 📝 Summary Removes TLS from ordeflow proxy closes #45 There is only 1 issue: since OF proxy now does not know certificate it can't serve "landing page". Should it be served by OF proxy or by other external system? @bakhtin ## ⛱ Motivation and Context <!--- Why is this change required? What problem does it solve? --> ## 📚 References <!-- Any interesting external links to documentation, articles, tweets which add value to the PR --> --- ## ✅ I have run these commands * [ ] `make lint` * [ ] `make test` * [ ] `go mod tidy`
1 parent 31ac01f commit 451a6a3

File tree

9 files changed

+88
-465
lines changed

9 files changed

+88
-465
lines changed

cmd/receiver-proxy/main.go

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
import (
44
"context"
5-
"errors"
65
"log"
76
"net/http"
87
"net/http/pprof"
@@ -22,11 +21,7 @@ import (
2221
const (
2322
flagUserListenAddr = "user-listen-addr"
2423
flagSystemListenAddr = "system-listen-addr"
25-
flagCertListenAddr = "cert-listen-addr"
2624
flagMaxUserRPS = "max-user-requests-per-second"
27-
28-
flagCertPath = "cert-path"
29-
flagCertKeyPath = "cert-key-path"
3025
)
3126

3227
var flags = []cli.Flag{
@@ -43,12 +38,6 @@ var flags = []cli.Flag{
4338
Usage: "server to receive orderflow from BuilderNet network",
4439
EnvVars: []string{"SYSTEM_LISTEN_ADDR"},
4540
},
46-
&cli.StringFlag{
47-
Name: flagCertListenAddr,
48-
Value: "127.0.0.1:14727",
49-
Usage: "address to listen on for orderflow proxy serving its SSL certificate on /cert",
50-
EnvVars: []string{"CERT_LISTEN_ADDR"},
51-
},
5241

5342
// Connections to Builder, BuilderHub, RPC and block-processor
5443
&cli.StringFlag{
@@ -108,30 +97,6 @@ var flags = []cli.Flag{
10897
EnvVars: []string{"MAX_USER_RPS"},
10998
},
11099

111-
// Certificate config
112-
&cli.DurationFlag{
113-
Name: "cert-duration",
114-
Value: time.Hour * 24 * 365,
115-
Usage: "generated certificate duration",
116-
EnvVars: []string{"CERT_DURATION"},
117-
},
118-
&cli.StringSliceFlag{
119-
Name: "cert-hosts",
120-
Value: cli.NewStringSlice("127.0.0.1", "localhost"),
121-
Usage: "generated certificate hosts",
122-
EnvVars: []string{"CERT_HOSTS"},
123-
},
124-
&cli.StringFlag{
125-
Name: flagCertPath,
126-
Usage: "path where to store the generated certificate",
127-
EnvVars: []string{"CERT_PATH"},
128-
},
129-
&cli.StringFlag{
130-
Name: flagCertKeyPath,
131-
Usage: "path where to store the generated certificate key",
132-
EnvVars: []string{"CERT_KEY_PATH"},
133-
},
134-
135100
// Logging, metrics and debug
136101
&cli.StringFlag{
137102
Name: "metrics-addr",
@@ -246,20 +211,8 @@ func runMain(cCtx *cli.Context) error {
246211
archiveWorkerCount := cCtx.Int("archive-worker-count")
247212
maxUserRPS := cCtx.Int(flagMaxUserRPS)
248213

249-
certDuration := cCtx.Duration("cert-duration")
250-
certHosts := cCtx.StringSlice("cert-hosts")
251-
certPath := cCtx.String(flagCertPath)
252-
certKeyPath := cCtx.String(flagCertKeyPath)
253-
if certPath == "" || certKeyPath == "" {
254-
return errors.New("cert-path and cert-key-path must be set")
255-
}
256-
257214
proxyConfig := &proxy.ReceiverProxyConfig{
258215
ReceiverProxyConstantConfig: proxy.ReceiverProxyConstantConfig{Log: log, FlashbotsSignerAddress: flashbotsSignerAddress},
259-
CertValidDuration: certDuration,
260-
CertHosts: certHosts,
261-
CertPath: certPath,
262-
CertKeyPath: certKeyPath,
263216
BuilderConfigHubEndpoint: builderConfigHubEndpoint,
264217
ArchiveEndpoint: archiveEndpoint,
265218
ArchiveConnections: connectionsPerPeer,
@@ -286,24 +239,16 @@ func runMain(cCtx *cli.Context) error {
286239
}
287240
}()
288241

289-
err = instance.RegisterSecrets(registerContext)
290-
registerCancel()
291-
if err != nil {
292-
log.Error("Failed to generate and publish secrets", "err", err)
293-
return err
294-
}
295-
296242
userListenAddr := cCtx.String(flagUserListenAddr)
297243
systemListenAddr := cCtx.String(flagSystemListenAddr)
298-
certListenAddr := cCtx.String(flagCertListenAddr)
299244

300-
servers, err := proxy.StartReceiverServers(instance, userListenAddr, systemListenAddr, certListenAddr)
245+
servers, err := proxy.StartReceiverServers(instance, userListenAddr, systemListenAddr)
301246
if err != nil {
302247
log.Error("Failed to start proxy server", "err", err)
303248
return err
304249
}
305250

306-
log.Info("Started receiver proxy", "userListenAddress", userListenAddr, "systemListenAddress", systemListenAddr, "certListenAddress", certListenAddr)
251+
log.Info("Started receiver proxy", "userListenAddress", userListenAddr, "systemListenAddress", systemListenAddr)
307252

308253
<-exit
309254
servers.Stop()

proxy/confighub.go

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,34 @@ import (
1414
)
1515

1616
type ConfighubOrderflowProxyCredentials struct {
17-
TLSCert string `json:"tls_cert"`
17+
TLSCert string `json:"tls_cert"` // for backward compatibility
1818
EcdsaPubkeyAddress common.Address `json:"ecdsa_pubkey_address"`
1919
}
2020

21+
type ConfighubInstanceData struct {
22+
TLSCert string `json:"tls_cert"`
23+
}
24+
2125
type ConfighubBuilder struct {
2226
Name string `json:"name"`
2327
IP string `json:"ip"`
28+
DNSName string `json:"dns_name"`
2429
OrderflowProxy ConfighubOrderflowProxyCredentials `json:"orderflow_proxy"`
30+
Instance ConfighubInstanceData `json:"instance"`
31+
}
32+
33+
func (b *ConfighubBuilder) SystemAPIAddress() string {
34+
if b.DNSName != "" {
35+
return OrderflowProxyURLFromIPOrDNSName(b.DNSName)
36+
}
37+
return OrderflowProxyURLFromIPOrDNSName(b.IP)
38+
}
39+
40+
func (b *ConfighubBuilder) TLSCert() string {
41+
if b.Instance.TLSCert != "" {
42+
return b.Instance.TLSCert
43+
}
44+
return b.OrderflowProxy.TLSCert
2545
}
2646

2747
type BuilderConfigHub struct {

proxy/html/index.html

Lines changed: 0 additions & 189 deletions
This file was deleted.

0 commit comments

Comments
 (0)