Difference between revisions of "OpenStack: Install RabbitMQ Message Broker"

From Define Wiki
Jump to navigation Jump to search
(Created page with "== Install RabbitMQ Server == <syntaxhighlight> yum -y install rabbitmq-server systemctl start rabbitmq-server </syntaxhighlight> == User Management == <syntaxhighlight> rabbitmqctl delete_user guest rabbitm...")
 
Line 23: Line 23:
 
touch index.txt
 
touch index.txt
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 
<syntaxhighlight>
 
<syntaxhighlight>
 
wget -P /etc/rabbitmq/testca/ http://classroom.example.com/materials/openssl.cnf
 
wget -P /etc/rabbitmq/testca/ http://classroom.example.com/materials/openssl.cnf
 +
</syntaxhighlight>
  
  33  openssl req -x509 -config openssl.cnf -newkey rsa:2048 -days 365 -out cacert.pem -outform PEM -subj /CN=MyTestCA/ -nodes
+
<syntaxhighlight>
  34  openssl x509 -in cacert.pem -out cacert.cer -outform DER
+
openssl req -x509 -config openssl.cnf -newkey rsa:2048 -days 365 -out cacert.pem -outform PEM -subj /CN=MyTestCA/ -nodes
  35  mkdir -p /etc/rabbitmq/server
+
openssl x509 -in cacert.pem -out cacert.cer -outform DER
  36  cd /etc/rabbitmq/server
+
</syntaxhighlight>
  37  openssl genrsa -out key.pem 2048
 
  38  openssl req -new -key key.pem -out req.pem -outform PEM -subj /CN=$(hostname)/o=server= -nodes
 
  39  openssl req -new -key key.pem -out req.pem -outform PEM -subj /CN=$(hostname)/0=server= -nodes
 
  40  openssl req -new -key key.pem -out req.pem -outform PEM -subj /CN=$(hostname)/O=server= -nodes
 
  41  mkdir -p /etc/rabbitmq/client
 
  42  cd /etc/rabbitmq/client
 
  43  openssl genrsa -out key.pem 2048
 
  44  openssl req -new -key key.pem -out req.pem -outform PEM -subj /CN=$(hostname)/O=client/ -nodes
 
  45  cd ../testca/
 
  46  openssl ca -config openssl.cnf -in ../server/req.pem -out ../server/cert.pem -notext -batch -extensions client_ca_extensions
 
  47  cd ../server
 
  48  openssl pkcs12 -export -out keycert.p12 -in cert.pem -inkey key.pem -passout pass:MySecretPassword
 
  49  cd ../testca/
 
  50  openssl ca -config openssl.cnf -in ../client/req.pem -out ../client/cert.pem -notext -batch -extenstions client_ca_extensions
 
  51  openssl ca -config openssl.cnf -in ../client/req.pem -out ../client/cert.pem -notext -batch -extensions client_ca_extensions
 
  52  cd ../client/
 
  53  openssl pkcs12 -export -out keycert.p12 -in cert.pem -inkey key.pem -passout pass:MySecretPassword
 
  54  cd
 
  55  wget -P /etc/rabbitmq/ http://classroom.example.com/materials/rabbitmq.config
 
  56  firewall-cmd --add-port=5672/tcp --permanent
 
  57  firewall-cmd --add-port=5671/tcp --permanent
 
  58  firewall-cmd --reload
 
  59  systemctl restart rabbitmq-server
 
  
 +
<syntaxhighlight>
 +
mkdir -p /etc/rabbitmq/server
 +
cd /etc/rabbitmq/server
 +
openssl genrsa -out key.pem 2048
 +
openssl req -new -key key.pem -out req.pem -outform PEM -subj /CN=$(hostname)/O=server= -nodes
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight>
 +
mkdir -p /etc/rabbitmq/client
 +
cd /etc/rabbitmq/client
 +
openssl genrsa -out key.pem 2048
 +
openssl req -new -key key.pem -out req.pem -outform PEM -subj /CN=$(hostname)/O=client/ -nodes
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight>
 +
