aboutsummaryrefslogtreecommitdiffstats
path: root/test/security
AgeCommit message (Collapse)AuthorFilesLines
2019-08-07k8s: Add Makefile targets for testingPawel Wieczorek2-3/+19
Issue-ID: SECCOM-235 Change-Id: I6ac5f3c160f1cd1d8faac90576ab943d4ed213a5 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-08-07k8s: Add Makefile targets for external dependenciesPawel Wieczorek2-4/+20
Building "check" binary now requires several external dependencies. To minimize setup effort, convenience make targets were provided. Issue-ID: SECCOM-235 Change-Id: Iec74c0652a5ed3a90d4504216b00ef20bdb7e81f Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-08-07k8s: Add support for RKE-deployed clustersPawel Wieczorek3-1/+232
RKE is used as a Kubernetes cluster deployment method from ONAP Dublin release. RKE cluster definition is used to get access to necessary information. Issue-ID: SECCOM-235 Change-Id: I588598011ea746b5f7ba327a48f1cea605e56d31 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-08-07k8s: Add test cases for Dublin API serverPawel Wieczorek1-0/+56
Issue-ID: SECCOM-235 Change-Id: Ie6d43b9db767f191f883a2912916bc8abf9d3ad6 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-08-07k8s: Unify order of API server test casesPawel Wieczorek1-1/+1
So far CIS-compliant configuration has been validated first unless configuration used in ONAP release did not pass given benchmark. Issue-ID: SECCOM-235 Change-Id: Ibdb523ab7ab6b8285757719721f75aca57beeb82 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-31k8s: Make ONAP context default for kubectlPawel Wieczorek1-1/+12
This patch uses previously added alias for kubectl context switching in case it is needed as a template for other contexts as well. Issue-ID: SECCOM-235 Change-Id: Ie92641ee3763a027cd74dd21bf4364a2d796eb1d Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-31k8s: Silence package manager and make it noninteractivePawel Wieczorek2-6/+20
This patch sets debconf frontend to noninteractive by including additional field in the first stanza of configuration file. Its placement has been chosen arbitrarily - both 'Config' and 'Templates' fields "are required in this first stanza" [1]. It also makes symlinking script more generic. [1] man 5 debconf.conf (provided by "debconf-doc" in Ubuntu) Issue-ID: SECCOM-235 Change-Id: If9dcc712d1ff7f527d3bc59f4c1709cffe4cbda5 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-31k8s: Add kubectl provisioners (downloading and setting up)Pawel Wieczorek4-3/+91
Setting up kubectl depends on presence of K8s cluster post-deployment artifacts, hence it's disabled by default. Relevant information added to post-up message. This patch also removes unneeded curly braces from "tools/dublin/get_rke.sh" script. Issue-ID: SECCOM-235 Change-Id: I917ebbda588639f0941e16c65759430a7a1e64ff Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-31k8s: Make operator machine destruction gracefulPawel Wieczorek1-0/+5
Issue-ID: SECCOM-235 Change-Id: I9913d9a8f525b4b9582bf821008dd567258a719c Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-31k8s: Add post-up message for actual cluster creationPawel Wieczorek1-0/+4
Issue-ID: SECCOM-235 Change-Id: I8f9d4362da50a8b3f2aa1baf3633d818da2ed3a5 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-29k8s: Allow Dublin cluster creation using RKEPawel Wieczorek2-6/+75
This patch adds sample cluster.yml which is based on Dublin cluster configuration file [1]. Main difference is in avoiding repetition by using anchors and alias nodes. Actual cluster creation provisioner is disabled by default because 'control' and 'worker' nodes might not be ready yet. [1] https://docs.onap.org/en/dublin/_downloads/27934fe702048777f312d77dc30cd05a/cluster.yml Issue-ID: SECCOM-235 Change-Id: Ibba0e754ba87e334cdaa61de83e48107f91083d9 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-26k8s: Extract hardcoded synced folder for dotfilesPawel Wieczorek1-4/+13
Issue-ID: SECCOM-235 Change-Id: I85efb88476cb1d6bfaee44b6bcd6275477e77ba5 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-26k8s: Use named provisionersPawel Wieczorek1-11/+11
This not only makes testing easier, but also allows better control over VM provisioning after its creation. Issue-ID: SECCOM-235 Change-Id: I29ab3ed46976267e1043c2f61f56578f2c5d7a57 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-26k8s: Add simple logging to provisioning scriptsPawel Wieczorek1-1/+9
Issue-ID: SECCOM-235 Change-Id: Iaeb4b3e621f09ea14b9576126223e4df4b8682f3 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-26k8s: Unify provisioning scriptsPawel Wieczorek1-11/+19
This patch: * removes remaining string interpolation (for future script reuse), * makes DNS replacement provisioner always run. This way VM definition is more concise and resilient. Issue-ID: SECCOM-235 Change-Id: I382dae5e256b46577c4c8af3aa45ab4d64d1b2b9 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-26k8s: Remove repetition from provisioning scriptsPawel Wieczorek1-2/+7
Issue-ID: SECCOM-235 Change-Id: If286ba074ee74c43705197a30c50322d5162e6fc Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-26k8s: Remove hardcoded password for 'vagrant' userPawel Wieczorek1-6/+19
Password for 'vagrant' user is now passed through exported environmental variable. This patch also: * removes the assumption of having 'vagrant' user on cluster nodes (for future scripts reuse), * removes mixed string interpolation and passing shell variables, * replaces '~' with '$HOME' for proper substitiution. Issue-ID: SECCOM-235 Change-Id: Id9e7b6acccd902de4c414cd8a0f095ac135fee5a Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-26k8s: Silence download utilitiesPawel Wieczorek3-0/+21
This patch intends to make virtual environment creation logs more readable. Parameters were chosen in a way errors will still be shown the operator. This patch might also prove itself useful in other virtual environment creation tools such as 'devtool' [1] (unless maintainers insist on having full logs). [1] https://git.onap.org/integration/devtool Issue-ID: SECCOM-235 Change-Id: I5e07b1b1ed37d36470c18ba0cfe653e40eff300b Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-24k8s: Change virtual environment utility scripts privilege requirementsPawel Wieczorek2-4/+37
This patch also extends in-file comment on scripts' requirements and suggested usage. Issue-ID: SECCOM-235 Change-Id: I0dddbad79fb3392ffe35c3e06d4006cd499d9923 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-24k8s: Add "vagrant" user to "docker" group in virtual environmentPawel Wieczorek1-0/+2
Node customization scripts do that for "ubuntu" user only (added by default on OpenStack images). Vagrant boxes use "vagrant" user [1] instead. [1] https://www.vagrantup.com/docs/boxes/base.html#quot-vagrant-quot-user Issue-ID: SECCOM-235 Change-Id: Ic4f832aa9a37230503e3c5bd29f8ae5fcd3883db Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-21k8s: Add virtual environment for DublinPawel Wieczorek5-0/+164
Default cluster nodes customization scripts were extracted in the same manner as those for Casablanca release [1]. Constraints still apply. [1] SHA-1: ea8bc1a719a36c89e7eae42080b1835e5ef0c28d (Change-Id: I57f9f3caac0e8b391e9ed480f6bebba98e006882) Issue-ID: SECCOM-235 Change-Id: I54ada5fade3b984dedd1715f20579e3ce901faa3 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-21k8s: Extract all remaining hardcoded constantsPawel Wieczorek1-2/+5
Vagrant VM definition no longer contains hardcoded values in cluster definition. Issue-ID: SECCOM-235 Change-Id: Id9f2d9878a7d788a62d5a12ccd47dfafe9f39fe3 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-19k8s: Replace default DNS to work in corporate networksPawel Wieczorek1-0/+3
Default DNS addresses used in "generic/ubuntu1604" box (4.2.2.1, 4.2.2.2, 208.67.220.220) might not work properly in corporate environment. To deal with this, host machine DNS configuration can be used instead. Issue-ID: SECCOM-235 Change-Id: Ic8a5553f01989e1a2b00228fa0449a680f11d452 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-15k8s: Fix mismatching names in Rancher CLI downloaderPawel Wieczorek1-1/+1
Issue-ID: SECCOM-235 Change-Id: Iab0086634bcfaba772852352c72e03a3d6833801 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-15k8s: Move release-specific files to separate directoryPawel Wieczorek5-3/+3
Kubernetes cluster deployment procedure changed with Dublin release (Rancher to RKE). In order to prepare for further adjustments, incompatible content will be moved to separate directories. Once Casablanca becomes obsolete (by the time of El Alto), files specific to that release will be removed completely. Issue-ID: SECCOM-235 Change-Id: Iaa0fc2f6ad330ec09dcfdf8a2d27b8a4dc433a0f Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-08k8s: Make convenience targets CI-friendlyPawel Wieczorek1-2/+2
Previously "clean" target failed if there were no build artifacts. Now their absence is ignored. Issue-ID: SECCOM-235 Change-Id: I47beb2754a893e8b7453611116b4da2e516cca90 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-08k8s: Add tests for API server validatorsPawel Wieczorek4-1/+194
This patch also adds convenience target to the Makefile and updates documentation on relevant dependencies. Issue-ID: SECCOM-235 Change-Id: I57e00af3cd4c60af3128e3094607cc61bc1e5dbe Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-08k8s: Relax kublet HTTPS connection requirementPawel Wieczorek2-6/+7
According to kube-apiserver documentation [1] and CIS guideline 1.1.4 option "--kubelet-https=" might be absent in API server configuration. It has secure configuration (being set to "true") by default. [1] https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/ Issue-ID: SECCOM-235 Change-Id: I604cdcace03f65185aab6a0b34d48cfec94277ab Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-08k8s: Make Rancher CLI provisioner configurablePawel Wieczorek1-5/+20
Apparently Linux AMD64 machines are not the only ones used for ONAP development (author meant no harm). Issue-ID: SECCOM-235 Change-Id: Ia78a02fb82dc5752d6b8fd2cef8e6ef583fd3ca6 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-08k8s: Make Rancher CLI provisioner reusablePawel Wieczorek2-9/+14
Having Rancher CLI proves itself useful on development machines as well. Issue-ID: SECCOM-235 Change-Id: I0de3109e1236cf6dc9cbc825342593041dcfdf2c Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-08k8s: Add Rancher CLI to test environmentPawel Wieczorek1-0/+9
Issue-ID: SECCOM-235 Change-Id: I46e2f8d61c3a82613b665fb6d9b57431bb2a1868 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-08k8s: Add virtual environment for testingPawel Wieczorek4-0/+143
This patch adds simplified ONAP deployment environment (Kubernetes cluster managed by Rancher). Its purpose is to provide cluster defaults for inspection without the need to access actual ONAP application deployment. Default node customization scripts were extracted ("tools/get_customization_scripts.sh" run within "tools/imported/" directory) from official documentation [1] and imported here in order not to introduce runtime online dependencies. This environment should probably be migrated in future to more appropriate place like devtool [2] (or at least use the same Vagrant boxes). [1] https://docs.onap.org/en/casablanca/submodules/oom.git/docs/oom_setup_kubernetes_rancher.html [2] https://git.onap.org/integration/devtool Issue-ID: SECCOM-235 Change-Id: I57f9f3caac0e8b391e9ed480f6bebba98e006882 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-08k8s: Validate API server address and port flagsPawel Wieczorek2-2/+37
This patch verifies if CIS Kubernetes Benchmark v1.3.0 sections regarding master node configuration are satisfied (1.1.6 and 1.1.7). Issue-ID: SECCOM-235 Change-Id: I5f215a6642b177e85d7e1c70860ba0c7e558ec4e Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-08k8s: Validate API server boolean flagsPawel Wieczorek2-1/+107
This patch verifies if CIS Kubernetes Benchmark v1.3.0 sections regarding master node configuration are satisfied (1.1.1 - 1.1.5, 1.1.8, 1.1.9, 1.1.20 and 1.1.23). Issue-ID: SECCOM-235 Change-Id: Ib964b5111b616a891c3963ef9695af660810e8ba Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-07-08k8s: Add documentation on runtime dependenciesPawel Wieczorek1-0/+12
Issue-ID: SECCOM-235 Change-Id: I370636220151a5755f467055418f866afe11d5d9 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-06-24k8s: Obtain relevant information from RancherPawel Wieczorek2-0/+95
This patch introduces Rancher queries using its CLI client. It depends on having utility binary located in PATH and providing configuration file prior first use. Issue-ID: SECCOM-235 Change-Id: Idb011e27b4801c5700b4482656463849736298da Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-06-20k8s: Add basic structure for validation toolPawel Wieczorek5-0/+58
This patch introduces CLI utility for checking if Kubernetes cluster follows security recommendations. Provided Makefile simplifies setup process by setting appropriate environment variables for the build. Further information can be found in README. Provided symlink allows proper document rendering on VCS hosting site. Issue-ID: SECCOM-235 Change-Id: I4a1337c9834322ee4fd742a9ccb979b9bc505f75 Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
2019-05-29Search endpoint script fail silentlyLucjan Bryndza1-0/+11
When nmap or other commands are not installed on the system script fail silently without any information Signed-off-by: Lucjan Bryndza <l.bryndza@samsung.com> Change-Id: I599b987e223f88617aefa2c0de6cdcbbf3ff50b7 Issue-ID: SECCOM-231
2019-05-10Don't treat error reply as a proper JDWP handshakeKrzysztof Opasiak1-1/+2
As it turned out thanks to Yan Yang some ONAP services tend to return a propr JDWP handshake as a part of their error message. Let's filter out those services by checking number of lines returned by the server. We expect that proper JDWP handshake won't be longer than a single line. Issue-ID: SECCOM-231 Change-Id: I4b8950ebdf5fe118ec5f2dd5f4de583211784fb2 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2019-05-06Don't wait forever for jdwp responseKrzysztof Opasiak1-1/+2
Some of web services do not send any data when challenged with JDWP challenge. This makes the script waiting forever for response. To fix that let's introduce 10s timeout (experimental value) and replace empty string with a new line to avoid bash warnings. Issue-ID: SECCOM-231 Change-Id: I35546c001c5c54f298e8a4e346c2cf5d41e230ac Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2019-04-25Make the script working on Dublin releaseKrzysztof Opasiak1-1/+1
With the introduction of RKE instead of rancher format of pod description has slightly changed (annotations). Let's addjust our security tests to work correctly with recent ONAP release. Issue-ID: SECCOM-231 Change-Id: I49cdfcae9ce41a2b4bd4969958eddfaffe75b437 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2019-04-25User first node for port scanning instead of last oneKrzysztof Opasiak1-1/+1
It is more obvious to use first node in cluster instead of last one. Additionally in some cases nodes listed in the end may not expose all open ports (like it is in integration lab). Issue-ID: SECCOM-231 Change-Id: I200998b2e7b3a6de9b5f464e59e3b7dbbc0a656c Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2019-03-21Add script which looks for open JDWP portsKrzysztof Opasiak1-0/+93
ONAP should not expose any open JDWP ports even inside a cluser. Let's start enforcing this by adding test script to integration which will find all open JDWP ports. Based on initial work by: Radoslaw Zeszczuk <r.zeszczuk@samsung.com> Issue-ID: SECCOM-231 Change-Id: Ica46faad55850c74ed24728d54f6afdb3301a6d2 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>
2019-03-21Add script which checks for http portsKrzysztof Opasiak1-0/+68
ONAP should not exposed any http ports, https should be used instead. Let's start enforcing this by adding test script to integration which will find all http ports exposed outside of cluster. Issue-ID: SECCOM-231 Change-Id: I88e4b7890aaaa1bea06b496a6f97f4d5e9771215 Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com>