Centos7 minimal 설치 후 셋팅

곽동규·2024년 4월 7일

1. Network 설정 (고정 IP 셋팅)

# vi /etc/sysconfig/network-scripts/ifcfg-ens3

TYPE=Ethernet
BOOTPROTO=none (none or static)
NAME=ens3
DEVICE=ens3
ONBOOT=yes (부팅시 net on)
IPADDR=172.16.x.x
GATEWAY=172.16.x.x
NETMASK=255.255.252.0
DNS1=8.8.4.4

# systemctl restart network

network 재시작 후 ip a / ifconfig로 확인 (net-tools 설치 후 확인 가능)

2. SElinux, 방화벽 해제

방화벽해제

# systemctl stop firewalld

# systemctl disable firewalld (시스템 재부팅 시에도 올라오지 않음)

# systemctl status firwalld (확인)

SElinux 해제

# setenforce 0

# vi /etc/selinux/config (수정)

SELINUX=disabled    

3. Hostname 변경

# hostnamectl set-hostname --static {hostname}

4. IP 접근제어

# vi /etc/hosts.allow (접근허용 IP 추가)

# vi /etc/hosts.deny (sshd : all)

5. 필요 tool install

# yum install wget lsof bind-utils net-tools vim net-tools telnet lrzsz -y

# yum group install "development tools" "Compatibility Libraries" "Performance Tools" -y

# yum update -y (update 시 minor 버전은 업그레이드 됨)

6. 기초 보안 설정

패스워드 사용 주기 설정

#vi /etc/login.defs

PASS_MAX_DAYS 90
PASS_MIN_DAYS 1
PASS_MIN_LEN 8
PASS_WARN_AGE 7

패스워드 복잡성 설정

#vi /etc/security/pwquality.conf

minlen = 8
minclass = 1
maxrepeat = 0
maxclassrepeat = 0
lcredit = -1
ucredit = -1
dcredit = -1
ocredit = -1

자동 로그아웃 설정

# vi /etc/profile

TMOUT = 300 추가

계정잠금 임계값 설정

# vi /etc/pam.d/system-auth

account required pam_tally2.so
auth required pam_tally2.so deny=5 unlock_time=3600

불필요 계정 삭제

# userdel -r lp, uucp, nuucp, games 필수 삭제

시스템 배너 설정

# crontab -e

*/1 * * * /bin/bash /root/system_stat.sh

  1. 계정 추가

    # useradd -d /home/ibroot -m -s /bin/bash ibroot (home dir 생성 bash shell 사용 계정 생성)

    # echo "Password" | passwd --stdin ibroot (커맨드로 패스워드 변경 방법)

# useradd -m -s /bin/bash -p $(openssl passwd -1 Password) airduck! (한줄로 합친거)

0개의 댓글