Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generic container image #54

Merged
merged 11 commits into from
Jun 13, 2024
Merged

Add generic container image #54

merged 11 commits into from
Jun 13, 2024

Conversation

n-thumann
Copy link
Member

@n-thumann n-thumann commented Jun 12, 2024

What

This PR adds a generic container test image.

Why

To ease testing of OS detection VTs.

References

Jira: VTA-494

Tests

I built the images for all Debian releases via

for release in woody sarge etch lenny squeeze wheezy jessie stretch buster bullseye bookworm trixie;
do
    docker build --build-arg BASEIMAGE=debian --build-arg TAG=$release applications/generic -t generic:debian_$release
done
docker image ls generic

I can confirm that the images for Buster, Bullseye, Bookworm and Trixie buildable (technically, we could add older releases later by fixing apt update in them)

for release in 10.04 12.04 12.10 13.04 13.10 14.04 14.10 15.04 15.10 16.04 16.10 17.04 17.10 18.04 18.10 19.04 19.10 20.04 20.10 21.04 21.10 22.04 22.10 23.04 23.10 24.04;
do
    docker build --build-arg BASEIMAGE=ubuntu --build-arg TAG=$release applications/generic -t generic:ubuntu_$release
done
docker image ls generic

I confirmed that the images for 24.04, 23.10, 23.04, 22.10, 22.04, 21.10, 21.04, 20.10, 20.04, 19.10, 19.04, 18.10, 18.04, 17.10, 17.04 are 16.10 buildable.

I also scanned about a dozen of those images successfully via:

➜  ~ docker run --rm -it -p 2222:22 -p 80:80 -p 445:445 -p 3306:3306 generic:ubuntu_22.04
 * Starting MariaDB database server mariadbd                                                     [ OK ] 
 * Starting OpenBSD Secure Shell server sshd                                                     [ OK ] 
 * Starting Apache httpd web server apache2                                                             
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.16.0.2. Set the 'ServerName' directive globally to suppress this message
 * 
 * Starting SMB/CIFS daemon smbd                                                                 [ OK ] 
Ready!

And then run:

root@ospd-openvas:/ospd-openvas# openvas-nasl -X -i /var/lib/openvas/plugins/ -B -d -t 172.16.0.1 --kb="Secret/SSH/login=demo" --kb="Secret/SSH/password=demo" --kb="Services/ssh=2222" gather-package-list.nasl sw_http_os_detection.nasl gb_ssh_os_detection.nasl smb_nativelanman.nasl mysql_version.nasl gb_mysql_mariadb_os_detection.nasl os_detection.nasl gb_unknown_os_service_reporting.nasl
[...]
lib  misc-Message: 10:03:49.498: set key HostDetails/NVT/1.3.6.1.4.1.25623.1.0.105937/cpe:/o:canonical:ubuntu_linux:22.04:-:lts -> general/tcp
lib  misc-Message: 10:03:49.498: set key HostDetails/NVT/1.3.6.1.4.1.25623.1.0.105937/port -> general/tcp
Best matching OS:

OS:           Ubuntu 22.04 LTS
Version:      22.04 LTS
CPE:          cpe:/o:canonical:ubuntu_linux:22.04:-:lts
Found by VT:  1.3.6.1.4.1.25623.1.0.50282 (Determine OS and list of installed packages via SSH login)
Concluded from SSH login
Setting key "Host/runs_unixoide" based on this information

Other OS detections (in order of reliability):

OS:           Ubuntu 22.04
Version:      22.04
CPE:          cpe:/o:canonical:ubuntu_linux:22.04
Found by VT:  1.3.6.1.4.1.25623.1.0.105586 (Operating System (OS) Detection (SSH Banner))
Concluded from SSH banner on port 2222/tcp: SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.7

OS:           Ubuntu 22.04
Version:      22.04
CPE:          cpe:/o:canonical:ubuntu_linux:22.04
Found by VT:  1.3.6.1.4.1.25623.1.0.102011 (SMB NativeLanMan)
Concluded from SMB/Samba banner on port 445/tcp: 
OS String:  Windows 6.1
SMB String: Samba 4.15.13-Ubuntu
Note: The service is running on a Linux/Unix based OS but reporting itself with an Windows related OS string.

OS:           Ubuntu
CPE:          cpe:/o:canonical:ubuntu_linux
Found by VT:  1.3.6.1.4.1.25623.1.0.111067 (Operating System (OS) Detection (HTTP))
Concluded from PHP Server banner on port 80/tcp: X-Powered-By: PHP/8.1.2-1ubuntu2.17

OS:           Ubuntu 22.04
Version:      22.04
CPE:          cpe:/o:canonical:ubuntu_linux:22.04
Found by VT:  1.3.6.1.4.1.25623.1.0.111067 (Operating System (OS) Detection (HTTP))
Concluded from HTTP Server banner on port 80/tcp: Server: Apache/2.4.52 (Ubuntu) PHP/8.1.2-1ubuntu2.17

OS:           Ubuntu
CPE:          cpe:/o:canonical:ubuntu_linux
Found by VT:  1.3.6.1.4.1.25623.1.0.111067 (Operating System (OS) Detection (HTTP))
Concluded from HTTP Server default page on port 80/tcp: <title>Apache2 Ubuntu Default Page

OS:           Ubuntu 22.04
Version:      22.04
CPE:          cpe:/o:canonical:ubuntu_linux:22.04
Found by VT:  1.3.6.1.4.1.25623.1.0.108192 (Operating System (OS) Detection (MySQL/MariaDB))
Concluded from MySQL/MariaDB server banner on port 3306/tcp: 5.5.5-10.6.16-MariaDB-0ubuntu0.22.04.1

OS:           Ubuntu
CPE:          cpe:/o:canonical:ubuntu_linux
Found by VT:  1.3.6.1.4.1.25623.1.0.108192 (Operating System (OS) Detection (MySQL/MariaDB))
Concluded from MySQL/MariaDB server banner on port 3306/tcp: 5.5.5-10.6.16-MariaDB-0ubuntu0.22.04.1

@n-thumann n-thumann marked this pull request as ready for review June 13, 2024 08:27
@n-thumann n-thumann requested review from a team as code owners June 13, 2024 08:27
@n-thumann n-thumann enabled auto-merge (squash) June 13, 2024 08:27
Copy link
Member

@mbrinkhoff mbrinkhoff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If still available, can you post one of the scan outputs ?

applications/generic/init.sh Outdated Show resolved Hide resolved
@n-thumann n-thumann merged commit e28514a into main Jun 13, 2024
90 of 91 checks passed
@n-thumann n-thumann deleted the add_generic_container_image branch June 13, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants