File: setup_IMA.sh

package info (click to toggle)
golang-eclipse-paho 1.1.1-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 508 kB
  • sloc: sh: 85; makefile: 9
file content (111 lines) | stat: -rw-r--r-- 3,040 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash

#######################################################################
# This script is for configuring your IBM Messaging Appliance for use #
# as an mqtt test server for testing the go-mqtt open source client.  #
# It creates the Policies and Endpoints necessary to test particular  #
# features of the client, such as IPv6, SSL, and other things         #
#                                                                     #
# You do not need this script for any other purpose.                  #
#######################################################################

# Edit options to match your configuration
IMA_HOST=9.41.55.184
IMA_USER=admin
HOST=9.41.55.146
USER=root
CERTDIR=~/GO/src/github.com/shoenig/go-mqtt/samples/samplecerts

echo 'Configuring your IBM Messaging Appliance for testing go-mqtt'
echo 'IMA_HOST: ' $IMA_HOST


function ima {
    reply=`ssh $IMA_USER@$IMA_HOST imaserver $@`
}

function imp {
    reply=`ssh $IMA_USER@$IMA_HOST file get $@`
}

ima create MessageHub Name=GoMqttTestHub

# Config "1" is a basic, open endpoint, port 17001
ima create MessagingPolicy \
    Name=GoMqttMP1 \
    Protocol=MQTT \
    ActionList=Publish,Subscribe \
    MaxMessages=100000 \
    DestinationType=Topic \
    Destination=*

ima create ConnectionPolicy \
    Name=GoMqttCP1 \
    Protocol=MQTT

ima create Endpoint \
    Name=GoMqttEP1 \
    Protocol=MQTT \
    MessageHub=GoMqttTestHub \
    ConnectionPolicies=GoMqttCP1 \
    MessagingPolicies=GoMqttMP1 \
    Port=17001

# Config "2" is IPv6 only , port 17002

# Config "3" is for authorization failures, port 17003
ima create ConnectionPolicy \
    Name=GoMqttCP2 \
    Protocol=MQTT \
    ClientID=GoMqttClient

ima create Endpoint \
    Name=GoMqttEP3 \
    Protocol=MQTT \
    MessageHub=GoMqttTestHub \
    ConnectionPolicies=GoMqttCP2 \
    MessagingPolicies=GoMqttMP1 \
    Port=17003

# Config "4" is secure connections, port 17004
imp scp://$USER@$HOST:${CERTDIR}/server-crt.pem .
imp scp://$USER@$HOST:${CERTDIR}/server-key.pem .
imp scp://$USER@$HOST:${CERTDIR}/rootCA-crt.pem .
imp scp://$USER@$HOST:${CERTDIR}/intermediateCA-crt.pem .

ima apply Certificate \
    CertFileName=server-crt.pem \
    "CertFilePassword=" \
    KeyFileName=server-key.pem \
    "KeyFilePassword="

ima create CertificateProfile \
    Name=GoMqttCertProf \
    Certificate=server-crt.pem \
    Key=server-key.pem

ima create SecurityProfile \
    Name=GoMqttSecProf \
    MinimumProtocolMethod=SSLv3 \
    UseClientCertificate=True \
    UsePasswordAuthentication=False \
    Ciphers=Fast \
    CertificateProfile=GoMqttCertProf

ima apply Certificate \
    TrustedCertificate=rootCA-crt.pem \
    SecurityProfileName=GoMqttSecProf

ima apply Certificate \
    TrustedCertificate=intermediateCA-crt.pem \
    SecurityProfileName=GoMqttSecProf

ima create Endpoint \
    Name=GoMqttEP4 \
    Port=17004 \
    MessageHub=GoMqttTestHub \
    ConnectionPolicies=GoMqttCP1 \
    MessagingPolicies=GoMqttMP1 \
    SecurityProfile=GoMqttSecProf \
    Protocol=MQTT