chsec 명령어 (AIX 5.3·6.1)

핵심 정리

  • /etc/security 아래 스탠자 형식 보안 파일의 속성을 바꿉니다. 형식: chsec -f 파일 -s 스탠자 -a 속성=값 .... 값을 비우면(-a 속성=) 그 속성을 스탠자에서 지웁니다.
  • 가장 많이 쓰는 형태는 잠긴 계정의 실패 횟수 되돌리기 chsec -f /etc/security/lastlog -s 사용자 -a unsuccessful_login_count=0입니다.
  • 모든 사용자의 기본값은 -s default로 바꿉니다. 예: chsec -f /etc/security/user -s default -a maxage=13 -a minlen=8.
  • 시스템 전체 설정은 /etc/security/login.cfg의 usw 스탠자입니다. 예: pwd_algorithm=ssha256, maxlogins, dist_uniqid.
  • login.cfg나 portlog에 없는 스탠자를 주면 새로 만듭니다. 비밀번호(password 속성)는 바꿀 수 없으니 passwd를 씁니다.
항목 내용
버전 AIX 5.3, AIX 6.1 (6.1에서 다룰 수 있는 파일에 /etc/nscontrol.conf, pwdalg.cfg, rtcd_policy.conf, /etc/secvars.cfg 등이 더해짐)
원문 IBM Commands Reference — 5.3 Volume 1, 6.1 Volume 1
파일 /usr/bin/chsec, /etc/security/user, /etc/security/login.cfg, /etc/security/lastlog, /etc/security/portlog
관련 명령어 lssec, chuser, chgroup, passwd, pwdck, usrck

목적

보안 스탠자 파일의 속성을 바꿉니다.

영어 원문

Changes the attributes in the security stanza files.

구문

text
chsec [ -f File ] [ -s Stanza ] [ -a Attribute = Value ... ]

설명

chsec 명령은 보안 구성 스탠자 파일에 저장된 속성을 바꿉니다. Attribute = Value로 지정할 수 있는 속성은 다음 파일에 있으며, 파일마다 Stanza 매개변수에 줄 수 있는 스탠자 이름이 정해져 있습니다. 6.1 문서는 /etc/secvars.cfg도 다룰 수 있다고 적습니다.

파일 내용 스탠자 이름
/etc/security/user 사용자의 확장 속성 사용자 이름 또는 default
/etc/security/limits 사용자별 자원 한도 사용자 이름 또는 default
/etc/security/environ 사용자의 환경 속성 사용자 이름 또는 default
/etc/security/lastlog 사용자의 마지막 로그인 속성 사용자 이름 또는 default
/etc/security/passwd 비밀번호 정보(password 속성은 다룰 수 없음) 사용자 이름 또는 default
/etc/security/group 그룹의 확장 속성 그룹 이름 또는 default
/usr/lib/security/mkuser.default 새 사용자의 기본값 admin 또는 user
/etc/security/login.cfg 포트 구성, 인증 메서드, 시스템 전체 설정 포트 이름, 메서드 이름, usw
/etc/security/portlog 포트별 로그인 실패 정보 포트 이름
/etc/security/audit/hosts 호스트와 프로세서 ID
/etc/security/roles 역할 목록
/etc/security/user.roles 사용자별 역할
/etc/security/smitacl.user, smitacl.group 사용자·그룹 SMIT ACL
/etc/nscontrol.conf 일부 이름 서비스 구성(6.1)
/etc/security/pwdalg.cfg 로드 가능 비밀번호 알고리즘(LPA) 구성(6.1)
/etc/security/rtc/rtcd_policy.conf rtcd 데몬 구성(6.1)

/etc/security/login.cfg나 /etc/security/portlog에서 아직 없는 스탠자의 속성을 바꾸면 그 스탠자를 자동으로 만듭니다.

/etc/security/passwd의 password 속성은 chsec으로 바꿀 수 없으니 passwd 명령을 씁니다.

관리 속성은 root나 해당 권한이 있는 사용자만 바꿀 수 있습니다. 예를 들어 관리 그룹 데이터를 바꾸려면 root이거나 GroupAdmin 권한이 있어야 합니다.

참고: chsec은 로컬 사용자 속성을 바꿉니다. 원격 사용자 속성을 로컬 보안 스탠자 파일에 반영하지는 않습니다.

영어 원문

The chsec command changes the attributes stored in the security configuration stanza files. These security configuration stanza files have attributes that you can specify with the Attribute = Value parameter:

  • /etc/security/environ

  • /etc/security/group

  • /etc/security/audit/hosts

  • /etc/security/lastlog

  • /etc/security/limits

  • /etc/security/login.cfg

  • /usr/lib/security/mkuser.default

  • /etc/nscontrol.conf

  • /etc/security/passwd

  • /etc/security/portlog

  • /etc/security/pwdalg.cfg

  • /etc/security/roles

  • /etc/security/rtc/rtcd_policy.conf

  • /etc/security/smitacl.user

  • /etc/security/smitacl.group

  • /etc/security/user

  • /etc/security/user.roles

  • /etc/secvars.cfg

