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

feat(os): support Amazon Linux 2023 #1621

Merged
merged 1 commit into from
Mar 16, 2023
Merged

Conversation

MaineK00n
Copy link
Collaborator

@MaineK00n MaineK00n commented Mar 16, 2023

What did you implement:

support Amazon Linux 2023

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

$ docker build -t vuls-target:amzn2023 -f Dockerfile .
$ docker run --rm -itd -p 2222:22 --name vuls-target vuls-target:amzn2023
$ ssh -i /home/mainek00n/.ssh/id_rsa -p 2222 root@127.0.0.1
[root@51484e96c59a ~]# dnf install -y vim-common-2:9.0.1160-1.amzn2023.0.2.x86_64
[root@51484e96c59a ~]# exit
$ vuls scan
...
[Mar 16 16:55:03]  INFO [localhost] Validating config...
[Mar 16 16:55:03]  INFO [localhost] Detecting Server/Container OS... 
[Mar 16 16:55:03]  INFO [localhost] Detecting OS of servers... 
[Mar 16 16:55:03]  INFO [localhost] (1/1) Detected: docker: amazon 2023
[Mar 16 16:55:03]  INFO [localhost] Detecting OS of containers... 
[Mar 16 16:55:03]  INFO [localhost] Checking Scan Modes... 
[Mar 16 16:55:03]  INFO [localhost] Detecting Platforms... 
[Mar 16 16:55:05]  INFO [localhost] (1/1) docker is running on other
[Mar 16 16:55:05]  INFO [docker] Scanning OS pkg in fast mode


Scan Summary
================
docker	amazon2023	161 installed, 2 updatable

$ vuls report
...
[Mar 16 16:55:35]  INFO [localhost] OVAL amazon 2023 found. defs: 1557
[Mar 16 16:55:35]  INFO [localhost] OVAL amazon 2023 is fresh. lastModified: 2023-03-16T16:52:12+09:00
[Mar 16 16:55:35]  INFO [localhost] docker: 2 CVEs are detected with OVAL
[Mar 16 16:55:35]  INFO [localhost] docker: 0 unfixed CVEs are detected with gost
[Mar 16 16:55:35]  INFO [localhost] docker: 0 CVEs are detected with CPE
[Mar 16 16:55:35]  INFO [localhost] docker: 0 PoC are detected
[Mar 16 16:55:35]  INFO [localhost] docker: 0 exploits are detected
[Mar 16 16:55:35]  INFO [localhost] docker: Known Exploited Vulnerabilities are detected for 0 CVEs
[Mar 16 16:55:35]  INFO [localhost] docker: Cyber Threat Intelligences are detected for 0 CVEs
[Mar 16 16:55:35]  INFO [localhost] docker: total 0 CVEs detected
[Mar 16 16:55:35]  INFO [localhost] docker: 0 CVEs filtered by --confidence-over=80

docker (amazon2023)
===================
Total: 2 (Critical:0 High:0 Medium:2 Low:0 ?:0)
2/2 Fixed, 0 poc, 0 exploits, cisa: 0, uscert: 0, jpcert: 0 alerts
161 installed

+---------------+------+--------+-----+-----------+---------+----------------------+
|    CVE-ID     | CVSS | ATTACK | POC |   ALERT   |  FIXED  |       PACKAGES       |
+---------------+------+--------+-----+-----------+---------+----------------------+
| CVE-2022-4292 |  6.9 |        |     |           |   fixed | vim-common, vim-data |
+---------------+------+--------+-----+-----------+---------+----------------------+
| CVE-2023-0049 |  6.9 |        |     |           |   fixed | vim-common, vim-data |
+---------------+------+--------+-----+-----------+---------+----------------------+
  • Dockerfile
FROM public.ecr.aws/amazonlinux/amazonlinux:2023

RUN dnf -y upgrade && dnf -y install openssh-server glibc-langpack-en
RUN mkdir /var/run/sshd

RUN sed -i 's/#\?PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config
RUN sed -i 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' /etc/pam.d/sshd

ENV NOTVISIBLE "in users profile"
RUN echo "export VISIBLE=now" >> /etc/profile

COPY .ssh/id_rsa.pub /root/authorized_keys
RUN mkdir -p ~/.ssh && \
    mv ~/authorized_keys ~/.ssh/authorized_keys && \
    chmod 0600 ~/.ssh/authorized_keys

RUN ssh-keygen -A
RUN rm -rf /run/nologin

EXPOSE 22

# Vuls Setting
RUN dnf -y install dnf-utils which lsof iproute

CMD ["/usr/sbin/sshd", "-D"]

Checklist:

You don't have to satisfy all of the following.

  • Write tests
  • Write documentation
  • Check that there aren't other open pull requests for the same issue/feature
  • Format your source code by make fmt
  • Pass the test by make test
  • Provide verification config / commands
  • Enable "Allow edits from maintainers" for this PR
  • Update the messages below

Is this ready for review?: YES

Reference

@MaineK00n MaineK00n self-assigned this Mar 16, 2023
@MaineK00n MaineK00n marked this pull request as ready for review March 16, 2023 08:16
@kotakanbe kotakanbe merged commit 6682232 into master Mar 16, 2023
@kotakanbe kotakanbe deleted the MaineK00n/amazon-linux-2023 branch March 16, 2023 08:31
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.

None yet

2 participants