aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/datafilecollector-testharness/http-https-server
diff options
context:
space:
mode:
Diffstat (limited to 'test/mocks/datafilecollector-testharness/http-https-server')
-rw-r--r--test/mocks/datafilecollector-testharness/http-https-server/.gitignore2
-rw-r--r--test/mocks/datafilecollector-testharness/http-https-server/Dockerfile-http8
-rw-r--r--test/mocks/datafilecollector-testharness/http-https-server/Dockerfile-http-https15
-rw-r--r--test/mocks/datafilecollector-testharness/http-https-server/README.md32
-rw-r--r--test/mocks/datafilecollector-testharness/http-https-server/apache2/conf/.htpasswd (renamed from test/mocks/datafilecollector-testharness/http-https-server/configuration/htpasswd)0
-rw-r--r--test/mocks/datafilecollector-testharness/http-https-server/apache2/conf/extra/httpd-ssl.conf65
-rw-r--r--test/mocks/datafilecollector-testharness/http-https-server/apache2/conf/httpd.conf (renamed from test/mocks/datafilecollector-testharness/http-https-server/configuration/httpd.conf)80
-rw-r--r--test/mocks/datafilecollector-testharness/http-https-server/docker-compose.yml17
-rw-r--r--test/mocks/datafilecollector-testharness/http-https-server/test_cases.yml6
9 files changed, 170 insertions, 55 deletions
diff --git a/test/mocks/datafilecollector-testharness/http-https-server/.gitignore b/test/mocks/datafilecollector-testharness/http-https-server/.gitignore
index bd6c5bed8..2c8afebd8 100644
--- a/test/mocks/datafilecollector-testharness/http-https-server/.gitignore
+++ b/test/mocks/datafilecollector-testharness/http-https-server/.gitignore
@@ -1 +1 @@
-files/onap/*
+/files
diff --git a/test/mocks/datafilecollector-testharness/http-https-server/Dockerfile-http b/test/mocks/datafilecollector-testharness/http-https-server/Dockerfile-http
deleted file mode 100644
index d3601b865..000000000
--- a/test/mocks/datafilecollector-testharness/http-https-server/Dockerfile-http
+++ /dev/null
@@ -1,8 +0,0 @@
-FROM httpd:alpine
-
-COPY configuration/htpasswd /usr/local/apache2/conf/.htpasswd
-COPY configuration/httpd.conf /usr/local/apache2/conf/httpd.conf
-RUN chmod 644 /usr/local/apache2/conf/.htpasswd
-RUN chmod 644 /usr/local/apache2/conf/httpd.conf
-RUN chown root:root /usr/local/apache2/conf/.htpasswd
-RUN chown root:root /usr/local/apache2/conf/httpd.conf
diff --git a/test/mocks/datafilecollector-testharness/http-https-server/Dockerfile-http-https b/test/mocks/datafilecollector-testharness/http-https-server/Dockerfile-http-https
new file mode 100644
index 000000000..a2d8bf8cc
--- /dev/null
+++ b/test/mocks/datafilecollector-testharness/http-https-server/Dockerfile-http-https
@@ -0,0 +1,15 @@
+FROM httpd:alpine
+
+RUN apk update
+
+ENV APACHE_LOG_DIR /usr/local/apache2/logs
+
+RUN mkdir /usr/local/apache2/certs
+
+COPY --chown=root:root apache2/certs /usr/local/apache2/certs
+COPY --chown=root:root apache2/conf /usr/local/apache2/conf
+COPY --chown=root:root apache2/conf/extra /usr/local/apache2/conf/extra
+
+RUN chmod 644 /usr/local/apache2/conf/.htpasswd
+RUN chmod 644 /usr/local/apache2/conf/httpd.conf
+RUN chmod 644 /usr/local/apache2/conf/extra/httpd-ssl.conf
diff --git a/test/mocks/datafilecollector-testharness/http-https-server/README.md b/test/mocks/datafilecollector-testharness/http-https-server/README.md
new file mode 100644
index 000000000..77e701175
--- /dev/null
+++ b/test/mocks/datafilecollector-testharness/http-https-server/README.md
@@ -0,0 +1,32 @@
+# ejbca certs
+
+There are needed certificates generated using CMPv2 server to properly run the https server and dfc being able to work with
+https protocol. For that reason, pre-generated certs were prepared and stored in `certservice/generated-certs` directory.
+
+# Docker preparations
+
+Source: <https://docs.docker.com/install/linux/linux-postinstall/>
+
+`sudo usermod -aG docker $USER`
+
+then logout-login to activate it.
+
+# Prepare files for the simulator
+
+Run `prepare.sh` with an argument found in `test_cases.yml` (or add a new tc in that file) to create files (1MB,
+5MB and 50MB files) and a large number of symbolic links to these files to simulate PM files. The files names
+matches the files in the events produced by the MR simulator. The dirs with the files will be mounted
+by the ftp containers, defined in the docker-compse file, when started
+
+# Starting/stopping the HTTP/HTTPS server(s)
+
+Start: `docker-compose up`
+
+Stop: Ctrl +C, then `docker-compose down` or `docker-compose down --remove-orphans`
+
+If you experience issues (or port collision), check the currently running other containers
+by using 'docker ps' and stop them if necessary.
+
+# Cleaning docker structure
+
+Deep cleaning: `docker system prune`
diff --git a/test/mocks/datafilecollector-testharness/http-https-server/configuration/htpasswd b/test/mocks/datafilecollector-testharness/http-https-server/apache2/conf/.htpasswd
index 07f1978e6..07f1978e6 100644
--- a/test/mocks/datafilecollector-testharness/http-https-server/configuration/htpasswd
+++ b/test/mocks/datafilecollector-testharness/http-https-server/apache2/conf/.htpasswd
diff --git a/test/mocks/datafilecollector-testharness/http-https-server/apache2/conf/extra/httpd-ssl.conf b/test/mocks/datafilecollector-testharness/http-https-server/apache2/conf/extra/httpd-ssl.conf
new file mode 100644
index 000000000..f4caf357e
--- /dev/null
+++ b/test/mocks/datafilecollector-testharness/http-https-server/apache2/conf/extra/httpd-ssl.conf
@@ -0,0 +1,65 @@
+Listen 443
+Listen 8080
+
+SSLProxyCipherSuite HIGH:MEDIUM:!MD5:!RC4:!3DES
+SSLProxyProtocol all -SSLv3
+SSLPassPhraseDialog builtin
+
+SSLSessionCache "shmcb:/usr/local/apache2/logs/ssl_scache(512000)"
+SSLSessionCacheTimeout 300
+
+<VirtualHost *:8080>
+ ServerAdmin httpserver-onap.org
+ ServerName httpserver-onap.org
+
+ DocumentRoot /usr/local/apache2/htdocs
+
+ ErrorLog ${APACHE_LOG_DIR}/error.log
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+ SSLEngine on
+ SSLProtocol -all +TLSv1.2
+ SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
+ SSLHonorCipherOrder off
+ SSLSessionTickets off
+
+ SSLCACertificateFile /usr/local/apache2/certs/truststore.pem
+ SSLCertificateFile /usr/local/apache2/certs/keystore.pem
+ SSLCertificateKeyFile /usr/local/apache2/certs/key.pem
+
+</VirtualHost>
+
+<VirtualHost *:443>
+
+ ServerAdmin httpserver-onap.org
+ ServerName httpserver-onap.org
+
+ DocumentRoot /usr/local/apache2/htdocs
+ <Directory "/usr/local/apache2/htdocs">
+ SSLVerifyClient optional
+ SSLVerifyDepth 2
+ SSLOptions +FakeBasicAuth +StrictRequire
+ <RequireAll>
+ Require ssl-verify-client
+ </RequireAll>
+ Options Indexes FollowSymLinks MultiViews
+ AuthType Basic
+ AuthName "Restricted Content"
+ AuthBasicProvider file
+ AuthUserFile /usr/local/apache2/conf/.htpasswd
+ Require valid-user
+ </Directory>
+
+ ErrorLog ${APACHE_LOG_DIR}/error.log
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+ SSLEngine on
+ SSLProtocol -all +TLSv1.2
+ SSLCipherSuite ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
+ SSLHonorCipherOrder off
+ SSLSessionTickets off
+
+ SSLCACertificateFile /usr/local/apache2/certs/truststore.pem
+ SSLCertificateFile /usr/local/apache2/certs/keystore.pem
+ SSLCertificateKeyFile /usr/local/apache2/certs/key.pem
+</VirtualHost>
diff --git a/test/mocks/datafilecollector-testharness/http-https-server/configuration/httpd.conf b/test/mocks/datafilecollector-testharness/http-https-server/apache2/conf/httpd.conf
index 88081b441..ef3ce95f7 100644
--- a/test/mocks/datafilecollector-testharness/http-https-server/configuration/httpd.conf
+++ b/test/mocks/datafilecollector-testharness/http-https-server/apache2/conf/httpd.conf
@@ -91,7 +91,7 @@ LoadModule auth_basic_module modules/mod_auth_basic.so
#LoadModule cache_module modules/mod_cache.so
#LoadModule cache_disk_module modules/mod_cache_disk.so
#LoadModule cache_socache_module modules/mod_cache_socache.so
-#LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
+LoadModule socache_shmcb_module modules/mod_socache_shmcb.so
#LoadModule socache_dbm_module modules/mod_socache_dbm.so
#LoadModule socache_memcache_module modules/mod_socache_memcache.so
#LoadModule socache_redis_module modules/mod_socache_redis.so
@@ -158,7 +158,7 @@ LoadModule version_module modules/mod_version.so
#LoadModule session_dbd_module modules/mod_session_dbd.so
#LoadModule slotmem_shm_module modules/mod_slotmem_shm.so
#LoadModule slotmem_plain_module modules/mod_slotmem_plain.so
-#LoadModule ssl_module modules/mod_ssl.so
+LoadModule ssl_module modules/mod_ssl.so
#LoadModule optional_hook_export_module modules/mod_optional_hook_export.so
#LoadModule optional_hook_import_module modules/mod_optional_hook_import.so
#LoadModule optional_fn_import_module modules/mod_optional_fn_import.so
@@ -256,44 +256,50 @@ ServerAdmin you@example.com
# you might expect, make sure that you have specifically enabled it
# below.
#
+<Directory /usr/local/apache2/htdocs>
+ Options Indexes FollowSymLinks
+ AllowOverride None
+ Require all granted
+</Directory>
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
-DocumentRoot "/usr/local/apache2/htdocs"
-<Directory "/usr/local/apache2/htdocs">
- #
- # Possible values for the Options directive are "None", "All",
- # or any combination of:
- # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
- #
- # Note that "MultiViews" must be named *explicitly* --- "Options All"
- # doesn't give it to you.
- #
- # The Options directive is both complicated and important. Please see
- # http://httpd.apache.org/docs/2.4/mod/core.html#options
- # for more information.
- #
- Options Indexes FollowSymLinks
-
- #
- # AllowOverride controls what directives may be placed in .htaccess files.
- # It can be "All", "None", or any combination of the keywords:
- # AllowOverride FileInfo AuthConfig Limit
- #
- AllowOverride None
-
- #
- # Controls who can get stuff from this server.
- #
- AuthType Basic
- AuthName "Restricted Content"
- AuthUserFile /usr/local/apache2/conf/.htpasswd
- Require valid-user
-</Directory>
-
+<VirtualHost *:80>
+ DocumentRoot "/usr/local/apache2/htdocs"
+ <Directory "/usr/local/apache2/htdocs">
+ #
+ # Possible values for the Options directive are "None", "All",
+ # or any combination of:
+ # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
+ #
+ # Note that "MultiViews" must be named *explicitly* --- "Options All"
+ # doesn't give it to you.
+ #
+ # The Options directive is both complicated and important. Please see
+ # http://httpd.apache.org/docs/2.4/mod/core.html#options
+ # for more information.
+ #
+ Options Indexes FollowSymLinks
+
+ #
+ # AllowOverride controls what directives may be placed in .htaccess files.
+ # It can be "All", "None", or any combination of the keywords:
+ # AllowOverride FileInfo AuthConfig Limit
+ #
+ AllowOverride None
+
+ #
+ # Controls who can get stuff from this server.
+ #
+ AuthType Basic
+ AuthName "Restricted Content"
+ AuthUserFile /usr/local/apache2/conf/.htpasswd
+ Require valid-user
+ </Directory>
+</VirtualHost>
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
@@ -317,7 +323,7 @@ DocumentRoot "/usr/local/apache2/htdocs"
# logged here. If you *do* define an error logfile for a <VirtualHost>
# container, that host's errors will be logged there and not here.
#
-ErrorLog /proc/self/fd/2
+ErrorLog ${APACHE_LOG_DIR}/error.log
#
# LogLevel: Control the number of messages logged to the error_log.
@@ -346,7 +352,7 @@ LogLevel warn
# define per-<VirtualHost> access logfiles, transactions will be
# logged therein and *not* in this file.
#
- CustomLog /proc/self/fd/1 common
+ CustomLog ${APACHE_LOG_DIR}/access.log combined
#
# If you prefer a logfile with access, agent, and referer information
@@ -541,7 +547,7 @@ Include conf/extra/proxy-html.conf
</IfModule>
# Secure (SSL/TLS) connections
-#Include conf/extra/httpd-ssl.conf
+Include conf/extra/httpd-ssl.conf
#
# Note: The following must must be present to support
# starting without SSL on platforms with no /dev/random equivalent
diff --git a/test/mocks/datafilecollector-testharness/http-https-server/docker-compose.yml b/test/mocks/datafilecollector-testharness/http-https-server/docker-compose.yml
index 537cfcfaf..09b698f89 100644
--- a/test/mocks/datafilecollector-testharness/http-https-server/docker-compose.yml
+++ b/test/mocks/datafilecollector-testharness/http-https-server/docker-compose.yml
@@ -2,14 +2,19 @@ version: '3'
services:
- http-server:
- container_name: http-server-httpd
+ http-https-server:
+ container_name: http-https-server-httpd
image: httpd:alpine
+ environment:
+ APACHE_LOG_DIR: /usr/local/apache2/logs
ports:
- "80:80"
+ - "443:443"
+ - "8080:8080"
volumes:
- - ./configuration/htpasswd:/usr/local/apache2/conf/.htpasswd:ro
- - ./configuration/httpd.conf:/usr/local/apache/conf/httpd.conf:ro
-
- - ./files/onap/http/:/usr/local/apache2/htdocs
+ - ./apache2/conf/.htpasswd:/usr/local/apache2/conf/.htpasswd:ro
+ - ./apache2/conf/httpd.conf:/usr/local/apache2/conf/httpd.conf:ro
+ - ./apache2/conf/extra/httpd-ssl.conf:/usr/local/apache2/conf/extra/httpd-ssl.conf:ro
+ - ./../certservice/generated-certs/apache-pem:/usr/local/apache2/certs:ro
+ - ./files/onap/http:/usr/local/apache2/htdocs
restart: on-failure
diff --git a/test/mocks/datafilecollector-testharness/http-https-server/test_cases.yml b/test/mocks/datafilecollector-testharness/http-https-server/test_cases.yml
index 08f632e28..d27bb9384 100644
--- a/test/mocks/datafilecollector-testharness/http-https-server/test_cases.yml
+++ b/test/mocks/datafilecollector-testharness/http-https-server/test_cases.yml
@@ -3,14 +3,14 @@
TC1:
size_files: 1 5 10
number_files: 10 30 10
- directory_files: http
+ directory_files: http http http
TC2:
size_files: 0.5 1 5
number_files: 2 3 1
- directory_files: http
+ directory_files: http http http
TC_10000:
size_files: 1 1 5 5 50 50
number_files: 10000 10000 10000 10000 1 1
- directory_files: http
+ directory_files: http http http http http http