aboutsummaryrefslogtreecommitdiffstats
path: root/test/mocks/datafilecollector-testharness/ftps-sftp-server
diff options
context:
space:
mode:
authorTamasBakai <tamas.bakai@est.tech>2019-02-15 08:38:16 +0000
committerTamas Bakai <tamas.bakai@est.tech>2019-02-15 09:47:28 +0000
commit9b780338eb8b85fc713f272a7cae865f1265f109 (patch)
tree864c1ba60eff8625f1f5c79567da0914e5e8ed65 /test/mocks/datafilecollector-testharness/ftps-sftp-server
parent01c69ab28550d775239697067588e3b2063188a1 (diff)
Simulator scripts for datafile-collector
Change-Id: Idff5fb9e4406f42208367860b3d02fc2ed4a9bad Issue-ID: DCAEGEN2-1225 Signed-off-by: TamasBakai <tamas.bakai@est.tech>
Diffstat (limited to 'test/mocks/datafilecollector-testharness/ftps-sftp-server')
-rw-r--r--test/mocks/datafilecollector-testharness/ftps-sftp-server/README.md29
-rw-r--r--test/mocks/datafilecollector-testharness/ftps-sftp-server/configuration/vsftpd_ssl.conf57
-rw-r--r--test/mocks/datafilecollector-testharness/ftps-sftp-server/docker-compose.yml39
-rwxr-xr-xtest/mocks/datafilecollector-testharness/ftps-sftp-server/prepare.sh10
-rw-r--r--test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/dfc.crt19
-rw-r--r--test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.crt19
-rw-r--r--test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.key27
7 files changed, 200 insertions, 0 deletions
diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/README.md b/test/mocks/datafilecollector-testharness/ftps-sftp-server/README.md
new file mode 100644
index 000000000..5a1660126
--- /dev/null
+++ b/test/mocks/datafilecollector-testharness/ftps-sftp-server/README.md
@@ -0,0 +1,29 @@
+###Deployment of certificates: (in case of update)
+
+This folder is prepared with a set of keys matching DfC for test purposes.
+
+Copy from datafile-app-server/config/keys to the ./tls/ the following files:
+
+* dfc.crt
+* ftp.crt
+* ftp.key
+
+###Docker preparations
+Source: https://docs.docker.com/install/linux/linux-postinstall/
+
+`sudo usermod -aG docker $USER`
+
+then logout-login to activate it.
+
+###Starting/stopping the FTPS/SFTP 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` \ No newline at end of file
diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/configuration/vsftpd_ssl.conf b/test/mocks/datafilecollector-testharness/ftps-sftp-server/configuration/vsftpd_ssl.conf
new file mode 100644
index 000000000..99d64dca0
--- /dev/null
+++ b/test/mocks/datafilecollector-testharness/ftps-sftp-server/configuration/vsftpd_ssl.conf
@@ -0,0 +1,57 @@
+# Server Config
+anonymous_enable=NO
+local_enable=YES
+write_enable=YES
+local_umask=022
+dirmessage_enable=YES
+
+# Security and User auth
+chroot_local_user=YES
+pam_service_name=vsftpd_virtual
+virtual_use_local_privs=YES
+chmod_enable=NO
+user_config_dir=/etc/vsftpd/user_conf
+user_sub_token=$USER
+#local_root=/srv/$USER
+local_root=/srv/
+userlist_enable=NO
+allow_writeable_chroot=YES
+
+# Logging
+log_ftp_protocol=YES
+xferlog_enable=YES
+xferlog_std_format=YES
+#xferlog_file=/dev/stdout
+syslog_enable=NO
+dual_log_enable=YES
+
+# Remap all login users to this username
+guest_enable=YES
+guest_username=ftp
+hide_ids=YES
+
+# Networking
+connect_from_port_20=NO
+listen=YES
+tcp_wrappers=YES
+pasv_min_port=8001
+pasv_max_port=8010
+
+# SSL
+ssl_enable=Yes
+require_ssl_reuse=NO
+force_local_data_ssl=YES
+force_local_logins_ssl=YES
+ssl_ciphers=HIGH
+allow_anon_ssl=NO
+
+ssl_tlsv1=YES
+ssl_sslv2=YES
+ssl_sslv3=YES
+rsa_cert_file=/etc/ssl/private/ftp.crt
+rsa_private_key_file=/etc/ssl/private/ftp.key
+
+require_cert=YES
+ssl_request_cert=YES
+ca_certs_file=/etc/ssl/private/dfc.crt
+
diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/docker-compose.yml b/test/mocks/datafilecollector-testharness/ftps-sftp-server/docker-compose.yml
new file mode 100644
index 000000000..4d2d32984
--- /dev/null
+++ b/test/mocks/datafilecollector-testharness/ftps-sftp-server/docker-compose.yml
@@ -0,0 +1,39 @@
+version: '3'
+
+services:
+
+ sftp-server1:
+ container_name: sftp-server1
+ image: atmoz/sftp:alpine
+ ports:
+ - "1022:22"
+ volumes:
+ - ./files/onap/:/home/onap/
+ restart: on-failure
+ command: onap:pano:1001
+
+ ftpes-server-vsftpd:
+ container_name: ftpes-server-vsftpd
+ image: docker.io/panubo/vsftpd
+ ports:
+ - "21:21"
+ - "8001-8010:8001-8010"
+ environment:
+ FTP_USER: onap
+ FTP_PASSWORD: pano
+ PASV_ADDRESS: localhost
+ PASV_MIN_PORT: 8001
+ PASV_MAX_PORT: 8010
+ volumes:
+ - ./tls/ftp.crt:/etc/ssl/private/ftp.crt:ro
+ - ./tls/ftp.key:/etc/ssl/private/ftp.key:ro
+ - ./tls/dfc.crt:/etc/ssl/private/dfc.crt:ro
+ - ./configuration/vsftpd_ssl.conf:/etc/vsftpd_ssl.conf:ro
+
+ - ./files/onap/0.5MB.tar.gz:/srv/0.5MB.tar.gz:ro
+ - ./files/onap/1MB.tar.gz:/srv/1MB.tar.gz:ro
+ - ./files/onap/5MB.tar.gz:/srv/5MB.tar.gz:ro
+ - ./files/onap/10MB.tar.gz:/srv/10MB.tar.gz:ro
+ restart: on-failure
+ command: vsftpd /etc/vsftpd_ssl.conf
+
diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/prepare.sh b/test/mocks/datafilecollector-testharness/ftps-sftp-server/prepare.sh
new file mode 100755
index 000000000..76f333409
--- /dev/null
+++ b/test/mocks/datafilecollector-testharness/ftps-sftp-server/prepare.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+mkdir -p files/onap
+
+dd if=/dev/urandom of=./files/onap/0.5MB.tar.gz bs=1k count=512
+dd if=/dev/urandom of=./files/onap/1MB.tar.gz bs=1M count=1
+dd if=/dev/urandom of=./files/onap/5MB.tar.gz bs=1M count=5
+dd if=/dev/urandom of=./files/onap/10MB.tar.gz bs=1M count=10
+
+sudo chown root:root ./configuration/vsftpd_ssl.conf
diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/dfc.crt b/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/dfc.crt
new file mode 100644
index 000000000..0c00a5a5f
--- /dev/null
+++ b/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/dfc.crt
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDFjCCAf4CCQCfuDKplruMfDANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJT
+RTEKMAgGA1UECAwBMDEKMAgGA1UEBwwBMDEKMAgGA1UECgwBMDEMMAoGA1UECwwD
+RVNUMQwwCgYDVQQDDANFU1QwHhcNMTkwMjA1MTQwMDQ5WhcNMjAwMjA1MTQwMDQ5
+WjBNMQswCQYDVQQGEwJTRTEKMAgGA1UECAwBMDEKMAgGA1UEBwwBMDEKMAgGA1UE
+CgwBMDEMMAoGA1UECwwDRVNUMQwwCgYDVQQDDANFU1QwggEiMA0GCSqGSIb3DQEB
+AQUAA4IBDwAwggEKAoIBAQCzUSxAWVekRZ22WaDkPDUAK+ihxdoy9iXeakS2K4xR
+biT85qkyHP8kh/KgDTwcH/wJ5nSKxMh135s/EF1rJpLoDW+BR8HpAq/GX2V7N8lV
+E+cDyfLxTA/emptZ+sN6JKXpgwEs7B93EsomjBnu9G8lLHXBUMRywc9rRymivAVO
+DE+UsT6xO/thUgDtiKS4C37jmt0dabPblBcINY6a6dG3V+QsPXaHsKbg4O6y0jZL
+nLM4PBT47rL7grmngcEnXYb3zQPV9JxY3tAHJDyiMU2VkhSB1NbJ7rOMRImesJ5o
+cuLdKY12amTPQ2lwmTSL2ieGRYHo7OmZ+rPCWIksLbrbAgMBAAEwDQYJKoZIhvcN
+AQELBQADggEBAE/UvlH4tfoMkEs9eTk8WgpyBVcLA2Vo9F1o2a2tvj4iXFUWGMZK
+SJ+j4tnEBgpsIWNpWEOnD00ngOKTLuedFuS62if3QW34Y6Hax6qP+FMStko5jZ4F
+OALZb4GZU5MR0hLSig6aB6zDa1Qe2iVK7Lr7BWG1O+8NsTUP6akIwSQufAllrpJ/
+Ng02CWK6WCaMV5Z1CnVheBw9vf/3ZVh1tm8gRrJQGlcau2/8Mg3M7yThHuDz/rPm
+VbkO6aMRl3C115whBTpd1+/rwg0BzsIQjv56Ab34pWAQc20KsV8WPPDxzZhlZUHD
+yc0HiF1+blZHlzc/ie/07DSklUMKJv63D1s=
+-----END CERTIFICATE-----
diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.crt b/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.crt
new file mode 100644
index 000000000..28932806b
--- /dev/null
+++ b/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.crt
@@ -0,0 +1,19 @@
+-----BEGIN CERTIFICATE-----
+MIIDFjCCAf4CCQC2aMod08TgbDANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQGEwJT
+RTEKMAgGA1UECAwBMDEKMAgGA1UEBwwBMDEKMAgGA1UECgwBMDEMMAoGA1UECwwD
+RVNUMQwwCgYDVQQDDANFU1QwHhcNMTkwMjA1MTQwMDUwWhcNMjAwMjA1MTQwMDUw
+WjBNMQswCQYDVQQGEwJTRTEKMAgGA1UECAwBMDEKMAgGA1UEBwwBMDEKMAgGA1UE
+CgwBMDEMMAoGA1UECwwDRVNUMQwwCgYDVQQDDANFU1QwggEiMA0GCSqGSIb3DQEB
+AQUAA4IBDwAwggEKAoIBAQDUOXkcBkCqWEXri3TIB1xqd/reBSigsXb+54jRn8/1
+POQGE8BGE54RJd5xurtoLpqeuqgYl9jdLW0uyfZY/ef81K2qWwwmUtzMJmREyJ3x
+2QNoYfJKBbfQKHOQ1nEYBFWKo7nmWxNhJ7iBxEO1QL+jwgohF2gWgrx1KzV6Cu6S
+NX71jWEa3DkYNjc08dn6rMsLfXe8Rgc1EVLxfj+JG/CDnEyKavKmcxLZlk3zD0/i
+CCTaa23aeNCk4qOZ7k5T2Mlt82POlKztjjIBfpyxhoJmO2clRf6jso0BdRQ5r7yd
+4Y+FAUjNbS6A41SuxF8EbSIKtS2UAMUxf1fX74WOKLQPAgMBAAEwDQYJKoZIhvcN
+AQELBQADggEBAIjhg0KMyqg2EFeZOKinmeCEY3f+AfW9AnPc+MMQH7ITPJXXB4hR
+3KVzn4aX19x5b6KjLKtYI+tNHpN9bECWTGPv0yloUSJttyAMmNHYX++9GYHRQoFc
+9RKTzc4tZP1/vVFz0zov9iRKk1uhrEW+B7N4e/WDJpD8QbgiPGwAUsfC9lxJIdpl
+2UKWhA3KazuUgH+w2udh1tDzBKmRpSMS/vFQ6cfUXBfcJYOtCIbVhZwjy1oGc+vX
+PvFQCL6x+n7v12IUjzH6k284UxdqVdKBfPgkr774pFlTioa9fHu/eRBUPGOllePF
+sY9S5Ba0hFWunQyyiT4d34hwDjRKojenULc=
+-----END CERTIFICATE-----
diff --git a/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.key b/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.key
new file mode 100644
index 000000000..05144b39a
--- /dev/null
+++ b/test/mocks/datafilecollector-testharness/ftps-sftp-server/tls/ftp.key
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEpAIBAAKCAQEA1Dl5HAZAqlhF64t0yAdcanf63gUooLF2/ueI0Z/P9TzkBhPA
+RhOeESXecbq7aC6anrqoGJfY3S1tLsn2WP3n/NStqlsMJlLczCZkRMid8dkDaGHy
+SgW30ChzkNZxGARViqO55lsTYSe4gcRDtUC/o8IKIRdoFoK8dSs1egrukjV+9Y1h
+Gtw5GDY3NPHZ+qzLC313vEYHNRFS8X4/iRv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