cd ../testca/
 +
openssl ca -config openssl.cnf -in ../server/req.pem -out ../server/cert.pem -notext -batch -extensions client_ca_extensions
 +
cd ../server
 +
openssl pkcs12 -export -out keycert.p12 -in cert.pem -inkey key.pem -passout pass:MySecretPassword
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight>
 +
cd ../testca/
 +
openssl ca -config openssl.cnf -in ../client/req.pem -out ../client/cert.pem -notext -batch -extensions client_ca_extensions
 +
cd ../client/
 +
openssl pkcs12 -export -out keycert.p12 -in cert.pem -inkey key.pem -passout pass:MySecretPassword
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight>
 +
cd
 +
wget -P /etc/rabbitmq/ http://classroom.example.com/materials/rabbitmq.config
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight>
 +
firewall-cmd --add-port=5672/tcp --permanent
 +
firewall-cmd --add-port=5671/tcp --permanent
 +
firewall-cmd --reload
 +
systemctl restart rabbitmq-server
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight>
 +
[root@server2-a ~]# netstat -nlp | grep 567
 +
tcp6      0      0 :::5671                :::*                    LISTEN      2745/beam.smp     
 +
tcp6      0      0 :::5672                :::*                    LISTEN      2745/beam.smp     
 +
</syntaxhighlight>
 +
 +
<syntaxhighlight>
 +
systemctl enable rabbitmq-server
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 08:45, 28 April 2015

Install RabbitMQ Server

yum -y install rabbitmq-server
systemctl start rabbitmq-server

User Management

rabbitmqctl delete_user guest
rabbitmqctl add_user rabbitmqauth redhat
rabbitmqctl set_permissions rabbitmqauth ".*" ".*" ".*"
rabbitmqctl set_user_tags rabbitmqauth administrator
rabbitmqctl list_users

SSL Certificate Stuff

mkdir /etc/rabbitmq/testca
cd /etc/rabbitmq/testca
mkdir certs private
chmod 700 private
echo 01 > serial
touch index.txt
wget -P /etc/rabbitmq/testca/ http://classroom.example.com/materials/openssl.cnf
openssl req -x509 -config openssl.cnf -newkey rsa:2048 -days 365 -out cacert.pem -outform PEM -subj /CN=MyTestCA/ -nodes
openssl x509 -in cacert.pem -out cacert.cer -outform DER
mkdir -p /etc/rabbitmq/server
cd /etc/rabbitmq/server
openssl genrsa -out key.pem 2048
openssl req -new -key key.pem -out req.pem -outform PEM -subj /CN=$(hostname)/O=server= -nodes
mkdir -p /etc/rabbitmq/client
cd /etc/rabbitmq/client
openssl genrsa -out key.pem 2048
openssl req -new -key key.pem -out req.pem -outform PEM -subj /CN=$(hostname)/O=client/ -nodes
cd ../testca/
openssl ca -config openssl.cnf -in ../server/req.pem -out ../server/cert.pem -notext -batch -extensions client_ca_extensions
cd ../server
openssl pkcs12 -export -out keycert.p12 -in cert.pem -inkey key.pem -passout pass:MySecretPassword
cd ../testca/
openssl ca -config openssl.cnf -in ../client/req.pem -out ../client/cert.pem -notext -batch -extensions client_ca_extensions
cd ../client/
openssl pkcs12 -export -out keycert.p12 -in cert.pem -inkey key.pem -passout pass:MySecretPassword
cd
wget -P /etc/rabbitmq/ http://classroom.example.com/materials/rabbitmq.config
firewall-cmd --add-port=5672/tcp --permanent
firewall-cmd --add-port=5671/tcp --permanent
firewall-cmd --reload
systemctl restart rabbitmq-server
[root@server2-a ~]# netstat -nlp | grep 567
tcp6       0      0 :::5671                 :::*                    LISTEN      2745/beam.smp       
tcp6       0      0 :::5672                 :::*                    LISTEN      2745/beam.smp
systemctl enable rabbitmq-server