Skip to content

Commit a2a45f0

Browse files
KVM: do not listen on TCP port when configure kvm host (#301)
1 parent dbe919b commit a2a45f0

1 file changed

Lines changed: 21 additions & 22 deletions

File tree

  • source/installguide/hypervisor

source/installguide/hypervisor/kvm.rst

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,10 @@ cloudstack-agent and should already be installed.
299299
Please note that Cloudstack will automatically perform basic configuration of the agent and libvirt when the host is added. This is relevant if you are
300300
planning to automate the deployment and configuration of your KVM hosts.
301301

302-
#. In order to have live migration working libvirt has to listen for
303-
unsecured TCP connections. We also need to turn off libvirts attempt
302+
#. To avoid potential security attack to virtual machines, We need to turn
303+
off libvirt to listen on unsecure TCP port. CloudStack will automatically
304+
set up cloud keystore and certificates when the host is added to cloudstack.
305+
We also need to turn off libvirts attempt
304306
to use Multicast DNS advertising. Both of these settings are in
305307
``/etc/libvirt/libvirtd.conf``
306308

@@ -312,7 +314,11 @@ cloudstack-agent and should already be installed.
312314
313315
.. parsed-literal::
314316
315-
listen_tcp = 1
317+
listen_tcp = 0
318+
319+
.. parsed-literal::
320+
321+
tls_port = "16514"
316322
317323
.. parsed-literal::
318324
@@ -326,8 +332,7 @@ cloudstack-agent and should already be installed.
326332
327333
mdns_adv = 0
328334
329-
#. Turning on "listen\_tcp" in libvirtd.conf is not enough, we have to
330-
change the parameters as well:
335+
#. We have to change the parameters as well:
331336

332337
On RHEL or CentOS or SUSE modify ``/etc/sysconfig/libvirtd``:
333338

@@ -344,33 +349,35 @@ cloudstack-agent and should already be installed.
344349
systemctl mask libvirtd.socket libvirtd-ro.socket libvirtd-admin.socket libvirtd-tls.socket libvirtd-tcp.socket
345350
346351
347-
On Ubuntu modify ``/etc/default/libvirt-bin``
352+
On Ubuntu 20.04 or older, modify ``/etc/default/libvirtd``
348353

349354
Uncomment and change the following line
350355

351356
.. parsed-literal::
352357
353-
#env libvirtd_opts=""
358+
#libvirtd_opts=""
354359
355360
so it looks like:
356361

357362
.. parsed-literal::
358363
359-
env libvirtd_opts="-l"
364+
libvirtd_opts="-l"
360365
361-
#. Restart libvirt
366+
On Ubuntu 22.04 or newer version, modify ``/etc/default/libvirtd``:
362367

363-
In RHEL or CentOS or SUSE :
368+
Uncomment the following line:
364369

365370
.. parsed-literal::
366371
367-
$ systemctl restart libvirtd
372+
#LIBVIRTD_ARGS="--listen"
368373
369-
In Ubuntu:
374+
#. Restart libvirt
375+
376+
In RHEL or CentOS or SUSE or Ubuntu:
370377

371378
.. parsed-literal::
372379
373-
$ systemctl restart libvirt-bin
380+
$ systemctl restart libvirtd
374381
375382
376383
Configure the Security Policies
@@ -1289,7 +1296,7 @@ using a firewall):
12891296

12901297
#. 1798
12911298

1292-
#. 16509, 16514 (libvirt)
1299+
#. 16514 (libvirt)
12931300

12941301
#. 5900 - 6100 (VNC consoles)
12951302

@@ -1313,10 +1320,6 @@ extra ports by executing the following iptable commands:
13131320
13141321
$ iptables -I INPUT -p tcp -m tcp --dport 1798 -j ACCEPT
13151322
1316-
.. parsed-literal::
1317-
1318-
$ iptables -I INPUT -p tcp -m tcp --dport 16509 -j ACCEPT
1319-
13201323
.. parsed-literal::
13211324
13221325
$ iptables -I INPUT -p tcp -m tcp --dport 16514 -j ACCEPT
@@ -1361,10 +1364,6 @@ To open the required ports, execute the following commands:
13611364
13621365
$ ufw allow proto tcp from any to any port 1798
13631366
1364-
.. parsed-literal::
1365-
1366-
$ ufw allow proto tcp from any to any port 16509
1367-
13681367
.. parsed-literal::
13691368
13701369
$ ufw allow proto tcp from any to any port 16514

0 commit comments

Comments
 (0)