When modifying attributes in the /etc/security/environ, /etc/security/lastlog, /etc/security/limits, /etc/security/passwd, and /etc/security/user files, the stanza name specified by the Stanza parameter must either be a valid user name or default. When modifying attributes in the /etc/security/group file, the stanza name specified by the Stanza parameter must either be a valid group name or default. When modifying attributes in the /usr/lib/security/mkuser.default file, the Stanza parameter must be either admin or user. When modifying attributes in the /etc/security/portlog file, the Stanza parameter must be a valid port name. When modifying attributes in the /etc/security/login.cfg file, the Stanza parameter must either be a valid port name, a method name, or the usw attribute.

When modifying attributes in the /etc/security/login.cfg or /etc/security/portlog file in a stanza that does not already exist, the stanza is automatically created by the chsec command.

You cannot modify the password attribute of the /etc/security/passwd file using the chsec command. Instead, use the passwd command.

Only the root user or a user with an appropriate authorization can change administrative attributes. For example, to modify administrative group data, the user must be root or have GroupAdmin authorization.

Note: The chsec command changes local user attributes. It does not change non-local user attributes. You can use the chsec command to change remote user attributes. The chsec command does not update remote user attributes in local security stanza files.

플래그

플래그 설명
-a Attribute = Value 바꿀 속성과 새 값. 값을 주지 않으면 그 스탠자에서 속성을 지웁니다. 여러 번 줄 수 있습니다.
-f File 바꿀 스탠자 파일 이름.
-s Stanza 바꿀 스탠자 이름.
영어 원문
  • -a Attribute = Value — Specifies the attribute to modify and the new value for that attribute. If you do not specify the value, the attribute is removed from the given stanza.
  • -f File — Specifies the name of the stanza file to modify.
  • -s Stanza — Specifies the name of the stanza to modify.

보안

접근 제어: 실행 권한은 root와 security 그룹에만 있습니다. 신뢰 컴퓨팅 기반 속성이 있고, 보안 데이터베이스에 접근하려고 root로 setuid해 실행합니다.

Trusted AIX 시스템에서는 aix.mls.clear.write 권한이 있는 사용자만 허가 등급 속성을, aix.mls.tty.write 권한이 있는 사용자만 포트 속성을 바꿀 수 있습니다.

감사 이벤트: USER_Change(사용자 이름, 속성), GROUP_Change(그룹 이름, 속성), PORT_Change(포트, 속성).

읽고 쓰는 파일: 설명 절 표의 파일(모두 읽기·쓰기).

RBAC 사용자와 Trusted AIX 사용자는 주의하세요. 이 명령은 특권 작업을 할 수 있으며, 특권 작업은 특권 사용자만 할 수 있습니다. 특권과 권한 목록은 lssecattr 명령이나 getcmdattr 하위 명령으로 봅니다(6.1 문서에만 있음). 명령의 기능을 모두 쓰려면 역할에 accessauths 말고도 aix.security.user.audit, aix.security.role.assign, aix.security 권한이, rtcd_policy.conf를 바꾸려면 aix.security.config 권한도 있어야 합니다.

영어 원문

Access Control

This command grants execute access only to the root user and the security group. The command has the trusted computing base attribute and runs the setuid command to allow the root user to access the security databases.

On a Trusted AIX system, only users with the aix.mls.clear.write authorization can modify clearance attributes. Only users with the aix.mls.tty.write authorization can modify the port attributes.

Auditing Events

Event Information USER_Change user name, attribute GROUP_Change group name, attribute PORT_Change port, attribute

Files Accessed

Mode File rw /etc/security/environ rw /etc/security/group rw /etc/security/audit/hosts rw /etc/security/lastlog rw /etc/security/limits rw /etc/security/login.cfg rw /usr/lib/security/mkuser.default rw /etc/nscontrol.conf rw /etc/security/passwd rw /etc/security/portlog rw /etc/security/pwdalg.cfg rw /etc/security/roles rw /etc/security/rtc/rtcd_policy.conf rw /etc/security/smitacl.user rw /etc/security/smitacl.group rw /etc/security/user rw /etc/security/user.roles

Attention RBAC users and Trusted AIX users: This command can perform privileged operations. Only privileged users can run privileged operations. For more information about authorizations and privileges, see Privileged Command Database in Security. For a list of privileges and the authorizations associated with this command, see the lssecattr command or the getcmdattr subcommand. To get the full functionality of the command, besides the accessauths, the role should also have the following authorizations:

  • aix.security.user.audit

  • aix.security.role.assign

  • aix.security

