From 43698bb3b9786fa6de160826e8d1ae5c472dff6a Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Fri, 14 Feb 2020 12:10:03 +0100 Subject: [PATCH 01/10] Prepare tests first --- metricbeat/module/haproxy/_meta/Dockerfile | 2 + metricbeat/module/haproxy/_meta/certs/ca.crt | 30 +++++++++++ metricbeat/module/haproxy/_meta/certs/ca.key | 51 +++++++++++++++++++ .../module/haproxy/_meta/certs/client.crt | 22 ++++++++ .../module/haproxy/_meta/certs/client.csr | 11 ++++ .../module/haproxy/_meta/certs/client.key | 15 ++++++ .../module/haproxy/_meta/certs/generate.sh | 21 ++++++++ .../module/haproxy/_meta/certs/server.crt | 22 ++++++++ .../module/haproxy/_meta/certs/server.csr | 11 ++++ .../module/haproxy/_meta/certs/server.key | 15 ++++++ .../module/haproxy/_meta/certs/server.pem | 37 ++++++++++++++ metricbeat/module/haproxy/_meta/haproxy.conf | 12 ++++- metricbeat/module/haproxy/docker-compose.yml | 3 +- metricbeat/module/haproxy/test_haproxy.py | 17 +++++++ 14 files changed, 266 insertions(+), 3 deletions(-) create mode 100644 metricbeat/module/haproxy/_meta/certs/ca.crt create mode 100644 metricbeat/module/haproxy/_meta/certs/ca.key create mode 100644 metricbeat/module/haproxy/_meta/certs/client.crt create mode 100644 metricbeat/module/haproxy/_meta/certs/client.csr create mode 100644 metricbeat/module/haproxy/_meta/certs/client.key create mode 100755 metricbeat/module/haproxy/_meta/certs/generate.sh create mode 100644 metricbeat/module/haproxy/_meta/certs/server.crt create mode 100644 metricbeat/module/haproxy/_meta/certs/server.csr create mode 100644 metricbeat/module/haproxy/_meta/certs/server.key create mode 100644 metricbeat/module/haproxy/_meta/certs/server.pem diff --git a/metricbeat/module/haproxy/_meta/Dockerfile b/metricbeat/module/haproxy/_meta/Dockerfile index a63a3b0e720..9d4a8339134 100644 --- a/metricbeat/module/haproxy/_meta/Dockerfile +++ b/metricbeat/module/haproxy/_meta/Dockerfile @@ -3,4 +3,6 @@ FROM haproxy:${HAPROXY_VERSION} RUN apt-get update && apt-get install -y netcat HEALTHCHECK --interval=1s --retries=90 CMD nc -z localhost 14567 COPY ./haproxy.conf /usr/local/etc/haproxy/haproxy.cfg +COPY ./certs/server.pem /usr/local/etc/haproxy/server.pem +COPY ./certs/ca.crt /usr/local/etc/haproxy/ca.crt EXPOSE 14567 diff --git a/metricbeat/module/haproxy/_meta/certs/ca.crt b/metricbeat/module/haproxy/_meta/certs/ca.crt new file mode 100644 index 00000000000..d0a1aa9f977 --- /dev/null +++ b/metricbeat/module/haproxy/_meta/certs/ca.crt @@ -0,0 +1,30 @@ +-----BEGIN CERTIFICATE----- +MIIFIjCCAwoCCQC8H+mzLzihlTANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJV +UzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEX +MBUGA1UEAwwOY2FAZXhhbXBsZS5jb20wHhcNMjAwMjE0MTA0MzI4WhcNMzAwMjEx +MTA0MzI4WjBTMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQG +A1UEBwwNU2FuIEZyYW5jaXNjbzEXMBUGA1UEAwwOY2FAZXhhbXBsZS5jb20wggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDv7tkjp2dAGGZIsNVVByPKNBBA +vLXg3JrUH2n4NEoq1ZDya+4bY+1f/9I1/ahmAGEgkR8kzhbcMr9pjlnL8XJ1wfQF +LanTWiT2IXqeKwEs3uaoevYFUJ6qz02/svWV6PyZ39xJ+CD8L8HvNr4AqWtEcPGu +vkX3z00UqBjwKuWmskL2/QroZNtTADf5P+q7mgTVXfMsGZSBRTtiZv/5vjfnwLUh +RHdU7Xz5Y6Hk79fOT8aGCP6EOMaMRde/mR0/c0cp1Y69QxRcViUZnOsDCbggiPOB +FZGATfIB/DODadBwNAkOFOiBr99Tac4f9j9zCLVyGXhTDqp95DdE0cIOryxxGonT +XjB4d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l5A== +-----END CERTIFICATE----- diff --git a/metricbeat/module/haproxy/_meta/certs/ca.key b/metricbeat/module/haproxy/_meta/certs/ca.key new file mode 100644 index 00000000000..df6ff437f12 --- /dev/null +++ b/metricbeat/module/haproxy/_meta/certs/ca.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKAIBAAKCAgEA7+7ZI6dnQBhmSLDVVQcjyjQQQLy14Nya1B9p+DRKKtWQ8mvu +G2PtX//SNf2oZgBhIJEfJM4W3DK/aY5Zy/FydcH0BS2p01ok9iF6nisBLN7mqHr2 +BVCeqs9Nv7L1lej8md/cSfgg/C/B7za+AKlrRHDxrr5F989NFKgY8CrlprJC9v0K +6GTbUwA3+T/qu5oE1V3zLBmUgUU7Ymb/+b4358C1IUR3VO18+WOh5O/Xzk/Ghgj+ +hDjGjEXXv5kdP3NHKdWOvUMUXFYlGZzrAwm4IIjzgRWRgE3yAfwzg2nQcDQJDhTo +ga/fU2nOH/Y/cwi1chl4Uw6qfeQ3RNHCDq8scRqJ014weHXBqh/5Hv8B9lW/6QxM +Jfd7WSa5K7u4VZsgXjRIc8HIUMaJnDC8Vfrh6OEh+TYp6Mbt8RvkqZvg8XyMsOLi +V9PIa7okQ1WQI0gwMrTGmD3osBntkr8M7F+LaIHqrP7kcH0fHo5t9uxM2RXVXzFh +G+Tdoewn3/UFDPpf6ZtALHuXI05XiveFxCmVEX0hs77VG37i2jIB96zDHx/MAnLO +RmyeLSA2H76EYYai3F6b8hzXPUKlGTliINxZ8s9MM5pY1UQPtaGIjGaIjj/I6AJj +CcShRklM2SlWPKL1xZyS0oqWcxJST8llhjOPnmvRS+N5cV6eGZc81qKKE80CAwEA +AQKCAgBF45sYiaDHyNOyhN//Xo8MTVIWqWGJWHk5JNVnWUPpakBIfSvkip0Qg6Il +2/d7jsy8AcnCnM2H4rhi9PYvM+uVZaPBBmYbjHyLvYDMJda3zU3+8aJMNgmh07Tg +DC8BNdaus8ilO0PQcdDZ72Y1JyR50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+RmopZLOvNqACupcZJcvepKvg +wbfpOuJQLL3EIJEx20j2OlmXZ9ECA4Pr//S8Pr0/g+EtIO9QYaAOPPuEiVQf8D8F +IESQXQtrGfcxBTWzx6iST6g8hC+Iog81kB76YFaINEJon3YXY44FLkGK//4= +-----END RSA PRIVATE KEY----- diff --git a/metricbeat/module/haproxy/_meta/certs/client.crt b/metricbeat/module/haproxy/_meta/certs/client.crt new file mode 100644 index 00000000000..d563eaae8c9 --- /dev/null +++ b/metricbeat/module/haproxy/_meta/certs/client.crt @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDmDCCAYACAQIwDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCVVMxEzARBgNV +BAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xFzAVBgNVBAMM +DmNhQGV4YW1wbGUuY29tMB4XDTIwMDIxNDEwNDMyOFoXDTMwMDIxMTEwNDMyOFow +VTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNh +biBGcmFuY2lzY28xGTAXBgNVBAMMEHVzZXJAZXhhbXBsZS5jb20wgZ8wDQYJKoZI +hvcNAQEBBQADgY0AMIGJAoGBAMVYMj/PUlPVtKVtK6dbOFNon05ucz/Vx8u+wJA+ +EW1rzRWLV9Bm9ipqUv5ixcmw5YpdvupDSpVFHEW/Cxk0aLIbPH8foUkJVaWiROtb +KHshwqK7raA1/gRB6gyTIpLWHJabcakOS9j8Lb4c0S4TJ9tPtE3AzsSO/sAFwtWy +Mw5RAgMBAAEwDQYJKoZIhvcNAQEFBQADggIBAMmYuks5znzWKa1ISJ68+JhYRbl/ +2KnjRtoYOSpAhTwWXWukLlQ5dTcwk50MOYKaGkso3vcIm4X16PD/N6Zbv0g4adlK +jfkw77Y65dmwv8KSxSFaC2zfKP/5WNG0VAQ28ikltQ1GqeFlBLYacdM/FhHvqJNe +KKSUlEMl0hc6ubp1/7DggDXNS7p4Q/W1HqcLSDoyUGT9aD7ooihHeyuO/fKLSM+4 +aZV6GHYsQEK5fBYi5FjrGJB/FgA7bj8p0n7ybrj94TJhqBM1L/mlpnxNRRG8Clwl +DjbwGjibn31pgfS32kpE2w0oOi/2DVTDeiSfdtfit30G2UXrS8twG8FDaOB2hM3m +6Yk1+Ov9s7NRO27ldxbqHN1A1QFE71Xl2wh5JKXi6XD/K8RAhNgR4f3CcNwXsSgy +b92eIUoh87VkMS+TNlDWa4hAPBR8D/0XCGDqK2G0GTHTq5I4zoNE7G4qYJY9akfJ +tYwNOZyhm6dWNRguSvbLBW9bFCRqEmJCceqJhuq8MjmC5cen4DxAkX5isF5GkB7A +ifEwRldzrt50VSQEEDJZGs07/H8SAftufRdDomqpU0lrFew7Cw2QbskW50eXGoHw +E6g7JJFkbdscIMI/mWpt816FA1CWlisap9gRX0oJTRS4Fm/Ei++vVyOgCDvHE9KZ +ZJFWv5Dlt3NM2Moz +-----END CERTIFICATE----- diff --git a/metricbeat/module/haproxy/_meta/certs/client.csr b/metricbeat/module/haproxy/_meta/certs/client.csr new file mode 100644 index 00000000000..579f86370b3 --- /dev/null +++ b/metricbeat/module/haproxy/_meta/certs/client.csr @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIBlDCB/gIBADBVMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEW +MBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEZMBcGA1UEAwwQdXNlckBleGFtcGxlLmNv +bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAxVgyP89SU9W0pW0rp1s4U2if +Tm5zP9XHy77AkD4RbWvNFYtX0Gb2KmpS/mLFybDlil2+6kNKlUUcRb8LGTRoshs8 +fx+hSQlVpaJE61soeyHCorutoDX+BEHqDJMiktYclptxqQ5L2PwtvhzRLhMn20+0 +TcDOxI7+wAXC1bIzDlECAwEAAaAAMA0GCSqGSIb3DQEBCwUAA4GBAKG0m6d7F1cK +qsxc/O+UF1tJ+4rUotDOaAq7hZWOsFbz0mTTiHRERggrj5DxF/ncoeQmFOR8qQ8j +kwWK/ppYU+Xl2dgrqW6pZqnRrnE6u9t1OqGp6OU4tOpZuMqaVt3BuEsGjhFgdoTu +5pQDOtf2b9PFd2I8RDypFj3lbVQRh+ck +-----END CERTIFICATE REQUEST----- diff --git a/metricbeat/module/haproxy/_meta/certs/client.key b/metricbeat/module/haproxy/_meta/certs/client.key new file mode 100644 index 00000000000..eecbb01b433 --- /dev/null +++ b/metricbeat/module/haproxy/_meta/certs/client.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICXQIBAAKBgQDFWDI/z1JT1bSlbSunWzhTaJ9ObnM/1cfLvsCQPhFta80Vi1fQ +ZvYqalL+YsXJsOWKXb7qQ0qVRRxFvwsZNGiyGzx/H6FJCVWlokTrWyh7IcKiu62g +Nf4EQeoMkyKS1hyWm3GpDkvY/C2+HNEuEyfbT7RNwM7Ejv7ABcLVsjMOUQIDAQAB +AoGAXXkzA+ptcmwtDpYxMSoR+d/6ZSoHyNq3shf+GdRsaMnA8E16IKpEOz71ZKzg +RnJVpz5UKZ4J+74qcBbXaO7cD3tsDOjDEpZoFD9ewmUML5qf7/INCa+JQzeBAdSv +Nkqh2jaD+/A/byj8Ar21CGxc2AOvbXzSmnzuAKQ4uVyI5uECQQDun9GjN9tGNeps +NOWu7MyPLvq/aXvF72ZKvSrbWRboKoB0f9aUqKkC8ahV0G/EZBGr9uEAw2Ow2mOy +xoUMy+sdAkEA07biMYOCw1lwCXzy9DULyerN/LhLMYE+HSRklQarAQcb8DutdhA/ +yaP3FbJUs/XPaHdEXw9s0Ca5CKt7gMjVxQJBAN93b92Ia6LezwAysX4VaKQWfOBQ +qob84TDQ4pe0YM1fMBjpt0xUfqKxKNHkdybWB+6hLqmGUY/HlWJQoz0OoskCQQCB +MugSg0j3YcsnXyL8uKp7DFmsUeNBULfRHPZso2cT93yrPB/9HqluqisNCIj8UZPD +EpWc1VL4K8lbaxqxWt5pAkBVL/cGFP8s3BfxmHjsBzte/SdR/TJMfBZG1NN2tXd/ +0gkY9q7MhECUqdoPc4JikGg2fULNlYEeHe6H38RGWmsm +-----END RSA PRIVATE KEY----- diff --git a/metricbeat/module/haproxy/_meta/certs/generate.sh b/metricbeat/module/haproxy/_meta/certs/generate.sh new file mode 100755 index 00000000000..0025955178f --- /dev/null +++ b/metricbeat/module/haproxy/_meta/certs/generate.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +export CA_SUBJECT='/C=US/ST=California/L=San Francisco/CN=ca@example.com' +export SERVER_SUBJECT='/C=US/ST=California/L=San Francisco/CN=webmaster@example.com' +export CLIENT_SUBJECT='/C=US/ST=California/L=San Francisco/CN=user@example.com' + +# certificate authority creation +openssl genrsa -out ca.key 4096 +openssl req -new -x509 -days 3650 -key ca.key -out ca.crt -subj "$CA_SUBJECT" + +# server certificate creation +openssl genrsa -out server.key 1024 +openssl req -new -key server.key -out server.csr -subj "$SERVER_SUBJECT" +openssl x509 -req -days 3650 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt + +# client certificate creation +openssl genrsa -out client.key 1024 +openssl req -new -key client.key -out client.csr -subj "$CLIENT_SUBJECT" +openssl x509 -req -days 3650 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 02 -out client.crt + +cat server.crt server.key > server.pem diff --git a/metricbeat/module/haproxy/_meta/certs/server.crt b/metricbeat/module/haproxy/_meta/certs/server.crt new file mode 100644 index 00000000000..4084ef7d918 --- /dev/null +++ b/metricbeat/module/haproxy/_meta/certs/server.crt @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDnTCCAYUCAQEwDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCVVMxEzARBgNV +BAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xFzAVBgNVBAMM +DmNhQGV4YW1wbGUuY29tMB4XDTIwMDIx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 +DQRxE3RhumX3Tok/CJrdkts= +-----END CERTIFICATE----- diff --git a/metricbeat/module/haproxy/_meta/certs/server.csr b/metricbeat/module/haproxy/_meta/certs/server.csr new file mode 100644 index 00000000000..b40cab40cab --- /dev/null +++ b/metricbeat/module/haproxy/_meta/certs/server.csr @@ -0,0 +1,11 @@ +-----BEGIN CERTIFICATE REQUEST----- +MIIBmjCCAQMCAQAwWjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx +FjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xHjAcBgNVBAMMFXdlYm1hc3RlckBleGFt +cGxlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAt0ZZbrUPPKCr2g5v +4psEjPxmMS+5xrvFxJHx8+telsL1ewFbBIPLzed7PsWEgC7ic8IbeLJpQUsTvXjs +SEQJ2R4a2Xs+401tJQCe+iHE0rBn7zk3SyGvS3vCxRnPaiBE0Y7CZVUVKQEPHOVT +E96pyVaVP7gFUWw99aYzOq19c9cCAwEAAaAAMA0GCSqGSIb3DQEBCwUAA4GBAGfj +3LhWQyoASGuzTq1/ME/dtRaykSZKeH+X2mcM0NtkSIXeUsEKiY7yta5y6yrCRsXE +STdjukNw2DR+gy7D3bQFlpagBvF2o/4svktmTEzUHxhvUH/39Lw6H/CGXAc/slv/ +9MYmVk7Q83Jfv2b5p7/sRrqSZ3FT3xmN+ebhMBH7 +-----END CERTIFICATE REQUEST----- diff --git a/metricbeat/module/haproxy/_meta/certs/server.key b/metricbeat/module/haproxy/_meta/certs/server.key new file mode 100644 index 00000000000..fd0f1d7288e --- /dev/null +++ b/metricbeat/module/haproxy/_meta/certs/server.key @@ -0,0 +1,15 @@ +-----BEGIN RSA PRIVATE KEY----- +MIICWwIBAAKBgQC3RllutQ88oKvaDm/imwSM/GYxL7nGu8XEkfHz616WwvV7AVsE +g8vN53s+xYSALuJzwht4smlBSxO9eOxIRAnZHhrZez7jTW0lAJ76IcTSsGfvOTdL +Ia9Le8LFGc9qIETRjsJlVRUpAQ8c5VMT3qnJVpU/uAVRbD31pjM6rX1z1wIDAQAB +AoGAXxWHdpFHG2w8XIAa+hT00nRsTF53YqyumSIixiq5wzvYgf2dDAWYqfXLkjCF +Yr9wSyBMgl0FkJNz5VwkMgXimTmB/fZeIZzZyYGwYP9Q0AQdeiV74Ilrqg2tpwHr +p1iZ4/99JpGVLBUBSANEb/vYEvtVBUFObGKuc+Okgno8AgkCQQDtD9nbHDaE/E5O +5dXALABvY29F4hsic37JfcJ1EPdoXqRVudMxeW3+hCXyMwL02wzJwW4NcTNKqari +/tbkPj27AkEAxep/vz7PyUvMxGV+w5F2eUOypwJZ5vkYTUpQMJvVnMMb09cNCkJt +5vQBFl+gJ279NxuJo76XmUtrlN/hmc8ylQJAF4mKXOn5M80FTWoehf0YcfbSdoLT +pOEIxqK46vyrQ+6ZrHVN1cyzsiCWz+xmr78MDwAomCcUK6aa8/zPg0v2vwJAWlmI +4+dqt/wwiF/FFMZtDULIZdF+9SA15eLM5MPfKmcvZu+/djWJMmulq28QD7BtTCD4 +HpY9Yq+5dwcVWD/sWQJAVoyl7HIUyTuax+IwOh0swE/5ftGvAw1ElyYcccWBaqYd +lLg4d/SVQFp+OnzfAhEnvpI7vzToupd7EsWT/cXzPw== +-----END RSA PRIVATE KEY----- diff --git a/metricbeat/module/haproxy/_meta/certs/server.pem b/metricbeat/module/haproxy/_meta/certs/server.pem new file mode 100644 index 00000000000..a1d77d3f846 --- /dev/null +++ b/metricbeat/module/haproxy/_meta/certs/server.pem @@ -0,0 +1,37 @@ +-----BEGIN CERTIFICATE----- +MIIDnTCCAYUCAQEwDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCVVMxEzARBgNV +BAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xFzAVBgNVBAMM +DmNhQGV4YW1wbGUuY29tMB4XDTIwMDIxNDEwNDMyOFoXDTMwMDIxMTEwNDMyOFow +W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ICATE----- +-----BEGIN RSA PRIVATE KEY----- +MIICWwIBAAKBgQC3RllutQ88oKvaDm/imwSM/GYxL7nGu8XEkfHz616WwvV7AVsE +g8vN53s+xYSALuJzwht4smlBSxO9eOxIRAnZHhrZez7jTW0lAJ76IcTSsGfvOTdL +Ia9Le8LFGc9qIETRjsJlVRUpAQ8c5VMT3qnJVpU/uAVRbD31pjM6rX1z1wIDAQAB +AoGAXxWHdpFHG2w8XIAa+hT00nRsTF53YqyumSIixiq5wzvYgf2dDAWYqfXLkjCF +Yr9wSyBMgl0FkJNz5VwkMgXimTmB/fZeIZzZyYGwYP9Q0AQdeiV74Ilrqg2tpwHr +p1iZ4/99JpGVLBUBSANEb/vYEvtVBUFObGKuc+Okgno8AgkCQQDtD9nbHDaE/E5O +5dXALABvY29F4hsic37JfcJ1EPdoXqRVudMxeW3+hCXyMwL02wzJwW4NcTNKqari +/tbkPj27AkEAxep/vz7PyUvMxGV+w5F2eUOypwJZ5vkYTUpQMJvVnMMb09cNCkJt +5vQBFl+gJ279NxuJo76XmUtrlN/hmc8ylQJAF4mKXOn5M80FTWoehf0YcfbSdoLT +pOEIxqK46vyrQ+6ZrHVN1cyzsiCWz+xmr78MDwAomCcUK6aa8/zPg0v2vwJAWlmI +4+dqt/wwiF/FFMZtDULIZdF+9SA15eLM5MPfKmcvZu+/djWJMmulq28QD7BtTCD4 +HpY9Yq+5dwcVWD/sWQJAVoyl7HIUyTuax+IwOh0swE/5ftGvAw1ElyYcccWBaqYd +lLg4d/SVQFp+OnzfAhEnvpI7vzToupd7EsWT/cXzPw== +-----END RSA PRIVATE KEY----- diff --git a/metricbeat/module/haproxy/_meta/haproxy.conf b/metricbeat/module/haproxy/_meta/haproxy.conf index a720525a228..83a829be21c 100644 --- a/metricbeat/module/haproxy/_meta/haproxy.conf +++ b/metricbeat/module/haproxy/_meta/haproxy.conf @@ -23,7 +23,7 @@ defaults option httplog option abortonclose option httpclose - option forwardfor + option forwardfor retries 3 option redispatch @@ -48,7 +48,15 @@ listen stat-auth stats uri /stats stats auth admin:admin -listen http-webservices +listen stat-https + + bind 0.0.0.0:14570 ssl crt /usr/local/etc/haproxy/server.pem ca-file /usr/local/etc/haproxy/ca.crt verify required + + mode http + stats enable + stats uri /stats + +listen http-webservices bind 0.0.0.0:8888 server log1 127.0.0.1:8889 check diff --git a/metricbeat/module/haproxy/docker-compose.yml b/metricbeat/module/haproxy/docker-compose.yml index 606cdc0bab8..e32cc0f1981 100644 --- a/metricbeat/module/haproxy/docker-compose.yml +++ b/metricbeat/module/haproxy/docker-compose.yml @@ -3,7 +3,7 @@ version: '2.3' services: haproxy: image: docker.elastic.co/integrations-ci/beats-haproxy:${HAPROXY_VERSION:-1.8.22}-1 - build: + build: context: ./_meta args: HAPROXY_VERSION: ${HAPROXY_VERSION:-1.8.22} @@ -11,3 +11,4 @@ services: - 14567 - 14568 - 14569 + - 14570 diff --git a/metricbeat/module/haproxy/test_haproxy.py b/metricbeat/module/haproxy/test_haproxy.py index f175d43d2c5..6804548971a 100644 --- a/metricbeat/module/haproxy/test_haproxy.py +++ b/metricbeat/module/haproxy/test_haproxy.py @@ -82,6 +82,23 @@ def test_stat_http(self): }]) self._test_stat() + @unittest.skipUnless(metricbeat.INTEGRATION_TESTS, "integration test") + def test_stat_https(self): + """ + haproxy stat https metricset test + """ + self.render_config_template(modules=[{ + "name": "haproxy", + "metricsets": ["stat"], + "hosts": ["https://%s/stats" % (self.compose_host(port="14570/tcp"))], + "period": "5s", + "extras": { + "ssl.certificate": os.path.join(os.path.dirname(__file__), '_meta/certs/client.crt'), + "ssl.key": os.path.join(os.path.dirname(__file__), '_meta/certs/client.key') + } + }]) + self._test_stat() + @unittest.skipUnless(metricbeat.INTEGRATION_TESTS, "integration test") def test_stat_http_auth(self): """ From 0aa0029dadc2ef38cc734573c840537bcb19a436 Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Fri, 14 Feb 2020 16:34:06 +0100 Subject: [PATCH 02/10] Add support for stats exposed over HTTPS --- metricbeat/module/haproxy/_meta/Dockerfile | 7 +- metricbeat/module/haproxy/_meta/certs/ca.crt | 56 +++++------ metricbeat/module/haproxy/_meta/certs/ca.key | 98 +++++++++---------- metricbeat/module/haproxy/_meta/certs/ca.pem | 30 ++++++ .../module/haproxy/_meta/certs/client.crt | 40 ++++---- .../module/haproxy/_meta/certs/client.csr | 18 ++-- .../module/haproxy/_meta/certs/client.key | 26 ++--- .../module/haproxy/_meta/certs/client.pem | 22 +++++ .../module/haproxy/_meta/certs/generate.sh | 11 ++- .../module/haproxy/_meta/certs/server.crt | 40 ++++---- .../module/haproxy/_meta/certs/server.csr | 18 ++-- .../module/haproxy/_meta/certs/server.key | 26 ++--- .../module/haproxy/_meta/certs/server.pem | 66 ++++++------- metricbeat/module/haproxy/haproxy.go | 46 +++------ metricbeat/module/haproxy/info/info.go | 11 ++- metricbeat/module/haproxy/stat/stat.go | 10 +- metricbeat/module/haproxy/test_haproxy.py | 5 +- 17 files changed, 287 insertions(+), 243 deletions(-) create mode 100644 metricbeat/module/haproxy/_meta/certs/ca.pem create mode 100644 metricbeat/module/haproxy/_meta/certs/client.pem diff --git a/metricbeat/module/haproxy/_meta/Dockerfile b/metricbeat/module/haproxy/_meta/Dockerfile index 9d4a8339134..42a01358ee3 100644 --- a/metricbeat/module/haproxy/_meta/Dockerfile +++ b/metricbeat/module/haproxy/_meta/Dockerfile @@ -1,8 +1,11 @@ ARG HAPROXY_VERSION FROM haproxy:${HAPROXY_VERSION} RUN apt-get update && apt-get install -y netcat -HEALTHCHECK --interval=1s --retries=90 CMD nc -z localhost 14567 + +HEALTHCHECK --interval=1s --retries=90 CMD nc -z localhost 14567 && nc -z localhost 14570 + COPY ./haproxy.conf /usr/local/etc/haproxy/haproxy.cfg COPY ./certs/server.pem /usr/local/etc/haproxy/server.pem COPY ./certs/ca.crt /usr/local/etc/haproxy/ca.crt -EXPOSE 14567 + +EXPOSE 14567 14568 14569 14570 diff --git a/metricbeat/module/haproxy/_meta/certs/ca.crt b/metricbeat/module/haproxy/_meta/certs/ca.crt index d0a1aa9f977..4a1467ee575 100644 --- a/metricbeat/module/haproxy/_meta/certs/ca.crt +++ b/metricbeat/module/haproxy/_meta/certs/ca.crt @@ -1,30 +1,30 @@ -----BEGIN CERTIFICATE----- -MIIFIjCCAwoCCQC8H+mzLzihlTANBgkqhkiG9w0BAQsFADBTMQswCQYDVQQGEwJV -UzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEX -MBUGA1UEAwwOY2FAZXhhbXBsZS5jb20wHhcNMjAwMjE0MTA0MzI4WhcNMzAwMjEx -MTA0MzI4WjBTMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQG -A1UEBwwNU2FuIEZyYW5jaXNjbzEXMBUGA1UEAwwOY2FAZXhhbXBsZS5jb20wggIi -MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDv7tkjp2dAGGZIsNVVByPKNBBA -vLXg3JrUH2n4NEoq1ZDya+4bY+1f/9I1/ahmAGEgkR8kzhbcMr9pjlnL8XJ1wfQF -LanTWiT2IXqeKwEs3uaoevYFUJ6qz02/svWV6PyZ39xJ+CD8L8HvNr4AqWtEcPGu -vkX3z00UqBjwKuWmskL2/QroZNtTADf5P+q7mgTVXfMsGZSBRTtiZv/5vjfnwLUh -RHdU7Xz5Y6Hk79fOT8aGCP6EOMaMRde/mR0/c0cp1Y69QxRcViUZnOsDCbggiPOB -FZGATfIB/DODadBwNAkOFOiBr99Tac4f9j9zCLVyGXhTDqp95DdE0cIOryxxGonT -XjB4dcGqH/ke/wH2Vb/pDEwl93tZJrkru7hVmyBeNEhzwchQxomcMLxV+uHo4SH5 -Ninoxu3xG+Spm+DxfIyw4uJX08hruiRDVZAjSDAytMaYPeiwGe2SvwzsX4togeqs -/uRwfR8ejm327EzZFdVfMWEb5N2h7Cff9QUM+l/pm0Ase5cjTleK94XEKZURfSGz -vtUbfuL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FcfEXAznBEJ2+zWQ8hiBXwgZXCFclKJsfxRhm8lhSUPE2 +k7DSWwmqVF1/Pvf8dY/QxESrHEdeHuB7QjPcvXPRZ9s01bZQJwFo92UwmkhnWJMg +nl3imYhypiWWlGPM2qhMmVrCPdipaxvlxTGUXRhDIOW7XvQFkqyG+abZfWthHwWX +ILURqpBgG4ZQu/S9Insx0XQbw/hKATdSgJ1RvZ7dFsaGG439hujv7Iw6VC7KS+JF +BN9ecA42eNB6AJiC4wJdSEm5N+cI2+SLNpavaywNEnxWUOYSDFmFdedk6MxZh+SK +zcY5Zpda1cqTZbZcWb5ewR20p9CrgRqsLYB5fxaOuGKF/mIyChezwYG6g5YvqHOm +K+gq/MxpVCTIjx+pFT3Y0eTv3+S4+o/R9vS/K8MokGrBqkui78eqJylW8rWWqBBc +QBSI6y7hEs9KaP84dj5PtO1YCSAbLV/MC0G0/sJVGn8PSdiKTp5uMHpoozgaW6+j +LuWTqxnwHUNupqZ6DvO8VPHT -----END CERTIFICATE----- diff --git a/metricbeat/module/haproxy/_meta/certs/ca.key b/metricbeat/module/haproxy/_meta/certs/ca.key index df6ff437f12..f08ff369556 100644 --- a/metricbeat/module/haproxy/_meta/certs/ca.key +++ b/metricbeat/module/haproxy/_meta/certs/ca.key @@ -1,51 +1,51 @@ -----BEGIN RSA PRIVATE KEY----- -MIIJKAIBAAKCAgEA7+7ZI6dnQBhmSLDVVQcjyjQQQLy14Nya1B9p+DRKKtWQ8mvu -G2PtX//SNf2oZgBhIJEfJM4W3DK/aY5Zy/FydcH0BS2p01ok9iF6nisBLN7mqHr2 -BVCeqs9Nv7L1lej8md/cSfgg/C/B7za+AKlrRHDxrr5F989NFKgY8CrlprJC9v0K -6GTbUwA3+T/qu5oE1V3zLBmUgUU7Ymb/+b4358C1IUR3VO18+WOh5O/Xzk/Ghgj+ -hDjGjEXXv5kdP3NHKdWOvUMUXFYlGZzrAwm4IIjzgRWRgE3yAfwzg2nQcDQJDhTo -ga/fU2nOH/Y/cw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i55XMp8tfn8lSG/Ijy855JZBnY1Pl5WOwzeEM/fcQzcVy+R/aQ +Sy8bOwZF2nY6NZ/qGIMDbdl1CgmUmUVFieNqkdhSRF7FwW5u8AzMK9K5cCQRUmRD +fMbPG2Maaeh6jYOe7YvGbSXaiitbnbQ1d/uR7CiK1aiJrIDDzuW11/ItDFDsWihd +XLofA9408uHSKwVtOH+xQ7KlITu8TCxAWTtdkKXcPUZoxNWz4CZ3ryM/GJc9cjka +T2KYnski3BFC8wJSYZu53orVCdQv22nPsQKCAQEAvnq3p0weY7393nVc5OSKhnvA +eyoFi7r+o9PeGqioR+U4I9ex0aZExjMoqavW8R6PpK3oeZm9lyNm6rm8unI/dfXw +jgkJZ6DV4sedANBH3fR3v10NZnNv64DyVYZjhA8UJNFK2zDpW9pn5efFEWNTc4nh +AsSoOXJxBJGS8MKg11jV1XP/+STMxf2X1D9lZJ0pqXmWN0oKxiT9PzDsHNXPwJR4 +yyEk20M1qDZDDUQ8jQmCzUB6iz8RDfNLzVxQwB52jZXN/v3YYpOPUZ7wIcYaj8WV +kuynr+nWVfdDJMbUFKa43h2cFMZk8akZfpahC/xI6qBnWA+IfyKOiEJcxBb7ww== -----END RSA PRIVATE KEY----- diff --git a/metricbeat/module/haproxy/_meta/certs/ca.pem b/metricbeat/module/haproxy/_meta/certs/ca.pem new file mode 100644 index 00000000000..4a1467ee575 --- /dev/null +++ b/metricbeat/module/haproxy/_meta/certs/ca.pem @@ -0,0 +1,30 @@ +-----BEGIN CERTIFICATE----- +MIIFHjCCAwYCCQDyebXXoth88jANBgkqhkiG9w0BAQsFADBRMQswCQYDVQQGEwJV +UzETMBEGA1UECAwKQ2FsaWZvcm5pYTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEV +MBMGA1UEAwwMY2FAbG9jYWxob3N0MB4XDTIwMDIxNDE1MzAzOVoXDTMwMDIxMTE1 +MzAzOVowUTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAU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dY/QxESrHEdeHuB7QjPcvXPRZ9s01bZQJwFo92UwmkhnWJMg +nl3imYhypiWWlGPM2qhMmVrCPdipaxvlxTGUXRhDIOW7XvQFkqyG+abZfWthHwWX +ILURqpBgG4ZQu/S9Insx0XQbw/hKATdSgJ1RvZ7dFsaGG439hujv7Iw6VC7KS+JF +BN9ecA42eNB6AJiC4wJdSEm5N+cI2+SLNpavaywNEnxWUOYSDFmFdedk6MxZh+SK +zcY5Zpda1cqTZbZcWb5ewR20p9CrgRqsLYB5fxaOuGKF/mIyChezwYG6g5YvqHOm +K+gq/MxpVCTIjx+pFT3Y0eTv3+S4+o/R9vS/K8MokGrBqkui78eqJylW8rWWqBBc +QBSI6y7hEs9KaP84dj5PtO1YCSAbLV/MC0G0/sJVGn8PSdiKTp5uMHpoozgaW6+j +LuWTqxnwHUNupqZ6DvO8VPHT +-----END CERTIFICATE----- diff --git a/metricbeat/module/haproxy/_meta/certs/client.crt b/metricbeat/module/haproxy/_meta/certs/client.crt index d563eaae8c9..adebb8c47ef 100644 --- a/metricbeat/module/haproxy/_meta/certs/client.crt +++ b/metricbeat/module/haproxy/_meta/certs/client.crt @@ -1,22 +1,22 @@ -----BEGIN CERTIFICATE----- -MIIDmDCCAYACAQIwDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCVVMxEzARBgNV -BAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xFzAVBgNVBAMM -DmNhQGV4YW1wbGUuY29tMB4XDTIwMDIxNDEwNDMyOFoXDTMwMDIxMTEwNDMyOFow -VTELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNh -biBGcmFuY2lzY28xGTAXBgNVBAMMEHVzZXJAZXhhbXBsZS5jb20wgZ8wDQYJKoZI -hvcNAQEBBQADgY0AMIGJAoGBAMVYMj/PUlPVtKVtK6dbOFNon05ucz/Vx8u+wJA+ -EW1rzRWLV9Bm9ipqUv5ix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metricbeat/module/haproxy/_meta/certs/client.csr index 579f86370b3..e2fb9882ca7 100644 --- a/metricbeat/module/haproxy/_meta/certs/client.csr +++ b/metricbeat/module/haproxy/_meta/certs/client.csr @@ -1,11 +1,11 @@ -----BEGIN CERTIFICATE REQUEST----- -MIIBlDCB/gIBADBVMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEW -MBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEZMBcGA1UEAwwQdXNlckBleGFtcGxlLmNv -bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAxVgyP89SU9W0pW0rp1s4U2if -Tm5zP9XHy77AkD4RbWvNFYtX0Gb2KmpS/mLFybDlil2+6kNKlUUcRb8LGTRoshs8 -fx+hSQlVpaJE61soeyHCorutoDX+BEHqDJMiktYclptxqQ5L2PwtvhzRLhMn20+0 -TcDOxI7+wAXC1bIzDlECAwEAAaAAMA0GCSqGSIb3DQEBCwUAA4GBAKG0m6d7F1cK -qsxc/O+UF1tJ+4rUotDOaAq7hZWOsFbz0mTTiHRERggrj5DxF/ncoeQmFOR8qQ8j -kwWK/ppYU+Xl2dgrqW6pZqnRrnE6u9t1OqGp6OU4tOpZuMqaVt3BuEsGjhFgdoTu -5pQDOtf2b9PFd2I8RDypFj3lbVQRh+ck +MIIBjTCB9wIBADBOMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEW +MBQGA1UEBwwNU2FuIEZyYW5jaXNjbzESMBAGA1UEAwwJbG9jYWxob3N0MIGfMA0G +CSqGSIb3DQEBAQUAA4GNADCBiQKBgQC1Z/14QWPPk3h06hFIrP8eJpCCSG2i9gLQ +5Oo3IW3G8CZFf3JepMrJcV4BeXdv0FnddkMVG0CMs5L9eQ2oARK7VkiZmLV9VU9W +/dEvgkTtmQ42+25Z83WAUnqI0QqRxHw1n54pgrhXy0kmaQ2h5uFmFDpOWdpFBRII +ktODPWoZIwIDAQABoAAwDQYJKoZIhvcNAQELBQADgYEADftPLHJCElz0m4dMiI4V +Db3jC6X5dtEB2QE0kiGmkbvYL+8YOBgag7bC/6FvniFrc+9ntrqQZNvWycfy/7Mg +GY+tYm1meFV02dbR+LafNfyNX9ztjDo1TNJgBJooFlxsM5weL9oSrmlK5BDDLEoz +JYBXa0PU7BRMKxOAfE2Lqmc= -----END CERTIFICATE REQUEST----- diff --git a/metricbeat/module/haproxy/_meta/certs/client.key b/metricbeat/module/haproxy/_meta/certs/client.key index eecbb01b433..a8013734b49 100644 --- a/metricbeat/module/haproxy/_meta/certs/client.key +++ b/metricbeat/module/haproxy/_meta/certs/client.key @@ -1,15 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQDFWDI/z1JT1bSlbSunWzhTaJ9ObnM/1cfLvsCQPhFta80Vi1fQ -ZvYqalL+YsXJsOWKXb7qQ0qVRRxFvwsZNGiyGzx/H6FJCVWlokTrWyh7IcKiu62g -Nf4EQeoMkyKS1hyWm3GpDkvY/C2+HNEuEyfbT7RNwM7Ejv7ABcLVsjMOUQIDAQAB -AoGAXXkzA+ptcmwtDpYxMSoR+d/6ZSoHyNq3shf+GdRsaMnA8E16IKpEOz71ZKzg -RnJVpz5UKZ4J+74qcBbXaO7cD3tsDOjDEpZoFD9ewmUML5qf7/INCa+JQzeBAdSv -Nkqh2jaD+/A/byj8Ar21CGxc2AOvbXzSmnzuAKQ4uVyI5uECQQDun9GjN9tGNeps -NOWu7MyPLvq/aXvF72ZKvSrbWRboKoB0f9aUqKkC8ahV0G/EZBGr9uEAw2Ow2mOy -xoUMy+sdAkEA07biMYOCw1lwCXzy9DULyerN/LhLMYE+HSRklQarAQcb8DutdhA/ -yaP3FbJUs/XPaHdEXw9s0Ca5CKt7gMjVxQJBAN93b92Ia6LezwAysX4VaKQWfOBQ -qob84TDQ4pe0YM1fMBjpt0xUfqKxKNHkdybWB+6hLqmGUY/HlWJQoz0OoskCQQCB -MugSg0j3YcsnXyL8uKp7DFmsUeNBULfRHPZso2cT93yrPB/9HqluqisNCIj8UZPD -EpWc1VL4K8lbaxqxWt5pAkBVL/cGFP8s3BfxmHjsBzte/SdR/TJMfBZG1NN2tXd/ -0gkY9q7MhECUqdoPc4JikGg2fULNlYEeHe6H38RGWmsm +MIICXAIBAAKBgQC1Z/14QWPPk3h06hFIrP8eJpCCSG2i9gLQ5Oo3IW3G8CZFf3Je +pMrJcV4BeXdv0FnddkMVG0CMs5L9eQ2oARK7VkiZmLV9VU9W/dEvgkTtmQ42+25Z +83WAUnqI0QqRxHw1n54pgrhXy0kmaQ2h5uFmFDpOWdpFBRIIktODPWoZIwIDAQAB +AoGARub5M9pi94vNJe0iikRLhm5ORw2mBG6hFSKTxK6FKJ9OZhV1Dzbbp7Zupqbi +HsrRhPSnLYW0SgoZ5oY85zBcMEHxC7HCeH0rhmZkGTgD+2x/0oDXOuH/kmTegCh5 +O8hShwIBSULIg99VH8JOejBj82Wpf5Y3VqaGVjSNWo6HPdkCQQDeznoKrIk3hzpq ++7YaXJs8lXbGZ6xz4WpS4pp23Xrdsdiec/EwUnpDKc9CDTVvYm6fawVRf6rA3oYp +3wFA9h/NAkEA0G6QTPs/xo168vj6MwQ4kk7D8DWF5ja6CbLYU05lutK5n/0p62ul +OesUhF/kjsfqf2yuOefXV4zMv15vQh/MrwJAcfDvkoPXjFEYe9uLrgGL1bitzBr6 +oyw0vnxp972d9r/bgnTSdB7JrY01E5dDq1mQLvCBAMOkJAvoWoNT1c/IRQJBAI4C +hrasiKtTQe3BzVZtDc5BdCZ5kR1lNCPfgpxf0dgUMvzalHEeCpkHnhcC7sqJUzA2 +cA5r88Bm4imQweUfnWkCQECZa3sHls3tNtFbEQ1p8JOb6iRLAKTe0pEhfhEAkVGA +zVghjTIOAB8bBjwqa7hLl2G31tanpdMfySyxDKyecpc= -----END RSA PRIVATE KEY----- diff --git a/metricbeat/module/haproxy/_meta/certs/client.pem b/metricbeat/module/haproxy/_meta/certs/client.pem new file mode 100644 index 00000000000..adebb8c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TS3UX5aXuJI2VfafxnLsP9XCNeqzFFuomAu6Mq93M9yHbBtBFJkkm+nL/z +OVUiFjcqYlDcL8Dqi60EgjLewa90+k7eTmEj7Z8i4IwJL9pSXcfCpB5M0ZIZgdsa +nGITtg4bZJywAYJzKlgrql1oYecNfUAr8ltXXXbBb1C3WBsVBlJghbp3OjFur3RY +3Y9E81l4lScP2YcPrFEo2tJvetEOPjg78h0WmzrmjPzRCc0CUWvA+/45GL7fon4A +IDll +-----END CERTIFICATE----- diff --git a/metricbeat/module/haproxy/_meta/certs/generate.sh b/metricbeat/module/haproxy/_meta/certs/generate.sh index 0025955178f..4f436433a98 100755 --- a/metricbeat/module/haproxy/_meta/certs/generate.sh +++ b/metricbeat/module/haproxy/_meta/certs/generate.sh @@ -1,21 +1,22 @@ #!/bin/bash -export CA_SUBJECT='/C=US/ST=California/L=San Francisco/CN=ca@example.com' -export SERVER_SUBJECT='/C=US/ST=California/L=San Francisco/CN=webmaster@example.com' -export CLIENT_SUBJECT='/C=US/ST=California/L=San Francisco/CN=user@example.com' +export CA_SUBJECT='/C=US/ST=California/L=San Francisco/CN=ca@localhost' +export SERVER_SUBJECT='/C=US/ST=California/L=San Francisco/CN=localhost' +export CLIENT_SUBJECT='/C=US/ST=California/L=San Francisco/CN=localhost' # certificate authority creation openssl genrsa -out ca.key 4096 openssl req -new -x509 -days 3650 -key ca.key -out ca.crt -subj "$CA_SUBJECT" +openssl x509 -in ca.crt -out ca.pem -outform PEM # server certificate creation openssl genrsa -out server.key 1024 openssl req -new -key server.key -out server.csr -subj "$SERVER_SUBJECT" openssl x509 -req -days 3650 -in server.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out server.crt +cat server.crt server.key > server.pem # client certificate creation openssl genrsa -out client.key 1024 openssl req -new -key client.key -out client.csr -subj "$CLIENT_SUBJECT" openssl x509 -req -days 3650 -in client.csr -CA ca.crt -CAkey ca.key -set_serial 02 -out client.crt - -cat server.crt server.key > server.pem +openssl x509 -in client.crt -out client.pem -outform PEM diff --git a/metricbeat/module/haproxy/_meta/certs/server.crt b/metricbeat/module/haproxy/_meta/certs/server.crt index 4084ef7d918..1590e38f92c 100644 --- a/metricbeat/module/haproxy/_meta/certs/server.crt +++ b/metricbeat/module/haproxy/_meta/certs/server.crt @@ -1,22 +1,22 @@ -----BEGIN CERTIFICATE----- -MIIDnTCCAYUCAQEwDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCVVMxEzARBgNV -BAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xFzAVBgNVBAMM -DmNhQGV4YW1wbGUuY29tMB4XDTIwMDIxNDEwNDMyOFoXDTMwMDIxMTEwNDMyOFow -WjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNh -biBGcmFuY2lzY28xHjAcBgNVBAMMFXdlYm1hc3RlckBleGFtcGxlLmNvbTCBnzAN -BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAt0ZZbrUPPKCr2g5v4psEjPxmMS+5xrvF -xJHx8+telsL1ewFbBIPLzed7PsWEgC7ic8IbeLJpQUsTvXjsSEQJ2R4a2Xs+401t -JQCe+iHE0rBn7zk3SyGvS3vCxRnPaiBE0Y7CZVUVKQEPHOVTE96pyVaVP7gFUWw9 -9aYzOq19c9cCAwEAATANBgkqhkiG9w0BAQUFAAOCAgEA6giad1A/tSIaV9SujD3w -hCXBj6pkbjRUzvu2StU99P9l2FAv/OwxxfVG6vOoFZPqQWLW4iz0fCYBu/z91/zl -MW3lBQV7rJdmCQ1TUHLp/lU8BlyHcjjfu3OO9sXrzamr1oEvkeUvKAZjm15iTrhz -N+dUfrzh+qNWw9t5PEuCubi6o8lmzaQdeTey7obYzD1ljjq+pBOFkcj/CfsELx9s -WBNOWLlDcEp61crHDMmCACEMVHkHRF9R40Yp8jD9y/Pg6otN/xapQ1jSzS+lx2Ri -w12/v8bcv/CvlBXgX1tHSStZ09gR7owPOXlquF4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LeKGkzZbwh3VRyUSaPPSG +vL94OPzSwyF9sJVzvx36O5b5wQ/EN688y8ZqxOABt6XbfmmwFAVhSVBIv9ak7vao +O8POzMLtXmaplN08N+xI1HxMTVa/FLmNnsTHSeCbQEMkhATRwt0KRud6Mz/B/MaZ +K5Cumzsn26vCC2Tu59vbH0mcZf8PaSLrfkFR6pJCBzWn0dL4jse+MWy/X+LhvwZi +xm9JkNhTNTNVZmoyF+tYZ27YH7VFxAeLKk0PKP8ywkzVhAnKAYOV/J7tmwUUCnXU +RxuIUC4kKDnzi3HLftDXNFpxT1eKFwQ4oRuHqqZeu1bMgo6XNb3GV0kpT5QGzbtO +vJysh3KcgMhVmGMwStMuWKtAiFPF2FSVX56/q6NQh0yJ9AVu3b4UnVIq/Ir/+yDD +lgEq+bac8buaGe3ewwwm8HhuCmCqPv0+kZMYGZjzzJ4RZKXhiWUroNhDmSZO5TEh +B+NOlp0F2C1fLhDRZOwY1kYiHYCMm2+tH5VEimbqa+DHko2k8oCsVeh8+pt2sebl +/s7w -----END CERTIFICATE----- diff --git a/metricbeat/module/haproxy/_meta/certs/server.csr b/metricbeat/module/haproxy/_meta/certs/server.csr index b40cab40cab..f4dd37ac735 100644 --- a/metricbeat/module/haproxy/_meta/certs/server.csr +++ b/metricbeat/module/haproxy/_meta/certs/server.csr @@ -1,11 +1,11 @@ -----BEGIN CERTIFICATE REQUEST----- -MIIBmjCCAQMCAQAwWjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWEx -FjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xHjAcBgNVBAMMFXdlYm1hc3RlckBleGFt -cGxlLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAt0ZZbrUPPKCr2g5v -4psEjPxmMS+5xrvFxJHx8+telsL1ewFbBIPLzed7PsWEgC7ic8IbeLJpQUsTvXjs -SEQJ2R4a2Xs+401tJQCe+iHE0rBn7zk3SyGvS3vCxRnPaiBE0Y7CZVUVKQEPHOVT -E96pyVaVP7gFUWw99aYzOq19c9cCAwEAAaAAMA0GCSqGSIb3DQEBCwUAA4GBAGfj -3LhWQyoASGuzTq1/ME/dtRaykSZKeH+X2mcM0NtkSIXeUsEKiY7yta5y6yrCRsXE -STdjukNw2DR+gy7D3bQFlpagBvF2o/4svktmTEzUHxhvUH/39Lw6H/CGXAc/slv/ -9MYmVk7Q83Jfv2b5p7/sRrqSZ3FT3xmN+ebhMBH7 +MIIBjTCB9wIBADBOMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2FsaWZvcm5pYTEW +MBQGA1UEBwwNU2FuIEZyYW5jaXNjbzESMBAGA1UEAwwJbG9jYWxob3N0MIGfMA0G +CSqGSIb3DQEBAQUAA4GNADCBiQKBgQClwWWr9/KfFL5qRMM3SnrYPqF/u5o5njPr +8TpJUo/rZfIXzqfEtePENgxNPG9Mf2Z7sorRTzt5htuPm19Z9mZhsDd78lQ0lfMi +96YfkiZfoLpvLbaqGFZBRhikCpwLNgXQX93ccXaTWoLeqePB0mDVmBzuLKLLXvke +Pa+lAmaDeQIDAQABoAAwDQYJKoZIhvcNAQELBQADgYEAjlJJcJsKt3Yg4nSGPY2H +P0KHydW/vmks6GAON2WtAGNjwKN1QTAO5LOMeY5PcKGiw6ImfaSUz52ag4Bg2pqm +yjnHqUtK/RQuFM8wHjNmjDZDcXb3vx6nW8J8tL2ve2lXrWxBD1oCcUWPT3H7QwR1 ++ml6RdZMbHtbHLGqc4gg2q8= -----END CERTIFICATE REQUEST----- diff --git a/metricbeat/module/haproxy/_meta/certs/server.key b/metricbeat/module/haproxy/_meta/certs/server.key index fd0f1d7288e..38577f148cb 100644 --- a/metricbeat/module/haproxy/_meta/certs/server.key +++ b/metricbeat/module/haproxy/_meta/certs/server.key @@ -1,15 +1,15 @@ -----BEGIN RSA PRIVATE KEY----- -MIICWwIBAAKBgQC3RllutQ88oKvaDm/imwSM/GYxL7nGu8XEkfHz616WwvV7AVsE -g8vN53s+xYSALuJzw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B5aAJeLposcTXwJUW/xAg8M61SSzPg5K14aXWWAV8oECQQDVMGzhF+8HJYpd +rY85IeDT6bTFGV4XsxsEFYjRU8y+yYOqGKGtYYjYMFh9TCYWRxq9gzIslkrYLI1z +TZnFc8PxAkEAxwqDD5AYG5R2gCOpztlEiu84P89IHJIa9/4ggIA7SMQ14VSO3AUJ +rWZME50VwoeYFYVtDstTezqo1Qy/6r6gCQJAQ2eRNUYs9BSBgAbtHsJAZKAi4KKZ +pmKhqxPn809MkBIEyBYLoFcTPk9i2xLlg+utX7gIeCJ4vYqwmoExmkV08QJBAL5A +cwQGNLTwFNDoxeAc1yKCBF8hz4jXswWGmCSb7Y7hVasbey4ddqGTHXbF+M2ndBxm +G9c/TH2GlWiHtk44hZkCQQDCbLT0uFlZxpN5OTAq2a58vmwDcJ2XjXdF+jAXmkbE +gYel1LbxpHM/uh81J+5wO89zYZd/pn9J8IFn6IlvrzyF -----END RSA PRIVATE KEY----- diff --git a/metricbeat/module/haproxy/_meta/certs/server.pem b/metricbeat/module/haproxy/_meta/certs/server.pem index a1d77d3f846..3e7fed00554 100644 --- a/metricbeat/module/haproxy/_meta/certs/server.pem +++ b/metricbeat/module/haproxy/_meta/certs/server.pem @@ -1,37 +1,37 @@ -----BEGIN CERTIFICATE----- -MIIDnTCCAYUCAQEwDQYJKoZIhvcNAQEFBQAwUzELMAkGA1UEBhMCVVMxEzARBgNV -BAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNhbiBGcmFuY2lzY28xFzAVBgNVBAMM -DmNhQGV4YW1wbGUuY29tMB4XDTIwMDIxNDEwNDMyOFoXDTMwMDIxMTEwNDMyOFow -WjELMAkGA1UEBhMCVVMxEzARBgNVBAgMCkNhbGlmb3JuaWExFjAUBgNVBAcMDVNh -biBGcmFuY2lzY28xHjAcBgNVBAMMFXdlYm1hc3RlckBleGFtcGxlLmNvbTCBnzAN -BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAt0ZZbrUPPKCr2g5v4psE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HF0t+TzeH/6ZooS9sVysbNjawP4ZPmzU +RmIqmoE3O4nTPg24UBuJzwgmwW1vq5wZ0jEPYNDLSFXv3Qr5UPEH9zVc5TfDGn9h +k7klB5aAJeLposcTXwJUW/xAg8M61SSzPg5K14aXWWAV8oECQQDVMGzhF+8HJYpd +rY85IeDT6bTFGV4XsxsEFYjRU8y+yYOqGKGtYYjYMFh9TCYWRxq9gzIslkrYLI1z +TZnFc8PxAkEAxwqDD5AYG5R2gCOpztlEiu84P89IHJIa9/4ggIA7SMQ14VSO3AUJ +rWZME50VwoeYFYVtDstTezqo1Qy/6r6gCQJAQ2eRNUYs9BSBgAbtHsJAZKAi4KKZ +pmKhqxPn809MkBIEyBYLoFcTPk9i2xLlg+utX7gIeCJ4vYqwmoExmkV08QJBAL5A +cwQGNLTwFNDoxeAc1yKCBF8hz4jXswWGmCSb7Y7hVasbey4ddqGTHXbF+M2ndBxm +G9c/TH2GlWiHtk44hZkCQQDCbLT0uFlZxpN5OTAq2a58vmwDcJ2XjXdF+jAXmkbE +gYel1LbxpHM/uh81J+5wO89zYZd/pn9J8IFn6IlvrzyF -----END RSA PRIVATE KEY----- diff --git a/metricbeat/module/haproxy/haproxy.go b/metricbeat/module/haproxy/haproxy.go index 8a7089f1323..efd5b822fd7 100644 --- a/metricbeat/module/haproxy/haproxy.go +++ b/metricbeat/module/haproxy/haproxy.go @@ -23,15 +23,15 @@ import ( "io" "io/ioutil" "net" - "net/http" "net/url" "strings" - - "github.com/elastic/beats/metricbeat/mb/parse" - + "github.com/gocarina/gocsv" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" + + "github.com/elastic/beats/metricbeat/helper" + "github.com/elastic/beats/metricbeat/mb/parse" ) // HostParser is used for parsing the configured HAProxy hosts. @@ -167,7 +167,7 @@ type Client struct { } // NewHaproxyClient returns a new instance of HaproxyClient -func NewHaproxyClient(address string) (*Client, error) { +func NewHaproxyClient(address string, http *helper.HTTP) (*Client, error) { u, err := url.Parse(address) if err != nil { return nil, errors.Wrap(err, "invalid url") @@ -179,7 +179,7 @@ func NewHaproxyClient(address string) (*Client, error) { case "unix": return &Client{&unixProto{Network: u.Scheme, Address: u.Path}}, nil case "http", "https": - return &Client{&httpProto{URL: u}}, nil + return &Client{&httpProto{HTTP: http}}, nil default: return nil, errors.Errorf("invalid protocol scheme: %s", u.Scheme) } @@ -286,44 +286,20 @@ func (p *unixProto) Info() (*bytes.Buffer, error) { } type httpProto struct { - URL *url.URL + HTTP *helper.HTTP } func (p *httpProto) Stat() (*bytes.Buffer, error) { - url := p.URL.String() // Force csv format - if !strings.HasSuffix(url, ";csv") { - url += ";csv" + if !strings.HasSuffix(p.HTTP.GetURI(), ";csv") { + p.HTTP.SetURI(p.HTTP.GetURI() + ";csv") } - req, err := http.NewRequest("GET", url, nil) + b, err := p.HTTP.FetchContent() if err != nil { return nil, err } - - if p.URL.User != nil { - password, _ := p.URL.User.Password() - req.SetBasicAuth(p.URL.User.Username(), password) - } - - resp, err := http.DefaultClient.Do(req) - if err != nil { - return nil, errors.Errorf("couldn't connect: %v", err) - } - defer resp.Body.Close() - - if resp.StatusCode != http.StatusOK { - return nil, errors.Errorf("invalid response: %s", resp.Status) - } - - d, err := ioutil.ReadAll(resp.Body) - if err != nil { - return nil, errors.Errorf("couldn't read response body: %v", err) - } - if len(d) == 0 { - return nil, errors.New("got empty response from HAProxy") - } - return bytes.NewBuffer(d), nil + return bytes.NewBuffer(b), nil } func (p *httpProto) Info() (*bytes.Buffer, error) { diff --git a/metricbeat/module/haproxy/info/info.go b/metricbeat/module/haproxy/info/info.go index 4a361efb204..9d3e2e163f5 100644 --- a/metricbeat/module/haproxy/info/info.go +++ b/metricbeat/module/haproxy/info/info.go @@ -19,6 +19,7 @@ package info import ( "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/metricbeat/helper" "github.com/elastic/beats/metricbeat/mb" "github.com/elastic/beats/metricbeat/module/haproxy" @@ -44,17 +45,21 @@ func init() { // MetricSet for haproxy info. type MetricSet struct { mb.BaseMetricSet + *helper.HTTP } // New creates a haproxy info MetricSet. func New(base mb.BaseMetricSet) (mb.MetricSet, error) { - return &MetricSet{BaseMetricSet: base}, nil + http, err := helper.NewHTTP(base) + if err != nil { + return nil, err + } + return &MetricSet{BaseMetricSet: base, HTTP: http}, nil } // Fetch fetches info stats from the haproxy service. func (m *MetricSet) Fetch(reporter mb.ReporterV2) error { - - hapc, err := haproxy.NewHaproxyClient(m.HostData().URI) + hapc, err := haproxy.NewHaproxyClient(m.HostData().URI, m.HTTP) if err != nil { return errors.Wrap(err, "failed creating haproxy client") } diff --git a/metricbeat/module/haproxy/stat/stat.go b/metricbeat/module/haproxy/stat/stat.go index 8e39bd6148d..2923b9d3066 100644 --- a/metricbeat/module/haproxy/stat/stat.go +++ b/metricbeat/module/haproxy/stat/stat.go @@ -19,6 +19,7 @@ package stat import ( "github.com/elastic/beats/libbeat/logp" + "github.com/elastic/beats/metricbeat/helper" "github.com/elastic/beats/metricbeat/mb" "github.com/elastic/beats/metricbeat/module/haproxy" @@ -44,16 +45,21 @@ func init() { // MetricSet for haproxy stats. type MetricSet struct { mb.BaseMetricSet + *helper.HTTP } // New creates a new haproxy stat MetricSet. func New(base mb.BaseMetricSet) (mb.MetricSet, error) { - return &MetricSet{BaseMetricSet: base}, nil + http, err := helper.NewHTTP(base) + if err != nil { + return nil, err + } + return &MetricSet{BaseMetricSet: base, HTTP: http}, nil } // Fetch methods returns a list of stats metrics. func (m *MetricSet) Fetch(reporter mb.ReporterV2) error { - hapc, err := haproxy.NewHaproxyClient(m.HostData().URI) + hapc, err := haproxy.NewHaproxyClient(m.HostData().URI, m.HTTP) if err != nil { return errors.Wrap(err, "failed creating haproxy client") } diff --git a/metricbeat/module/haproxy/test_haproxy.py b/metricbeat/module/haproxy/test_haproxy.py index 6804548971a..157de3ffe23 100644 --- a/metricbeat/module/haproxy/test_haproxy.py +++ b/metricbeat/module/haproxy/test_haproxy.py @@ -90,10 +90,11 @@ def test_stat_https(self): self.render_config_template(modules=[{ "name": "haproxy", "metricsets": ["stat"], - "hosts": ["https://%s/stats" % (self.compose_host(port="14570/tcp"))], + "hosts": ["https://localhost:14570/stats"], "period": "5s", "extras": { - "ssl.certificate": os.path.join(os.path.dirname(__file__), '_meta/certs/client.crt'), + "ssl.certificate_authorities": [os.path.join(os.path.dirname(__file__), '_meta/certs/ca.pem')], + "ssl.certificate": os.path.join(os.path.dirname(__file__), '_meta/certs/client.pem'), "ssl.key": os.path.join(os.path.dirname(__file__), '_meta/certs/client.key') } }]) From afed1823cc971bf44b3b8884c3ad1a9425d7823e Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Fri, 14 Feb 2020 16:41:38 +0100 Subject: [PATCH 03/10] Fix --- metricbeat/module/haproxy/haproxy.go | 2 +- metricbeat/module/haproxy/test_haproxy.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/metricbeat/module/haproxy/haproxy.go b/metricbeat/module/haproxy/haproxy.go index efd5b822fd7..f2156c23e82 100644 --- a/metricbeat/module/haproxy/haproxy.go +++ b/metricbeat/module/haproxy/haproxy.go @@ -25,7 +25,7 @@ import ( "net" "net/url" "strings" - + "github.com/gocarina/gocsv" "github.com/mitchellh/mapstructure" "github.com/pkg/errors" diff --git a/metricbeat/module/haproxy/test_haproxy.py b/metricbeat/module/haproxy/test_haproxy.py index 157de3ffe23..a1978793628 100644 --- a/metricbeat/module/haproxy/test_haproxy.py +++ b/metricbeat/module/haproxy/test_haproxy.py @@ -90,7 +90,7 @@ def test_stat_https(self): self.render_config_template(modules=[{ "name": "haproxy", "metricsets": ["stat"], - "hosts": ["https://localhost:14570/stats"], + "hosts": ["http://%s/stats" % (self.compose_host(port="14570/tcp"))], "period": "5s", "extras": { "ssl.certificate_authorities": [os.path.join(os.path.dirname(__file__), '_meta/certs/ca.pem')], From 333860c6a4417f5b0fffc39e56399f70b2adfa74 Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Fri, 14 Feb 2020 16:43:33 +0100 Subject: [PATCH 04/10] Update CHANGELOG --- CHANGELOG.next.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index a3e300f3b58..5ba525b7d0e 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -159,6 +159,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Improve the `logstash` module (when `xpack.enabled` is set to `true`) to use the override `cluster_uuid` returned by Logstash APIs. {issue}15772[15772] {pull}15795[15795] - Add kubernetes storage class support via kube-state-metrics. {pull}16145[16145] - Add Load Balancing metricset to GCP {pull}15559[15559] +- Improve the `haproxy` module to support metrics exposed via HTTPS. {issue}14579[14579] {pull}16333[16333] *Packetbeat* From d8c638786188b7b0f05ee318c36aa0cc140a19e7 Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Fri, 14 Feb 2020 18:57:10 +0100 Subject: [PATCH 05/10] Fix: https --- metricbeat/module/haproxy/test_haproxy.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metricbeat/module/haproxy/test_haproxy.py b/metricbeat/module/haproxy/test_haproxy.py index a1978793628..bd585317070 100644 --- a/metricbeat/module/haproxy/test_haproxy.py +++ b/metricbeat/module/haproxy/test_haproxy.py @@ -90,7 +90,7 @@ def test_stat_https(self): self.render_config_template(modules=[{ "name": "haproxy", "metricsets": ["stat"], - "hosts": ["http://%s/stats" % (self.compose_host(port="14570/tcp"))], + "hosts": ["https://%s/stats" % (self.compose_host(port="14570/tcp"))], "period": "5s", "extras": { "ssl.certificate_authorities": [os.path.join(os.path.dirname(__file__), '_meta/certs/ca.pem')], From fb6d30bcdeca428da1d920752c374fe721f9f9fe Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Sat, 15 Feb 2020 11:11:03 +0100 Subject: [PATCH 06/10] Try: sleep --- metricbeat/module/haproxy/test_haproxy.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/metricbeat/module/haproxy/test_haproxy.py b/metricbeat/module/haproxy/test_haproxy.py index bd585317070..09953c142b6 100644 --- a/metricbeat/module/haproxy/test_haproxy.py +++ b/metricbeat/module/haproxy/test_haproxy.py @@ -1,5 +1,6 @@ import os import sys +import time import unittest from nose.plugins.attrib import attr @@ -44,6 +45,7 @@ def test_info_socket(self): def _test_stat(self): proc = self.start_beat() + time.sleep(10) self.wait_until(lambda: self.output_lines() > 0) proc.check_kill_and_wait() self.assert_no_logged_warnings() From 3ea7cc04eaa36abe325bc47cdfb6262d49939945 Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Sat, 15 Feb 2020 13:18:57 +0100 Subject: [PATCH 07/10] Fix --- metricbeat/module/haproxy/docker-compose.yml | 2 +- metricbeat/module/haproxy/test_haproxy.py | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/metricbeat/module/haproxy/docker-compose.yml b/metricbeat/module/haproxy/docker-compose.yml index e32cc0f1981..e55b2186ec0 100644 --- a/metricbeat/module/haproxy/docker-compose.yml +++ b/metricbeat/module/haproxy/docker-compose.yml @@ -2,7 +2,7 @@ version: '2.3' services: haproxy: - image: docker.elastic.co/integrations-ci/beats-haproxy:${HAPROXY_VERSION:-1.8.22}-1 + image: docker.elastic.co/integrations-ci/beats-haproxy:${HAPROXY_VERSION:-1.8.22}-2 build: context: ./_meta args: diff --git a/metricbeat/module/haproxy/test_haproxy.py b/metricbeat/module/haproxy/test_haproxy.py index 09953c142b6..bd585317070 100644 --- a/metricbeat/module/haproxy/test_haproxy.py +++ b/metricbeat/module/haproxy/test_haproxy.py @@ -1,6 +1,5 @@ import os import sys -import time import unittest from nose.plugins.attrib import attr @@ -45,7 +44,6 @@ def test_info_socket(self): def _test_stat(self): proc = self.start_beat() - time.sleep(10) self.wait_until(lambda: self.output_lines() > 0) proc.check_kill_and_wait() self.assert_no_logged_warnings() From 28f9acd2603e64fc19a09cd141fc6f1e9a5cead8 Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Sat, 15 Feb 2020 15:40:55 +0100 Subject: [PATCH 08/10] Fix: don't verify hostname in tests --- metricbeat/module/haproxy/test_haproxy.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/metricbeat/module/haproxy/test_haproxy.py b/metricbeat/module/haproxy/test_haproxy.py index bd585317070..40ab58f847f 100644 --- a/metricbeat/module/haproxy/test_haproxy.py +++ b/metricbeat/module/haproxy/test_haproxy.py @@ -46,7 +46,7 @@ def _test_stat(self): proc = self.start_beat() self.wait_until(lambda: self.output_lines() > 0) proc.check_kill_and_wait() - self.assert_no_logged_warnings() + self.assert_no_logged_warnings(replace=['SSL/TLS verifications disabled.']) output = self.read_output_json() self.assertGreater(len(output), 0) @@ -95,7 +95,10 @@ def test_stat_https(self): "extras": { "ssl.certificate_authorities": [os.path.join(os.path.dirname(__file__), '_meta/certs/ca.pem')], "ssl.certificate": os.path.join(os.path.dirname(__file__), '_meta/certs/client.pem'), - "ssl.key": os.path.join(os.path.dirname(__file__), '_meta/certs/client.key') + "ssl.key": os.path.join(os.path.dirname(__file__), '_meta/certs/client.key'), + # TODO: verification_mode: "certificate" + # compose uses dynamic IP addresses and there are no IP SAN records in the certificate + "ssl.verification_mode": "none" } }]) self._test_stat() From a0f7bba0cbc9be169b966f8720e683f5355a4e51 Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Tue, 18 Feb 2020 12:49:27 +0100 Subject: [PATCH 09/10] Add information to docs about SSL, HTTP --- metricbeat/docs/modules/haproxy.asciidoc | 3 +++ metricbeat/module/haproxy/_meta/fields.yml | 1 + metricbeat/module/haproxy/fields.go | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/metricbeat/docs/modules/haproxy.asciidoc b/metricbeat/docs/modules/haproxy.asciidoc index 588b996e1e7..b22d8244df4 100644 --- a/metricbeat/docs/modules/haproxy.asciidoc +++ b/metricbeat/docs/modules/haproxy.asciidoc @@ -62,6 +62,9 @@ metricbeat.modules: enabled: true ---- +This module supports TLS connections when using `ssl` config field, as described in <>. +It also supports the options described in <>. + [float] === Metricsets diff --git a/metricbeat/module/haproxy/_meta/fields.yml b/metricbeat/module/haproxy/_meta/fields.yml index 4ad0a38af3d..b135cb1a500 100644 --- a/metricbeat/module/haproxy/_meta/fields.yml +++ b/metricbeat/module/haproxy/_meta/fields.yml @@ -4,6 +4,7 @@ HAProxy Module short_config: false release: ga + settings: ["ssl", "http"] fields: - name: haproxy type: group diff --git a/metricbeat/module/haproxy/fields.go b/metricbeat/module/haproxy/fields.go index 92f7291881b..1bee67c5905 100644 --- a/metricbeat/module/haproxy/fields.go +++ b/metricbeat/module/haproxy/fields.go @@ -32,5 +32,5 @@ func init() { // AssetHaproxy returns asset data. // This is the base64 encoded gzipped contents of ../metricbeat/module/haproxy. func AssetHaproxy() string { - return "eJzsXNtu27jTv+9TDHKzzsJxD5ttgQAt0Ka73xZNkyBxsJcGLY0jIhSpklQc79N/IKmTZerg2HJ68ddNG0ua+XFmOCeOfQIPuDqDiCRSPK1eAWiqGZ7B0T+fr80nR68AQlSBpImmgp/Bp1cAANld+CHClOErABUJqWeB4At6fwYLwpT5VCJDovAM7skrgAVFFqozS+AEOImxythcepWYh6VIk+wTD+8q/xi1pIGaZDeqHKpcKF+I4kMfmxZW5vo/5CgJs3RkTMwjQOYi1QWQRIoAlcICirnWl59fdZBVoAWZtbs5Yib4fe1GC2hzXabxHCWIhQ9gG4IZT+M9Ybh2FIFbLF3saehlSxgldaEkREcF4MnmmzG9l8Sh0jLF56H+9rUDsUz57GeKG/S3FZeXuCbqYVdb8BJOE01jnCgM9qTl81RK5DojDJSDwkDwsMveYoyFXE1i8jSZr3R/w3cb8Qx8L3VA/UGeaJzGQGKRcm02hwMBqSL3FrolCiMdIfz2A+OYPM1+fPkNHglLEQLBH1FqDEEL9+RxxxpTRmOqZ3xPos7x82JziwQ5LChDZeQCBne+LdqRBSJOJCq/1OsOsgVaXTkeF1dlO0/qHNu59ufcxh3WIoL3dotStsdR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C+H0UH/TEDv0sIDBF4WxHcgp3P02C5uvXHXzE+jLLcaafI7KrscuuVwUjM6v715/+dv1nXrNWeSO7+XXWGuW28UuUZZK65yLrv6Y4jr+AbfzQMHvzoVku6Tmn+GrIvF8Swf2U+q47xMa+n29a/NPAg6niT3/tkP1qnR07cqyvu4oJk/27+PaZEH2HQ4d2bH+RWN2XoyR5oRMKv8GRnlU56L/Tu6cLthJAqbaJdmQgUP67Ilzz3/+GwAA//9AvqeT" } From 426c908ca1cb387557361c642180bcd1378be4bb Mon Sep 17 00:00:00 2001 From: Marcin Tojek Date: Tue, 18 Feb 2020 14:06:04 +0100 Subject: [PATCH 10/10] Adjust code after review --- metricbeat/module/haproxy/haproxy.go | 7 ++++++- metricbeat/module/haproxy/info/info.go | 12 ++++-------- metricbeat/module/haproxy/stat/stat.go | 14 ++++---------- 3 files changed, 14 insertions(+), 19 deletions(-) diff --git a/metricbeat/module/haproxy/haproxy.go b/metricbeat/module/haproxy/haproxy.go index f2156c23e82..b10fd522ee3 100644 --- a/metricbeat/module/haproxy/haproxy.go +++ b/metricbeat/module/haproxy/haproxy.go @@ -31,6 +31,7 @@ import ( "github.com/pkg/errors" "github.com/elastic/beats/metricbeat/helper" + "github.com/elastic/beats/metricbeat/mb" "github.com/elastic/beats/metricbeat/mb/parse" ) @@ -167,7 +168,7 @@ type Client struct { } // NewHaproxyClient returns a new instance of HaproxyClient -func NewHaproxyClient(address string, http *helper.HTTP) (*Client, error) { +func NewHaproxyClient(address string, base mb.BaseMetricSet) (*Client, error) { u, err := url.Parse(address) if err != nil { return nil, errors.Wrap(err, "invalid url") @@ -179,6 +180,10 @@ func NewHaproxyClient(address string, http *helper.HTTP) (*Client, error) { case "unix": return &Client{&unixProto{Network: u.Scheme, Address: u.Path}}, nil case "http", "https": + http, err := helper.NewHTTP(base) + if err != nil { + return nil, err + } return &Client{&httpProto{HTTP: http}}, nil default: return nil, errors.Errorf("invalid protocol scheme: %s", u.Scheme) diff --git a/metricbeat/module/haproxy/info/info.go b/metricbeat/module/haproxy/info/info.go index 9d3e2e163f5..4e873b1a6e6 100644 --- a/metricbeat/module/haproxy/info/info.go +++ b/metricbeat/module/haproxy/info/info.go @@ -18,12 +18,12 @@ package info import ( + "github.com/pkg/errors" + "github.com/elastic/beats/libbeat/logp" "github.com/elastic/beats/metricbeat/helper" "github.com/elastic/beats/metricbeat/mb" "github.com/elastic/beats/metricbeat/module/haproxy" - - "github.com/pkg/errors" ) const ( @@ -50,16 +50,12 @@ type MetricSet struct { // New creates a haproxy info MetricSet. func New(base mb.BaseMetricSet) (mb.MetricSet, error) { - http, err := helper.NewHTTP(base) - if err != nil { - return nil, err - } - return &MetricSet{BaseMetricSet: base, HTTP: http}, nil + return &MetricSet{BaseMetricSet: base}, nil } // Fetch fetches info stats from the haproxy service. func (m *MetricSet) Fetch(reporter mb.ReporterV2) error { - hapc, err := haproxy.NewHaproxyClient(m.HostData().URI, m.HTTP) + hapc, err := haproxy.NewHaproxyClient(m.HostData().URI, m.BaseMetricSet) if err != nil { return errors.Wrap(err, "failed creating haproxy client") } diff --git a/metricbeat/module/haproxy/stat/stat.go b/metricbeat/module/haproxy/stat/stat.go index 2923b9d3066..15f6b61b27a 100644 --- a/metricbeat/module/haproxy/stat/stat.go +++ b/metricbeat/module/haproxy/stat/stat.go @@ -18,12 +18,11 @@ package stat import ( + "github.com/pkg/errors" + "github.com/elastic/beats/libbeat/logp" - "github.com/elastic/beats/metricbeat/helper" "github.com/elastic/beats/metricbeat/mb" "github.com/elastic/beats/metricbeat/module/haproxy" - - "github.com/pkg/errors" ) const ( @@ -45,21 +44,16 @@ func init() { // MetricSet for haproxy stats. type MetricSet struct { mb.BaseMetricSet - *helper.HTTP } // New creates a new haproxy stat MetricSet. func New(base mb.BaseMetricSet) (mb.MetricSet, error) { - http, err := helper.NewHTTP(base) - if err != nil { - return nil, err - } - return &MetricSet{BaseMetricSet: base, HTTP: http}, nil + return &MetricSet{BaseMetricSet: base}, nil } // Fetch methods returns a list of stats metrics. func (m *MetricSet) Fetch(reporter mb.ReporterV2) error { - hapc, err := haproxy.NewHaproxyClient(m.HostData().URI, m.HTTP) + hapc, err := haproxy.NewHaproxyClient(m.HostData().URI, m.BaseMetricSet) if err != nil { return errors.Wrap(err, "failed creating haproxy client") }