파일 시스템 보안
특수속성
앞에서 설명 되었던 일반 권한(rwx)과 특수 권한(set-uid, set-gid, sticky-bit)외에 파일 시스템 수준의 특수 속성(attribute)가 존재하고 이를 lsattr 명령어로 확인하고 chattr 명령어로 설정할 수 있다.
기호 | 의미 |
i | immutable: 변경 불가 (삭제/수정/이름변경 불가) |
a | append only: 덧붙이기만 가능, 삭제/수정 불가 |
d | no dump: dump 백업 시 제외 |
e | extents 사용 중 (ext4 전용 내부용 표시) |
A | atime 기록 안 함 (access time 안 바뀜) |
S | synchronous updates: 파일 변경 발생 시, 즉시 디스크에 동기화 |
man chattr
특수 속성에 대한 기호가 떠오르지 않을 때, Description을 참조하면 유용하다.
DESCRIPTION
chattr changes the file attributes on a Linux file system.
The format of a symbolic mode is +-=[aAcCdDeFijmPsStTux].
The operator '+' causes the selected attributes to be added to the existing attributes of the
files; '-' causes them to be removed; and '=' causes them to be the only attributes that the files
have.
The letters 'aAcCdDeFijmPsStTux' select the new attributes for the files: append only (a), no atime
updates (A), compressed (c), no copy on write (C), no dump (d), synchronous directory updates (D),
extent format (e), case-insensitive directory lookups (F), immutable (i), data journaling (j),
don't compress (m), project hierarchy (P), secure deletion (s), synchronous updates (S), no tail-
merging (t), top of directory hierarchy (T), undeletable (u), and direct access for files (x).
The following attributes are read-only, and may be listed by lsattr(1) but not modified by chattr:
encrypted (E), indexed directory (I), inline data (N), and verity (V).
Not all flags are supported or utilized by all file systems; refer to file system-specific man
pages such as btrfs(5), ext4(5), and xfs(5) for more file system-specific details.
$ lsattr test.txt
--------------e----- test.txt
$ chattr +A +i test.txt
$ lsattr test.txt
----i--A------e----- test.txt
$ chattr -A -i test.txt
$ lsattr test.txt
--------------e----- test.txt
이와 같이 lsattr로 파일 속성을 확인하고, chattr로 속성을 변경할 수 있다. 속성을 추가할때는 +, 속성을 제거할때는 -를 기호 앞에 붙여 사용하면 된다.
ACL (Access Control List)
파일이나 디렉토리에 대해 기본 소유자/그룹 외의 사용자나 그룹에게 별도의 권한을 부여할 수 있는 기능이다. 가령, 특정 파일을 A는 읽기만, B는 읽기/쓰기 모두 가능하게 하는 설정이 가능하다.
$ getfacl test.txt
# file: test.txt
# owner: root
# group: root
user::rw-
group::r--
other::r--
$ setfacl -m u:lim:rw test.txt
$ getfacl test.txt
...
user:lim:rw-
...
$ setfacl -m g:test:rw test.txt
$ getfacl test.txt
...
group:test:rw-
...
getfacl을 통해 설정된 ACL을 확인할 수 있으며, setfacl을 통해 ACL을 수정, 삭제할 수 있다.
man setfacl
사용 방법을 직관적으로 확인하기 위해 Examples를 확인하면 유용하다.
EXAMPLES
Granting an additional user read access
setfacl -m u:lisa:r file
Revoking write access from all groups and all named users (using the effective rights mask)
setfacl -m m::rx file
Removing a named group entry from a file's ACL
setfacl -x g:staff file
Copying the ACL of one file to another
getfacl file1 | setfacl --set-file=- file2
Copying the access ACL into the Default ACL
getfacl --access dir | setfacl -d -M- dir
네트워크 보안
해당 네트워크 보안은 실제 서버를 구축할때 고민을 많이했던 부분이여서 더 와닿는다. 보통 리눅스를 웹서버로 활용을 많이하기 때문에 적절히 사용하면 정말 좋은 설정들이라고 생각한다.
sysctl
$ sysctl -n net.ipv4.tcp_timestamps
1
$ sysctl -w net.ipv4.tcp_timestamps=0
net.ipv4.tcp_timestamps = 0
기본적으로 sysctl은 /proc/sys 이하의 파일들을 기반으로 설정값을 저장하며 해당 파일을 직접 수정할 수 있다. 본 네트워크 보안에서는 /proc/sys/net/ipv4이하의 파일들을 주로 다룬다. sysctl 명령어는 조회는 -n 옵션을, 수정은 -w옵션을 사용할 수 있으며 아래 표의 예시와 같이 /proc/sys 이하의 파일들을 기반으로 파라미터 이름이 정해진다.
보안 위협 | 설명 | 예시 설정 |
서버 날짜 정보 유출 | HTTP 헤더나 시스템 응답에서 시스템 시간 노출 | net.ipv4.tcp_timestamps = 0 |
SYN Flooding | TCP SYN 패킷 대량 전송으로 자원 고갈 유도 | net.ipv4.tcp_syncookies = 1 |
ping 차단 | ICMP Echo 요청(ping)에 응답하지 않음 | net.ipv4.icmp_echo_ignore_all = 1 |
스머프 공격 | 브로드캐스트 ICMP 응답 대량 반사 공격 방지 | net.ipv4.icmp_echo_ignore_broadcasts = 1 |
과다 세션 공격 | 세션 백로그를 고갈시키는 DoS 방지 | net.ipv4.tcp_max_syn_backlog = 2048 |
TCP keepalive 시간 설정 | 죽은 연결을 빨리 감지하여 자원 낭비 방지 | net.ipv4.tcp_keepalive_time = 600 |
로컬 포트 사용범위 설정 | 커널이 사용할 ephemeral 포트 범위 제한 | net.ipv4.ip_local_port_range = 10000 65000 |
IP 포워딩 기능 제한 | 라우팅 기능을 꺼서 시스템이 패킷 중계하지 못하도록 함 | net.ipv4.ip_forward = 0 |
보안 위협 | 설명 | 예시 설정 |
ICMP Redirect 공격 | 라우터가 아닌 시스템이 ICMP redirect를 받아서 라우팅 테이블을 변조당하는 것을 방지 | net.ipv4.conf.all.accept_redirects = 0net.ipv4.conf.all.send_redirects = 0 |
소스 라우팅 공격 | 패킷의 경로를 송신자가 지정할 수 있게 하는 기능 차단 (보안상 매우 위험) | net.ipv4.conf.all.accept_source_route = 0 |
패킷 스니핑 | 역방향 경로 필터링으로 IP 스푸핑 차단 (source IP 검증) | net.ipv4.conf.all.rp_filter = 1 |
브로드캐스트 ping 공격 | 브로드캐스트 주소에 대한 ping 응답을 차단하여 대량 반사 공격 방지 | net.ipv4.icmp_echo_ignore_broadcasts = 1 |
IP 스푸핑 대응 | 이상한 소스 IP를 가진 패킷을 로그로 기록해 스푸핑 탐지 가능 | net.ipv4.conf.all.log_martians = 1 |
TCP Window Size 조작 공격 | 윈도우 스케일링 기능을 끄면 일부 고급 TCP 조작 기법을 방어 가능 (단, 성능 저하 가능성 있음) | net.ipv4.tcp_window_scaling = 0 |
IPv6 관련 공격 제한 | ICMPv6 Redirect 및 Router Advertisement 차단 | net.ipv6.conf.all.accept_redirects = 0net.ipv6.conf.all.accept_ra = 0 |
core dump 정보 유출 차단 | SUID 프로그램에서 발생하는 core dump를 저장하지 않도록 하여 민감 정보 유출 방지 | fs.suid_dumpable = 0 |
파일 핸들 제한 (DoS 방어) | 시스템 전체에서 열 수 있는 파일 디스크립터 개수 제한 설정 (리소스 고갈 방지) | fs.file-max |
프로세스 수 제한 | 생성 가능한 프로세스 최대 수 제한 (fork bomb 대응) | kernel.pid_max |
exec-shield 무력화 방지 (x86) | 실행 가능한 메모리 영역 제한 (NX/XD 비트 보호 강화) | kernel.exec-shield = 1 |
BPF (eBPF) 차단 | 일반 사용자가 eBPF 프로그램을 실행하지 못하게 차단 (커널 취약점 보호) | kernel.unprivileged_bpf_disabled = 1 |
kptr_restrict | /proc/kallsyms에서 커널 주소 숨김 → ASLR 우회 어려움 | kernel.kptr_restrict = 2 |
영구 반영
/etc/sysctl.conf에 커널 파라미터 설정 값을 지정해서 부팅때마다 설정되게 할 수 있다.
$ cat /etc/sysctl.conf
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
net.ipv4.tcp_timestamps = 0
SELinux
SELinux Status / mode
disable | 아무 정책도 적용하지 않고 SELinux를 사용하지 않는 상태를 의미한다. |
permissive | 정책에 위반되는 행위가 로그로 남겨진다. |
enforce (enforcing) | 정책에 위반되는 행위가 차단된다. |
SELinux의 상태는 disable과 enable이 있고 모드는 disable, permissive, enforcing이 존재한다. disable ↔ enable 즉 상태를 변경하기 위해서는 SELinux의 config 파일을 직접 수정하고 재부팅하여 적용한다. enable 상태에서 모드 변경 즉, permissive ↔ enforcing의 변경은 setenforce 명령어로 수행한다.
일반적인 SELinux의 적용의 경우 적극적인 차단으로 인해 의도치 않은 프로세스 및 파일 접근에 대한 차단이 일어날 수 있으므로 permissive 상태에서 충분히 디버그를 마친 뒤 enforcing으로 변경하는 것이 권장된다.
SELinux Config
$ ls -l /etc/selinux/config
-rw-r--r--. 1 root root 1263 Mar 7 11:54 /etc/selinux/config
$ ls -l /etc/sysconfig/selinux
lrwxrwxrwx. 1 root root 17 Mar 7 11:54 /etc/sysconfig/selinux -> ../selinux/config
/etc/sysconfig/selinux도 결국 /etc/selinux/config를 심볼릭 링크로 가리키고 있기 때문에 config 파일은 사실상 하나이다. 해당 파일을 수정함으로 써, 부팅시 SELinux의 동작 상태를 지정할 수 있으며 해당 설정으로 disable과 enable을 변경할 수 있다.
$ cat /etc/sysconfig/selinux
...
## SELINUX = disable, permissive, enforcing
## 위 설정으로 disable, enable(permissive or enforcing) 변경이 가능하다.
## permissive와 enforcing간의 변경은 setenforce 명령어로 가능하다.
SELINUX=enforcing
SELINUXTYPE=targeted
SELinux Command
$ sestatus
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Memory protection checking: actual (secure)
Max kernel policy version: 33
$ sudo setenforce permissive
$ sestatus
...
Current mode: permissive
...
sestatus를 통해 현재 SELinux의 모드를 알 수 있고, setenforce를 통해 SELinux의 모드(enforcing, permissive)를 변경할 수 있다.
SSH
SSH 연결은 꽤나 많이 접해본 내용일 확률이 높다. AWS EC2와 같은 클라우드 컴퓨팅 인스턴스에 접근하기 위해서는 보통 PAM 형식의 key-file로 접근하는 경우가 많기 때문이다. ssh에 대한 옵션들은 man ssh로 확인하여 찾는 것이 빠르다. 때문에 해당 내용에선 기본적인 사용 방법만 제시하고 SSH 설정 자체에 중점을 둔다.
SSH 서버 및 클라이언트
- 서버
$ dnf install openssh-server
$ systemctl start sshd
단순히 openssh-server를 설치하고 이를 systmctl로 구동시키기만 하면 된다. 만약 재부팅 상황에서도 sshd(SSH 데몬)을 구동시키려면 systemctl enable sshd로 시작시 실행할 시스템 데몬으로 등록해주면 된다.
- 클라이언트
$ dnf install openssh-clients
# 일반적인 접근
$ ssh [user]@[ssh-ip]
ex) ssh user@192.168.0.1
$ ssh -l [uesr] [ssh-ip] # 잘 사용 X
ex) ssh -l user 192.168.0.1
# 특정 포트에 접근
$ ssh -p [port] [user]@[ssh-ip]
ex) ssh -p 3000 user@192.168.0.1
# 접근 후 바로 커맨드 실행 (세션 유지 X)
$ ssh [user]@[ssh-ip] [command]
ex) ssh user@192.168.0.1 'ls -l /var/log'
인증키를 사용한 SSH 접근
인증키는 디지털 서명을 이용하여 client가 server에 미리 public key를 보내고 서버는 이를 저장했다가 이후에 접근 시, 암호 대신 주어진 첼린지에 대한 서명 값을 검증하는 형태로 client를 인가한다. 첼린지를 시도하고 이를 인가하는 것은 ssh가 해결 해주기 때문에 client 입장에서는 초기 public-key와 private-key 즉 공개키 쌍을 생성하고 이를 ssh 시도시에 보내는 선행 작업이 필요하게 된다.
# Public / Private key pair 생성
$ ssh-keygen -t rsa
# 서버에 Public Key 전달 (자동)
$ ssh-copy-id user@192.168.0.1
# 서버에 Public Key 전달 (수동)
$ ssh user@192.168.0.1 mkdir .ssh
$ scp .ssh/id_rsa.pub 192.168.0.1:.ssh/authorized_keys
$ ssh user@192.168.0.1 chmod 700 /home/user/.ssh
$ ssh user@192.168.0.1 chmod 600 /home/user/.ssh/authorized_keys
SSH 환경설정 (/etc/ssh/sshd_config)
항목 | 설명 | 권장(예시) 설정 |
Port | SSH 서버가 수신할 포트 번호 | Port 2222 (기본값은 22, 보안 위해 변경 권장) |
PermitRootLogin | 루트 계정의 직접 로그인 허용 여부 | PermitRootLogin no (prohibit-password도 가능) |
AllowUsers | 접속을 허용할 사용자 지정 (공백 구분) | AllowUsers devuser admin (허용할 계정만 명시) |
LoginGraceTime | 로그인 인증을 완료할 수 있는 유예 시간 | LoginGraceTime 30 (단위는 초) |
PasswordAuthentication | 비밀번호 로그인 허용 여부 | PasswordAuthentication no (공개키 인증만 허용 시) |
PubkeyAuthentication | 공개키 인증 허용 여부 | PubkeyAuthentication yes |
TCPKeepAlive | 연결 유지를 위한 TCP keepalive 패킷 전송 여부 | TCPKeepAlive yes (중간 NAT나 방화벽 회피 목적) |
man sshd_config
예를들어 root 계정 접근 차단과 같은 문제를 받았지만 설정 값을 모를때 아래와 같이 조회하면 유용하다.
$ man sshd_config | grep -i root
by root, not writable by group or others and specified by an absolute path. Arguments to
AuthorizedPrincipalsFile. The program must be owned by root, not writable by group or others
ChrootDirectory
Specifies the pathname of a directory to chroot(2) to after authentication. At session
startup sshd(8) checks that all components of the pathname are root-owned directories which
are not writable by any other user or group. After the chroot, sshd(8) changes the working
directory to the user's home directory. Arguments to ChrootDirectory accept the tokens de‐
The ChrootDirectory must contain the necessary files and directories to support the user's
/dev/log inside the chroot directory on some operating systems (see sftp-server(8) for de‐
The default is none, indicating not to chroot(2).
ChrootDirectory. The default is none.
AuthorizedPrincipalsCommandUser, AuthorizedPrincipalsFile, Banner, ChrootDirectory,
PermitOpen, PermitRootLogin, PermitTTY, PermitTunnel, PermitUserRC, PubkeyAcceptedAlgorithms,
PermitRootLogin
Specifies whether root can log in using ssh(1). The argument must be yes, prohibit-password,
word and keyboard-interactive authentication are disabled for root.
If this option is set to forced-commands-only, root login with public key authentication will
remote backups even if root login is normally not allowed). All other authentication methods
are disabled for root.
If this option is set to no, root is not allowed to log in.
does not apply to ChrootDirectory, whose permissions and ownership are checked uncondition‐
configurations using ChrootDirectory to force a different filesystem root on clients.
If UsePAM is enabled, you will not be able to run sshd(8) as a non-root user. The default is
ChrootDirectory accepts the tokens %%, %h, %U, and %u.
Contains configuration data for sshd(8). This file should be writable by root only, but it
PAM
PAM이 나오기 전에는 인증 방식이 서비스마다 달라 서비스마다 인증 로직을 구현해 주어야 했고, 이러한 문제로 시대가 지남에 따라 새로운 인증 방식(2FA, OTP, LDAP 등)이 추가되어 적용 하고자 할 때 모든 프로그램에 해당 인증 방식이 추가되어야 했다. 또한, 동일한 사용자임에도 서비스마다 다른 인증 정책을 사용할 수 도 있는데 비밀번호 정책이나 실패 횟수, 로그인 메시지 등 통일되지 않은 설정들이 많았다. 때문에 인증을 한 곳에서 통합하여 관리할 방법을 모색했고 PAM(Pluggable Authentication Modules)이 등장했다.
유연성 | 다양한 인증 방법(비밀번호, OTP, 생체 등)을 손쉽게 추가/제거할 수 있음 |
일관성 | 로그인, su, ssh, sudo 등 시스템 전체에 동일한 인증 정책을 적용 |
보안성 | 실패 제한, 계정 잠금, 2FA 등 다층 보안 정책을 적용 가능 |
/etc/pam.d (or /etc/pam.conf)
$ ls /etc/pam.d
atd cups gdm-pin polkit-1 smtp sudo-i xserver
chfn fingerprint-auth gdm-smartcard postlogin smtp.postfix su-l
chsh gdm-autologin login remote sshd system-auth
cockpit gdm-fingerprint other runuser sssd-shadowutils systemd-user
config-util gdm-launch-environment passwd runuser-l su vlock
crond gdm-password password-auth smartcard-auth sudo vmtoolsd
이와 같이 /etc/pam.d 디렉터리에 설정 파일들이 모여있다. (서비스가 늘어남의 따라 /etc/pam.conf 단일 파일로 관리하는 경우는 거의 없지만 알아두도록 하자.)
설정 내용
구분 | 설정값 | 설명 |
Module Type (시점) |
auth | 사용자 인증 수행 (비밀번호, OTP, 2FA 등) |
account | 계정 유효성 확인 (만료, 접근 제한, 시간제한 등) | |
password | 비밀번호 변경 시 정책 적용 | |
session | 로그인 후 세션 초기화 작업 | |
Control Flag (결과 제어) |
required | 실패해도 다음 모듈 진행, 최종 결과에 영향 |
requisite | 실패 시 즉시 인증 중단, 결과도 실패 | |
sufficient | 성공 시 즉시 인증 통과, 이후 required 무시 | |
optional | 단독으로는 의미 없음, 참고용 | |
include | 다른 PAM 설정 파일을 포함시킴 (공통 정책 재사용) | |
substack | 포함된 파일을 독립된 제어 흐름으로 실행, 결과는 부모와 별도로 평가됨 | |
- 접두사 | 모듈 실패 시에도 무시하고 계속 진행함 | |
[control=return] | 조건부 흐름 제어 (고급 사용) | |
Module Name (동작) |
pam_unix.so | 기본 shadow password 인증 처리 |
pam_google_authenticator.so | 2단계 인증 (OTP) 지원 | |
pam_tally2.so | 로그인 실패 횟수 제한, 계정 잠금 | |
pam_securetty.so | 루트 로그인 TTY 제한 | |
pam_nologin.so | /etc/nologin 존재 시 로그인 차단 | |
pam_limits.so | 세션에 ulimit 등 자원 제한 적용 | |
pam_env.so | 로그인 환경 변수 로딩 | |
pam_motd.so | /etc/motd 메시지 출력 | |
pam_listfile.so | 사용자 또는 그룹 화이트리스트/블랙리스트 적용 | |
Module Arguments (세부 설정) |
nullok | 비밀번호가 없어도 인증 허용 (보안상 위험) |
try_first_pass | 이전 모듈에서 입력한 비밀번호 재사용 시도 | |
use_first_pass | 이전 모듈에서 입력한 비밀번호 반드시 사용 | |
deny=5 | 최대 로그인 실패 횟수 지정 | |
unlock_time=300 | 계정 잠금 해제까지의 대기 시간(초) | |
logfile=/var/log/pam.log | 로그 기록 파일 경로 지정 | |
audit | 감사를 위한 상세 로그 출력 | |
debug | 디버깅 정보 출력 | |
no_warn | 경고 메시지 출력하지 않음 | |
envfile=/etc/environment | 환경변수 파일 로딩 |
Example
auth sufficient pam_unix.so try_first_pass nullok
- auth → 사용자 인증 수행 시
- sufficient → 성공 시, 인증 통과
- pam_unix.so → 기본 shadow password 인증 처리
- try_first_pass → 이전 모듈에서 비밀번호 입력한 경우 재사용
- nullok → 비밀번호가 없는 계정인 경우 비밀번호가 없어도 허용
man pam.d에 대략적인 설명이 나와있으므로 값들이 떠오르지 않을때 참고하도록 하자.
sudo
/etc/sudoers
user host=(run-as-user:run-as-group) command
유저가 sudo를 사용할 수 있는 권한 혹은 상황이 /etc/sudoers에 설정되어 있다. 해당 설정에 대한 형식은 위와 같이 구성 되어 있다
항목 | 설명 | 예시 |
User | sudo 명령을 사용할 수 있는 사용자 또는 그룹 | alice, %devops |
Host | 해당 설정이 적용될 서버(hostname/IP) | ALL, web01, 192.168.1.10 |
Run-as-User | 명령을 실행할 때 변경할 사용자 | (root), (nginx) |
Run-as-Group | 명령 실행 시 소속 그룹 지정 (선택적) | (ALL:admin) |
Commands | 해당 사용자가 sudo로 실행할 수 있는 명령어 | /bin/systemctl, /usr/bin/apt, ALL |
특정 user가 특정 host에서, 특정 명령(commands)을 실행할 수 있는데, 그 실행은 run-as-user:run-as-group의 권한으로 수행된다.
visudo
위 /etc/sudoers에 대한 편집을 vi나 vim을 이용해서 진행하여도 상관없다 하지만 잘못된 내용(특히 Syntax Error)이 저장되는 상황에서 sudo 명령이 아에 작동 불능이 되거나 root 권한을 상실해 직접 물리적으로 서버에 접근해야 하는 경우가 발생할 수 있다. 따라서 이를 방지하고 sudoers에 대한 syntax를 점검해주는 visudo를 이용하여 수정하는 것이 권장된다.
man sudoers
Syntax에 대해서 직관적으로 빠르게 확인하려면 Examples를 참조하는 것이 좋다.
EXAMPLES
Below are example sudoers file entries. Admittedly, some of these are a bit contrived. First, we
allow a few environment variables to pass and then define our aliases:
# Run X applications through sudo; HOME is used to find the
# .Xauthority file. Note that other programs use HOME to find
# configuration files and this may lead to privilege escalation!
Defaults env_keep += "DISPLAY HOME"
# User alias specification
User_Alias FULLTIMERS = millert, mikef, dowdy
User_Alias PARTTIMERS = bostley, jwfox, crawl
User_Alias WEBADMIN = will, wendy, wim
# Runas alias specification
Runas_Alias OP = root, operator
Runas_Alias DB = oracle, sybase
Runas_Alias ADMINGRP = adm, oper
# Host alias specification
Host_Alias SPARC = bigtime, eclipse, moet, anchor :\
SGI = grolsch, dandelion, black :\
ALPHA = widget, thalamus, foobar :\
HPPA = boa, nag, python
Host_Alias CUNETS = 128.138.0.0/255.255.0.0
Host_Alias CSNETS = 128.138.243.0, 128.138.204.0/24, 128.138.242.0
Host_Alias SERVERS = primary, mail, www, ns
Host_Alias CDROM = orion, perseus, hercules
...
문제
특수 속성
1) /var/log/messages 파일을 삭제는 불가하고 추가만 가능하도록 하는 명령어를 작성하세요.
2) /etc/services 파일이 삭제되거나 변경되지 않도록 설정하는 명령어를 작성하세요.
3) 해당 설정 내용을 확인하는 명령어를 작성하세요.
1) $ chattr +a /var/log/messages
2) $ chattr +i /etc/services
3) $ lsattr
커널 매개 변수 제어
1) ping 명령어에 서버가 응답하지 않도록 커널 매개 변수를 변경하는 명령어를 작성하세요.
2) 위 작업이 재부팅 시에도 자동 적용되도록 만드는 파일 전체경로를 작성하세요.
3) 위 파일에서 등록할 설정 값을 작성하세요.
1) $ systcl -w net.ipv4.icmp_echo_ignore_all=1
2) /etc/sysctl.conf
3) net.ipv4.icmp_echo_ignore_all=1
SELinux
1) 현재 SELinux 설정 상태를 확인하는 명령어를 입력하세요.
2) SELinux를 비활성 상태로 변경하는 명령어를 입력하세요.
1) $ getenforce
2) $ setenforce 0
SSH
키 생성 및 적용
1) SSH 공개 키를 생성하는 명령어를 입력하세요.
2) 원격 서버에 SSH 공개 키를 복사하는 명령어를 입력하세요.
1) ssh-keygen
2) ssh-copy-id
SSH 접근
reduser 계정으로 192.168.0.5의 2222포트로 SSH로 접근하여, 해당 서버 홈 디렉터리에 red-data 디렉터리를 생성하는 명령어를 작성하세요.
$ ssh -p 2222 reduser@192.168.0.5 mkdir ~/red-data
SSH 차단
1) ssh 서버의 환경 설정 파일의 전체 경로를 작성하세요.
2) root 계정으로 ssh 서버를 통해 로그인 하여 접근하는 행위를 차단하는 설정 값을 작성하세요.
1) /etc/ssh/sshd_config
2) PermitRootLogin no
번외
포트스캔
localhost의 Well Known Port를 스캔하여 열린 포트가 있는지 찾는 명령어를 작성하세요.
$ nmap -p 0-1023
GRUB 1
다음은 root의 비밀번호를 임의로 싱글 모드에 진입해 변경할 수 있는 문제점을 막기 위해 GRUB에 비밀번호를 설정하는 과정이다. 다음 절차에 대한 알맞은 값을 작성하세요. (단, GRUB 1 버전을 사용한다.)
1) 비밀번호를 설정하기 위한 파일을 전체 경로로 작성하세요.
2) 패스워드 관련 설정을 위한 하단 [관련 설정]에 해당되는 내용을 작성하세요.
default=0
...
hiddenmenu
[ 관련 설정 ] $1$24224X0LaL6XeQL3qGz4BCs75.X0LaL6XeQL3qGz4BCs75
...
1) /boot/grub/grub.conf 혹은 /etc/grub.conf
2) password --md5
'자격증' 카테고리의 다른 글
[리눅스마스터 1급] 10. 웹 서비스 (Apache) (0) | 2025.04.28 |
---|---|
[리눅스마스터 1급] 9. 시스템 백업 (0) | 2025.04.19 |
[리눅스마스터 1급] 7. 시스템 분석 (0) | 2025.04.19 |
[리눅스마스터 1급] 6. 주변장치 관리 (0) | 2025.04.19 |
[리눅스마스터 1급] 5. 장치의 설치 및 관리 (0) | 2025.04.19 |