Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions apps/backend/libs/amqp/src/amqp.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Module } from '@nestjs/common'
import { ConfigModule, ConfigService } from '@nestjs/config'
import { RabbitMQModule } from '@golevelup/nestjs-rabbitmq'
import { readFileSync } from 'fs'
import { CONSUME_CHANNEL, PUBLISH_CHANNEL } from '@libs/constants'
import { CheckAMQPService, JudgeAMQPService } from './amqp.service'

Expand Down Expand Up @@ -40,7 +39,7 @@ import { CheckAMQPService, JudgeAMQPService } from './amqp.service'
...(config.get('RABBITMQ_SSL') === 'true' && {
connectionManagerOptions: {
connectionOptions: {
ca: [readFileSync('/etc/ssl/rabbitmq/ca.crt')]
rejectUnauthorized: false
}
Comment thread
sunghyun1000 marked this conversation as resolved.
}
})
Expand Down
9 changes: 1 addition & 8 deletions apps/iris/src/connector/rabbitmq/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package rabbitmq

import (
"crypto/tls"
"crypto/x509"
"fmt"
"os"

Expand Down Expand Up @@ -40,13 +39,7 @@ func NewConsumer(config ConsumerConfig, logger logger.Logger) (*consumer, error)
Properties: amqp.NewConnectionProperties(),
}
if os.Getenv("RABBITMQ_SSL") == "true" {
caCert, err := os.ReadFile("/etc/ssl/rabbitmq/ca.crt")
if err != nil {
return nil, fmt.Errorf("consumer: failed to read RabbitMQ CA cert: %w", err)
}
caCertPool := x509.NewCertPool()
caCertPool.AppendCertsFromPEM(caCert)
amqpConfig.TLSClientConfig = &tls.Config{RootCAs: caCertPool}
amqpConfig.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
Comment thread
sunghyun1000 marked this conversation as resolved.
amqpConfig.Properties.SetClientConnectionName(config.ConnectionName)
connection, err := amqp.DialConfig(config.AmqpURI, amqpConfig)
Expand Down
7 changes: 5 additions & 2 deletions apps/iris/src/connector/rabbitmq/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/tls"
"fmt"
"net/http"
"os"

amqp "github.com/rabbitmq/amqp091-go"
instrumentation "github.com/skkuding/codedang/apps/iris/src"
Expand Down Expand Up @@ -41,8 +42,10 @@ func NewProducer(config ProducerConfig, logger logger.Logger) (*producer, error)

// Create New RabbitMQ Connection (go <-> RabbitMQ)
amqpConfig := amqp.Config{
Properties: amqp.NewConnectionProperties(),
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
Properties: amqp.NewConnectionProperties(),
}
if os.Getenv("RABBITMQ_SSL") == "true" {
amqpConfig.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
Comment thread
sunghyun1000 marked this conversation as resolved.
amqpConfig.Properties.SetClientConnectionName(config.ConnectionName)
connection, err := amqp.DialConfig(config.AmqpURI, amqpConfig)
Expand Down
7 changes: 5 additions & 2 deletions apps/plag/src/connector/rabbitmq/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package rabbitmq
import (
"crypto/tls"
"fmt"
"os"

amqp "github.com/rabbitmq/amqp091-go"
"github.com/skkuding/codedang/apps/plag/src/service/logger"
Expand Down Expand Up @@ -35,8 +36,10 @@ func NewConsumer(config ConsumerConfig, logger logger.Logger) (*consumer, error)

// Create New RabbitMQ Connection (go <-> RabbitMQ)
amqpConfig := amqp.Config{
Properties: amqp.NewConnectionProperties(),
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
Properties: amqp.NewConnectionProperties(),
}
if os.Getenv("RABBITMQ_SSL") == "true" {
amqpConfig.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
Comment thread
sunghyun1000 marked this conversation as resolved.
amqpConfig.Properties.SetClientConnectionName(config.ConnectionName)
connection, err := amqp.DialConfig(config.AmqpURI, amqpConfig)
Expand Down
7 changes: 5 additions & 2 deletions apps/plag/src/connector/rabbitmq/producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"crypto/tls"
"fmt"
"net/http"
"os"

amqp "github.com/rabbitmq/amqp091-go"
instrumentation "github.com/skkuding/codedang/apps/plag/src"
Expand Down Expand Up @@ -41,8 +42,10 @@ func NewProducer(config ProducerConfig, logger logger.Logger) (*producer, error)

// Create New RabbitMQ Connection (go <-> RabbitMQ)
amqpConfig := amqp.Config{
Properties: amqp.NewConnectionProperties(),
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
Properties: amqp.NewConnectionProperties(),
}
if os.Getenv("RABBITMQ_SSL") == "true" {
amqpConfig.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
}
Comment thread
sunghyun1000 marked this conversation as resolved.
amqpConfig.Properties.SetClientConnectionName(config.ConnectionName)
connection, err := amqp.DialConfig(config.AmqpURI, amqpConfig)
Expand Down
11 changes: 0 additions & 11 deletions infra/k8s/admin-api/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ spec:
name: database-credentials
- secretRef:
name: security-keys
volumeMounts:
- name: rabbitmq-ca-cert
mountPath: /etc/ssl/rabbitmq
readOnly: true
env:
- name: RABBITMQ_DEFAULT_USER
valueFrom:
Expand All @@ -52,10 +48,3 @@ spec:
secretKeyRef:
name: redis-credentials
key: password
volumes:
- name: rabbitmq-ca-cert
secret:
secretName: rabbitmq-ca-cert
items:
- key: ca.crt
path: ca.crt
1 change: 0 additions & 1 deletion infra/k8s/admin-api/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ resources:
- deployment.yaml
- ingress.yaml
- namespace.yaml
- rabbitmq-ca-cert.yaml
- rabbitmq-credentials.yaml
- redis-credentials.yaml
- service.yaml
7 changes: 0 additions & 7 deletions infra/k8s/admin-api/base/rabbitmq-ca-cert.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions infra/k8s/client-api/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ spec:
name: oauth-credentials
- secretRef:
name: security-keys
volumeMounts:
- name: rabbitmq-ca-cert
mountPath: /etc/ssl/rabbitmq
readOnly: true
env:
- name: RABBITMQ_DEFAULT_USER
valueFrom:
Expand All @@ -54,10 +50,3 @@ spec:
secretKeyRef:
name: redis-credentials
key: password
volumes:
- name: rabbitmq-ca-cert
secret:
secretName: rabbitmq-ca-cert
items:
- key: ca.crt
path: ca.crt
1 change: 0 additions & 1 deletion infra/k8s/client-api/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ resources:
- deployment.yaml
- ingress.yaml
- namespace.yaml
- rabbitmq-ca-cert.yaml
- rabbitmq-credentials.yaml
- redis-credentials.yaml
- service.yaml
7 changes: 0 additions & 7 deletions infra/k8s/client-api/base/rabbitmq-ca-cert.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions infra/k8s/iris/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ spec:
- name: cgroup
mountPath: /sys/fs/cgroup
readOnly: false
- name: rabbitmq-ca-cert
mountPath: /etc/ssl/rabbitmq
readOnly: true
securityContext:
privileged: true
envFrom:
Expand All @@ -55,9 +52,3 @@ spec:
hostPath:
path: /sys/fs/cgroup
type: Directory
- name: rabbitmq-ca-cert
secret:
secretName: rabbitmq-ca-cert
items:
- key: ca.crt
path: ca.crt
1 change: 0 additions & 1 deletion infra/k8s/iris/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ resources:
- configmap.yaml
- deployment.yaml
- namespace.yaml
- rabbitmq-ca-cert.yaml
- rabbitmq-credentials.yaml

commonAnnotations:
Expand Down
7 changes: 0 additions & 7 deletions infra/k8s/iris/base/rabbitmq-ca-cert.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions infra/k8s/plag/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ spec:
name: aws-credentials
- secretRef:
name: database-credentials
volumeMounts:
- name: rabbitmq-ca-cert
mountPath: /etc/ssl/rabbitmq
readOnly: true
env:
- name: RABBITMQ_DEFAULT_USER
valueFrom:
Expand All @@ -47,10 +43,3 @@ spec:
secretKeyRef:
name: rabbitmq-credentials
key: password
volumes:
- name: rabbitmq-ca-cert
secret:
secretName: rabbitmq-ca-cert
items:
- key: ca.crt
path: ca.crt
1 change: 0 additions & 1 deletion infra/k8s/plag/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ resources:
- configmap.yaml
- deployment.yaml
- namespace.yaml
- rabbitmq-ca-cert.yaml
- rabbitmq-credentials.yaml

commonAnnotations:
Expand Down
7 changes: 0 additions & 7 deletions infra/k8s/plag/base/rabbitmq-ca-cert.yaml

This file was deleted.

Loading