From 75912c7f46e1255672cd4de18e1c8223ff4e05b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= <cedric.dsm@tiolive.com> Date: Mon, 22 Apr 2013 18:30:24 +0200 Subject: [PATCH] Add hack to allow nginx to communicate with zimbra-kvm. --- slapos/recipe/zimbra_kvm/template/kvm_run.in | 4 ++-- software/zimbra-kvm/instance-kvm.cfg.in | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/slapos/recipe/zimbra_kvm/template/kvm_run.in b/slapos/recipe/zimbra_kvm/template/kvm_run.in index e162773e4..62ace3143 100644 --- a/slapos/recipe/zimbra_kvm/template/kvm_run.in +++ b/slapos/recipe/zimbra_kvm/template/kvm_run.in @@ -33,11 +33,11 @@ if not os.path.exists(disk_path): disk_path, '%(disk_size)sG']) # Generate NAT rules -nat_rules = ",".join("hostfwd=tcp:%(vnc_ip)s:%%s-:%%s" %% (port, port) for port in [25, 80, 110, 143, 443, 465, 587, 993, 995, 7071]) +nat_rules = 'hostfwd=tcp:%(vnc_ip)s:2222-:22,hostfwd=tcp:%(vnc_ip)s:2525-:25,' + ','.join("hostfwd=tcp:%(vnc_ip)s:%%s-:%%s" %% (port, port) for port in [80, 110, 143, 443, 465, 587, 993, 995, 7071]) kvm_argument_list = ['%(qemu_path)s', '-enable-kvm', '-net', 'nic,macaddr=%(mac_address)s', - '-net', 'user,hostfwd=tcp:%(vnc_ip)s:2222-:22,%%s' %% nat_rules, + '-net', 'user,%%s' %% nat_rules, '-smp', '%(smp_count)s', '-m', '%(ram_size)s', '-drive', 'file=%(disk_path)s,if=%(disk_type)s', diff --git a/software/zimbra-kvm/instance-kvm.cfg.in b/software/zimbra-kvm/instance-kvm.cfg.in index 192ed3567..3e34c1a27 100644 --- a/software/zimbra-kvm/instance-kvm.cfg.in +++ b/software/zimbra-kvm/instance-kvm.cfg.in @@ -8,6 +8,7 @@ parts = certificate-authority request-web-frontend kvm-promise + tunnel-ipv6-reverse-proxy tunnel-ipv6-kvm-https tunnel-ipv6-kvm-ssh tunnel-ipv6-kvm-zimbra-admin @@ -226,7 +227,21 @@ slave = true config = smtp-upstream-host smtp-upstream-port config-smtp-upstream-host = $${tunnel-ipv6-kvm-smtp:ipv6} config-smtp-upstream-port = $${tunnel-ipv6-kvm-smtp:ipv6-port} -return = listening-ipv4 +return = listening-ipv4 listening-ipv6 + +# Qemu doesn't support IPv6 in user-mode network. +# Solution: tunnel ipv6 of smtp reverse proxy to local ipv4 so that guest +# inside of KVM can connect to it. +[tunnel-ipv6-reverse-proxy] +recipe = slapos.cookbook:ipv4toipv6 +ipv6 = $${request-smtp-frontend:connection-listening-ipv6} +ipv6-port = 25 +ipv4 = $${slap-network-information:local-ipv4} +ipv4-port = 25 +shell-path = ${dash:location}/bin/dash +6tunnel-path = ${6tunnel:location}/bin/6tunnel +runner-path = $${directory:services}/6tunnel-https + [publish-kvm-connection-information] recipe = slapos.cookbook:publish -- 2.30.9