Skip to content

Commit

Permalink
Remove non-functional code
Browse files Browse the repository at this point in the history
Signed-off-by: 1998-felix <[email protected]>
  • Loading branch information
felixgateru committed Apr 11, 2024
1 parent 9a83995 commit 375cd38
Show file tree
Hide file tree
Showing 8 changed files with 129 additions and 182 deletions.
6 changes: 1 addition & 5 deletions cmd/coap/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,7 @@ func main() {
return
}

coapServerConfig := server.Config{
Port: defSvcCoAPPort,
CertFile: "./ssl/certs/magistrala-server.crt",
KeyFile: "./ssl/certs/magistrala-server.key",
}
coapServerConfig := server.Config{Port: defSvcCoAPPort}
if err := env.ParseWithOptions(&coapServerConfig, env.Options{Prefix: envPrefix}); err != nil {
logger.Error(fmt.Sprintf("failed to load %s CoAP server configuration : %s", svcName, err))
exitCode = 1
Expand Down
20 changes: 0 additions & 20 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -627,26 +627,6 @@ services:
target: /things-grpc-server-ca${MG_THINGS_AUTH_GRPC_SERVER_CA_CERTS:+.crt}
bind:
create_host_path: true
- type: bind
source: ./ssl/certs/magistrala-server.crt
target: /ssl/certs/magistrala-server.crt
bind:
create_host_path: true
- type: bind
source: ./ssl/certs/magistrala-server.key
target: /ssl/certs/magistrala-server.key
bind:
create_host_path: true
- type: bind
source: ./ssl/certs/ca.crt
target: /ssl/certs/ca.crt
bind:
create_host_path: true
- type: bind
source: ./ssl/certs/ca.key
target: /ssl/certs/ca.key
bind:
create_host_path: true

ws-adapter:
image: magistrala/ws:${MG_RELEASE_TAG}
Expand Down
42 changes: 21 additions & 21 deletions docker/ssl/certs/ca.crt
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
-----BEGIN CERTIFICATE-----
MIID3TCCAsWgAwIBAgIUJ7rTeCvycN8GF+nHwt3fXLTVSq4wDQYJKoZIhvcNAQEL
BQAwfjELMAkGA1UEBhMCS0UxEDAOBgNVBAgMB05haXJvYmkxETAPBgNVBAcMCC5O
Y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z
9pq6a6s6xg+myTAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBDQUAA4IBAQA7
w/oh5U9loJsigf3X3T3jQM8PVmhsUfNMJ3kc1Yumr72S4sGKjdWwuU0vk+B3eQzh
zXAj65BHhs1pXcukeoLR7YcHABEsEMg6lar/E4A+MgAZfZFVSvPpsByIK8I5ARk+
K1V/lWso+GJJM/lImPPnpvUWBdbntqC5WtjoMMGL9uyV3kVS6yT/kJ2ercnPzhPh
uBkL1ZH3ivDn/0JDY+T8Sfeq08vNWaTcoC7qpPwqXhuT0ytY7oaBS5wmPcvvzpZg
6zZYPZfhjhdEFYY1hDrrPYNYO72jncUnwQVp3X0DQpSvbxp681hVkcEtwHB2B8l0
tBGhgoH+TqZs0AUjoXM0
-----END CERTIFICATE-----
58 changes: 28 additions & 30 deletions docker/ssl/certs/ca.key
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
-----BEGIN ENCRYPTED PRIVATE KEY-----
MIIFHDBOBgkqhkiG9w0BBQ0wQTApBgkqhkiG9w0BBQwwHAQInG42mOvawu8CAggA
MAwGCCqGSIb3DQIJBQAwFAYIKoZIhvcNAwcECAuU1ABpa2isBIIEyKB69SK25f+z
BDzPG2lHrp2LPoyEqgb4hiC2GTTTPI+wHgIqoIhy2SrMBJfNL+/DjgJGDlvSa0mi
gkY7gtapdYpLOavFQPOgeWcLsVHzuxriK36sXxirlPd5397slAH6zi4bzo19Qlaq
ZPKmC0/DPb3M9o1/MkvtRdFdWBv5CnfC+Cum8bRSqU/XBqI0926o0KpbVPF8JglM
mOT7bx44AzSAglDtmv5wjcgI6O98VdNYw5c3bDpT17hqPMmIUIEBvvt9h+qj2SUV
bC2Ev2lZhDf8TlpKG3Au4OmR9agLxCUSqdL4O2KtVekuu24V4fFX3etIwBt2qEbk
9iduHhZGSDNojHt3cAQMcscZu/PsgNZQJIrdnJzVvXjOS2Dhb5G90Bejl2RmfEtI
yDiT1iRQIVuP6P6hKWM4NhkaMoLEB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wZ2+eqijZga5niBkqyAi
SRuTwR8WrDZau4mRNnF8bUl8dQKBgQC3BKYifRp4hHqBycHe9rSMZ8Xz+ZOy+IFA
vYap1Az+e8KuqlmD9Kfpp2Mjba1+HL5WKeTJGpFE7bhvb/xMPJgbMgtQ/cw4uDJ/
fwv4m6arf76ebOhaZtkT1vD4NyiyB+z6xP0TRgQRr2Or98XBSvGAYDXIn5vL7fUg
KrDF0ePuKQKBgDfaOcFRiDW7uJzYwI0ZoJ8gQufLYyyR4+UXEJ/BbdbA/mPCbyuw
MkKNP8Ip4YsUVL6S1avNFKQ/i4uxGY/Gh4ORM1wIwTGFJMYpaTV/+yafUFeYBWoC
J+zT77aLTiucuuB+HwKBBtylSps4WqyCntAikK8oTLLGFAYEYRrgup5ZAoGAbQ8j
JNghxwFCs0aT9ZZTfnt0NW9auUJmWzrVHSxUVe1P1J+EWiKXUJ/DbuAzizv7nAK4
57GiMU3rItS7pn5RMZt/rNKgOIhi5yDA9HNkPTwRTfyd9QjmgHEMBQ1xfa1FZSWv
nSWS1SsLnPU37XgIMzShuByMTVhOQs3NqwPo7AkCgYAf8AzQNjFCoTwU3SJezJ4H
9j1jvMO232hAl8UDNtqvJ1APn87tOtnfX48OMoRrP9kKI0oygE3pq7rFxu1qmTns
Zir0+KLeWGg58fSZkUEAp6kbO5CKwoeVAY9EMgd7BYBqlXLqUNfdH0L+KUOFKHha
7e82VxpgBeskzAqN1e7YRA==
-----END PRIVATE KEY-----
43 changes: 24 additions & 19 deletions docker/ssl/certs/magistrala-server.crt
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
-----BEGIN CERTIFICATE-----
MIIDhzCCAm8CFGxwHH9+uladlcjZknd53jbhIfVTMA0GCSqGSIb3DQEBCwUAMH4x
CzAJBgNVBAYTAktFMRAwDgYDVQQIDAdOYWlyb2JpMREwDwYDVQQHDAguTmFpcm9i
aTELMAkGA1UECgwCVVYxEDAOBgNVBAsMB1VWLWNvcmUxDjAMBgNVBAMMBW9oL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su4f1KlfTYdHWGHp+6kAmDn0jGCwz2BBrnsCAwEAATANBgkqhkiG9w0BAQsF
AAOCAQEAKyg5kvDk+TQ6ZDCK7qxKY+uN9setYvvsLfde+Uy51a3zj8RIHRgkOT2C
LuuTtTYKu3XmfCKId0oTXynGuP+yDAIuVwuZz3S0VmA8ijoZ87LJXzsLjjTjQSzZ
ar6RmlRDH+8Bm4AOrT4TDupqifag4J0msHkNPo0jVK6fnuniqJoSlhIbbHrJTHhv
jKNXrThjr/irgg1MZ7slojieOS0QoZHRE9eunIR5enDJwB5pWUJSmZWlisI7+Ibi
06+j8wZegU0nqeWp4wFSZxKnrzz5B5Qu9SrALwlHWirzBpyr0gAcF2v7nzbWviZ/
0VMyY4FGEbkp6trMxwJs5hGYhAiyXg==
-----END CERTIFICATE-----
76 changes: 50 additions & 26 deletions docker/ssl/certs/magistrala-server.key
Original file line number Diff line number Diff line change
@@ -1,28 +1,52 @@
-----BEGIN PRIVATE KEY-----
MIIEuwIBADANBgkqhkiG9w0BAQEFAASCBKUwggShAgEAAoIBAQCxOab+ao4I+Wq/
WBXEtU7Hs3wrQF1RRa4yoaVal7bS7/s6m0N8AzuGcmSyBBAXRmJvgIxBzoO16yDI
jogTJBknblAjZWxci1FGp3PY3w6mczYKf83pBRCdS0UiOlBfaJTyW0YsV9J6CP+L
KJkk3eylnKTSRhIfR1m2MWOZtZYCwSVbg+eoNrQdpengb+P4hvU2ura+jS3QtvCL
AuJv6f6XJo8sOaGsxVZHoT20+AKOIFdRZY2+Pt060tnur9ZjbyREHsyWJtnPBr9b
Nl696Y71urcDuQ7Uxyy0hCQZfGiJV7T19sUZe9xm0SAa2K/L/q6goIBM2JFjouqZ
Gkpmm51TAgMBAAECgf8CD1FjdTCo8BbPX58B2l8uMCtYWGWri9zU3MjBlqKc1GM4
wbIJOx65elVVo4cGb3ehBfv8j3SPwxi9SScrcvJhtCEtpa1MLEfzKcW499pddVO6
ZtNvf1klNK9tMhr8IhNSwqKjZ0Ul1cg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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ require (
github.com/oklog/ulid/v2 v2.1.0
github.com/ory/dockertest/v3 v3.10.0
github.com/pelletier/go-toml v1.9.5
github.com/pion/dtls/v2 v2.2.10
github.com/plgd-dev/go-coap/v2 v2.6.0
github.com/prometheus/client_golang v1.19.0
github.com/rabbitmq/amqp091-go v1.9.0
Expand Down Expand Up @@ -144,6 +143,7 @@ require (
github.com/opencontainers/image-spec v1.1.0 // indirect
github.com/opencontainers/runc v1.1.12 // indirect
github.com/pelletier/go-toml/v2 v2.2.0 // indirect
github.com/pion/dtls/v2 v2.2.10 // indirect
github.com/pion/logging v0.2.2 // indirect
github.com/pion/transport/v2 v2.2.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
Expand Down
64 changes: 4 additions & 60 deletions internal/server/coap/coap.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ package coap

import (
"context"
"crypto/tls"
"fmt"
"log/slog"
"time"

"github.com/absmach/magistrala/internal/server"
piondtls "github.com/pion/dtls/v2"
gocoap "github.com/plgd-dev/go-coap/v2"
"github.com/plgd-dev/go-coap/v2/mux"
)
Expand Down Expand Up @@ -45,57 +43,10 @@ func New(ctx context.Context, cancel context.CancelFunc, name string, config ser
func (s *Server) Start() error {
errCh := make(chan error)
s.Logger.Info(fmt.Sprintf("%s service started using http, exposed port %s", s.Name, s.Address))
switch {
case s.Config.CertFile != "" || s.Config.KeyFile != "":
s.Logger.Info(fmt.Sprintf("%s service %s server listening at %s with DTLS cert %s and key %s", s.Name, s.Protocol, s.Address, s.Config.CertFile, s.Config.KeyFile))
certificate, err := tls.LoadX509KeyPair(s.Config.CertFile, s.Config.KeyFile)
if err != nil {
return fmt.Errorf("failed to load auth certificates: %w", err)
}
dtlsConfig := &piondtls.Config{
Certificates: []tls.Certificate{certificate},
ExtendedMasterSecret: piondtls.RequireExtendedMasterSecret,
ClientAuth: piondtls.RequireAndVerifyClientCert,
ConnectContextMaker: func() (context.Context, func()) {
return context.WithTimeout(s.Ctx, 30*time.Second)
},
}
// // Loading Server CA file
// rootCA, err := loadCertFile(s.Config.ServerCAFile)
// if err != nil {
// return fmt.Errorf("failed to load root ca file: %w", err)
// }
// if len(rootCA) > 0 {
// if dtlsConfig.ClientCAs == nil {
// dtlsConfig.RootCAs = x509.NewCertPool()
// }
// if !dtlsConfig.ClientCAs.AppendCertsFromPEM(rootCA) {
// return fmt.Errorf("failed to append root ca to dtls.Config")
// }
// }

// // Loading Client CA file
// clientCA, err := loadCertFile(s.Config.ClientCAFile)
// if err != nil {
// return fmt.Errorf("failed to load client ca file: %w", err)
// }
// if len(clientCA) > 0 {
// if dtlsConfig.ClientCAs == nil {
// dtlsConfig.ClientCAs = x509.NewCertPool()
// }
// if !dtlsConfig.ClientCAs.AppendCertsFromPEM(clientCA) {
// return fmt.Errorf("failed to append client ca to dtls.Config")
// }
// }
go func() {
errCh <- gocoap.ListenAndServeDTLS("udp", s.Address, dtlsConfig, s.handler)
}()
default:
s.Logger.Info(fmt.Sprintf("%s service %s server listening at %s without TLS", s.Name, s.Protocol, s.Address))
go func() {
errCh <- gocoap.ListenAndServe("udp", s.Address, s.handler)
}()
}
s.Logger.Info(fmt.Sprintf("%s service %s server listening at %s without TLS", s.Name, s.Protocol, s.Address))
go func() {
errCh <- gocoap.ListenAndServe("udp", s.Address, s.handler)
}()

select {
case <-s.Ctx.Done():
Expand All @@ -116,10 +67,3 @@ func (s *Server) Stop() error {
s.Logger.Info(fmt.Sprintf("%s service shutdown of http at %s", s.Name, s.Address))
return nil
}

// func loadCertFile(certFile string) ([]byte, error) {
// if certFile != "" {
// return os.ReadFile(certFile)
// }
// return []byte{}, nil
// }

0 comments on commit 375cd38

Please sign in to comment.