서버 보안을 위해서 분기 혹은 반기별로 OS 취약점 점검을 실시해야해서
NCP에서 OS 취약점 점검을 하는 법을 공유하고자 한다.
Linux
1. Agent 다운로드
# wget http://pub-ossc.ncloud.com:10080/download/ncp_secuagent.tar.gz
우선 서버에 접속 후 원하는 경로에 들어가 Agent 다운로드를 한다.
2. Agent 실행
# tar xvzf ncp_secuagent.tar.gz
# ./ncp_secuagent
[Project : linux] => Success
이후에 ncp_secuagent.tar.gz의 압축을 풀고
./ncp_secuagent를 이용하여 Agent를 실행하면 OS 취약점 점검 완료이다.
점검 레포트는 네이버 클라우드 콘솔 => System Security Checker => OS Security Checker 에서 확인이 가능하다.
3. Agent 실행시 error
Agent를 실행하다보며 에러가 발생하는 경우가 있다.
이번 OS 취약점 점검에서는 하나의 에러가 발생했는데 yum Repo 에러가 발생했었다.
[root@ ncp_secuagent]# ./ncp_secuagent
[Project : linux] => Fail => [stdout]: ERROR(update doesn't running) : cmd(yum install perl-libwww-perl) not work.
[root@ ncp_secuagent]# yum list | grep perl-libwww-perl
Not using downloaded extras/repomd.xml because it is older than what we have:
Current : Wed Oct 5 02:24:54 2022
Downloaded: Fri Mar 19 23:39:07 2021
^Chttps://packages.microsoft.com/rhel/7/prod/repodata/repomd.xml: [Errno 14] curl#56 - "Network error recv()"
Trying other mirror.
One of the configured repositories failed (packages-microsoft-com-prod),
and yum doesn't have enough cached data to continue. At this point the only
safe thing yum can do is fail. There are a few ways to work "fix" this:
1. Contact the upstream for the repository and get them to fix the problem.
2. Reconfigure the baseurl/etc. for the repository, to point to a working
upstream. This is most often useful if you are using a newer
distribution release than is supported by the repository (and the
packages for the previous distribution release still work).
3. Run the command with the repository temporarily disabled
yum --disablerepo=packages-microsoft-com-prod ...
4. Disable the repository permanently, so yum won't use it by default. Yum
will then just ignore the repository until you permanently enable it
again or use --enablerepo for temporary usage:
yum-config-manager --disable packages-microsoft-com-prod
or
subscription-manager repos --disable=packages-microsoft-com-prod
5. Configure the failing repository to be skipped, if it is unavailable.
Note that yum will try to contact the repo. when it runs most commands,
so will have to try and fail each time (and thus. yum will be be much
slower). If it is a very temporary problem though, this is often a nice
compromise:
yum-config-manager --save --setopt=packages-microsoft-com-prod.skip_if_unavailable=true
failure: repodata/repomd.xml from packages-microsoft-com-prod: [Errno 256] No more mirrors to try.
https://packages.microsoft.com/rhel/7/prod/repodata/repomd.xml: [Errno 14] curl#56 - "Network error recv()"
이런 식으로 Agent를 실행 후 에러가 났을때
NCP에서 요구하는대로
# yum list | grep perl-libwww-perl
명령어를 치니 위와 같은 에러가 나왔다.
의외로 해결방법은 간단했다.
위 쪽 에러를 잘 살펴보면 packages-microsoft-com-prod 라는 문구가 있는데
yum Repo 에러 중에서도 microsoft repo 때문에 난 에러인 것을 확인 할 수가 있다.
[root@ etc]# cd yum.repos.d/
[root@ yum.repos.d]# ls
CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Media.repo CentOS-Sources.repo CentOS-Vault.repo CentOS-x86_64-kernel.repo microsoft.repo
[root@mng-astron-svr yum.repos.d]# mv microsoft.repo microsoft.repo.bak
[root@]# cd ncp_secuagent/
[root@ ncp_secuagent]# ./ncp_secuagent
[Project : linux] => Success
[root@ ncp_secuagent]# cd /etc/yum.repos.d/
[root@ yum.repos.d]# ls
CentOS-Base.repo CentOS-CR.repo CentOS-Debuginfo.repo CentOS-fasttrack.repo CentOS-Media.repo CentOS-Sources.repo CentOS-Vault.repo CentOS-x86_64-kernel.repo microsoft.repo.bak
[root@ yum.repos.d]# mv microsoft.repo.bak microsoft.repo
우선 /etc/yum.repos.d 경로로 들어가 해당되는 repo가 있는지 확인한다.
이후 해당되는 repo를 백업해둔 후
다시 에이전트를 실행하면 Success가 뜬다.
이후 다시 백업본을 기존의 이름으로 되돌리면 에러가 해결된다.
Windows
1. Agent 다운로드 => 압축 해제
#wget http://pub-ossc.ncloud.com:10080/download/ncp_secuagent.zip
cmd 창을 연 후 위의 명령어를 입력하여 zip 파일을 다운 받고
해당 폴더를 열어서 압축을 해제한다.
2. Agent 실행
cmd> ncp_secuagent.exe
[project : windows] => Success
cd 명령어를 이용하여 압축 해제한 폴더로 이동 후
ncp_secuagent.exe 명령어를 입력하여 에이전트를 실행하면
OS 취약점 점검이 완료된다.
점검 레포트는 네이버 클라우드 콘솔 => System Security Checker => OS Security Checker 에서 확인이 가능하다.
'Cloud > Naver Cloud Platform' 카테고리의 다른 글
[NCP] Cloud Insight Plugin_process GET Python 파일 공유 (0) | 2023.06.13 |
---|---|
[NCP] Cloud Insight Plugin_process POST Python 파일 공유 (2) | 2023.06.13 |
[NCP] SSL VPN 생성 및 네트워크 설정 방법 (VPC) (0) | 2023.01.06 |
[NCP] NCP 서버 스펙 변경 (0) | 2023.01.06 |
[NCP] NCP 백업 실패 (0) | 2022.12.22 |