To perform the chsec command on the /etc/security/rtc/rtcd_policy.conf file, the role should also have the following authorization:

  • aix.security.config

예제

명령 하는 일
chsec -f /etc/security/login.cfg -s /dev/tty0 -a logindisable=5 -a logininterval=60 60초 안에 로그인이 5번 실패하면 포트 /dev/tty0을 자동으로 잠그게 함
chsec -f /etc/security/portlog -s /dev/tty0 -a locktime=0 시스템이 잠근 /dev/tty0 포트를 풂
chsec -f /etc/security/user -s default -a logintimes=:0800-1700 모든 사용자의 로그인을 오전 8시부터 오후 5시까지만 허락
chsec -f /etc/security/limits -s joe -a cpu=3600 사용자 joe의 CPU 시간 한도를 1시간(3600초)으로

자주 쓰는 형태:

bash
chsec -f /etc/security/lastlog -s app1 -a unsuccessful_login_count=0   # 실패 횟수 되돌리기
chsec -f /etc/security/user -s app1 -a account_locked=false
chsec -f /etc/security/user -s default -a maxage=13 -a minlen=8 -a histsize=5 -a loginretries=5
chsec -f /etc/security/login.cfg -s usw -a pwd_algorithm=ssha256       # 비밀번호 해시 알고리즘
chsec -f /etc/security/limits -s default -a nofiles=8192
lssec -f /etc/security/user -s default -a maxage -a minlen             # 바뀌었는지 확인
영어 원문
  1. To change the /dev/tty0 port to automatically lock if 5 unsuccessful login attempts occur within 60 seconds, enter:
chsec -f /etc/security/login.cfg -s /dev/tty0 -a logindisable=5 -a logininterval=60
  1. To unlock the /dev/tty0 port after it has been locked by the system, enter:
chsec -f /etc/security/portlog -s /dev/tty0 -a locktime=0
  1. To allow logins from 8:00 a.m. until 5:00 p.m. for all users, enter:
chsec -f /etc/security/user -s default -a logintimes=:0800-1700
  1. To change the CPU time limit of user joe to 1 hour (3600 seconds), enter:
chsec -f /etc/security/limits -s joe -a cpu=3600

파일

파일 설명
/usr/bin/chsec chsec 명령
/etc/security/enc/LabelEncodings Trusted AIX의 레이블 정의
/etc/security/domains 시스템의 올바른 도메인 정의
/etc/secvars.cfg 스탠자 파일(6.1)

그 밖의 파일은 설명 절의 표를 봅니다.

영어 원문
  • /usr/bin/chsec — Specifies the path to the chsec command.
  • /etc/security/environ — Contains the environment attributes of users.
  • /etc/security/group — Contains extended attributes of groups.
  • /etc/security/audit/hosts — Contains host and processor IDs.
  • /etc/security/group — Defines the last login attributes for users.
  • /etc/security/limits — Defines resource quotas and limits for each user.
  • /etc/security/login.cfg — Contains port configuration information.
  • /usr/lib/security/mkuser.default — Contains the default values for new users.
  • /etc/nscontrol.conf — Contains the configuration information of some name services.
  • /etc/security/passwd — Contains password information.
  • /etc/security/portlog — Contains unsuccessful login attempt information for each port.
  • /etc/security/pwdalg.cfg — Contains the configuration information for loadable password algorithms (LPA).
  • /etc/security/roles — Contains a list of valid roles.
  • /etc/security/rtc/rtcd_policy.conf — Contains the configuration information for the rtcd daemon.
  • /etc/security/smitacl.user — Contains user ACL definitions.
  • /etc/security/smitacl.group — Contains group ACL definitions.
  • /etc/security/user — Contains the extended attributes of users.
  • /etc/security/user.roles — Contains a list of roles for each user.
  • /etc/security/enc/LabelEncodings — Contains label definitions for the Trusted AIX system.
  • /etc/security/domains — Contains the valid domain definitions for the system.
  • /etc/secvars.cfg — Contains a stanza file.

Related information:

  • lsuser command
  • pwdck command
  • rmgroup command
  • getuserattr command
  • getuserpw command

리눅스(GNU)와 다른 점

리눅스에는 같은 명령이 없고 파일마다 다른 도구를 씁니다. 로그인 실패 되돌리기는 faillock --user 사용자 --reset(또는 예전 pam_tally2 -r), 비밀번호 기간은 chage, 기본 규칙은 /etc/login.defs·/etc/security/pwquality.conf, 자원 한도는 /etc/security/limits.conf를 고칩니다. 로그인 시간 제한은 pam_time(/etc/security/time.conf)으로 합니다.