6장. 로컬 인증서를 사용하여 스마트 카드 인증 구성
로컬 인증서를 사용하여 스마트 카드 인증을 구성하려면 다음을 수행합니다.
- 호스트가 도메인에 연결되어 있지 않습니다.
- 이 호스트의 스마트 카드로 인증하려고 합니다.
- 스마트 카드 인증을 사용하여 SSH 액세스를 구성하려고 합니다.
-
authselect
를 사용하여 스마트 카드를 구성하려고 합니다.
이 시나리오를 수행하려면 다음 구성을 사용합니다.
스마트 카드로 인증하려는 사용자의 사용자 인증서를 가져옵니다. 인증서는 도메인에 사용되는 신뢰할 수 있는 인증 기관에서 생성해야 합니다.
인증서를 가져올 수 없는 경우 테스트를 위해 로컬 인증 기관에서 서명한 사용자 인증서를 생성할 수 있습니다.
- 인증서와 개인 키를 스마트 카드에 저장합니다.
- SSH 액세스를 위해 스마트 카드 인증을 구성합니다.
호스트가 도메인에 포함될 수 있는 경우 호스트를 도메인에 추가하고 Active Directory 또는 Identity Management 인증 기관에서 생성한 인증서를 사용합니다.
스마트 카드에 대한 IdM 인증서를 생성하는 방법에 대한 자세한 내용은 스마트 카드 인증을 위한 ID 관리 구성을 참조하십시오.
사전 요구 사항
Authselect가 설치되어 있어야 합니다.
authselect 툴은 Linux 호스트에서 사용자 인증을 구성하고 이를 사용하여 스마트 카드 인증 매개 변수를 구성할 수 있습니다. authselect에 대한 자세한 내용은 authselect 설명을 참조하십시오.
지원되는 스마트 카드 또는 USB 장치.
자세한 내용은 RHEL의 스마트 카드 지원을 참조하십시오.
6.1. 로컬 인증서 생성
다음 작업을 수행하려면 다음 절차를 따르십시오.
- OpenSSL 인증 기관 생성
- 인증서 서명 요청 생성
다음 단계는 테스트 목적으로만 사용됩니다. 로컬 자체 서명된 인증 기관에서 생성한 인증서는 AD, IdM 또는 RHCS 인증 기관 사용만큼 안전하지 않습니다. 호스트가 도메인에 속하지 않은 경우에도 엔터프라이즈 인증 기관에서 생성한 인증서를 사용해야 합니다.
프로세스
인증서를 생성할 수 있는 디렉터리를 생성합니다. 예를 들면 다음과 같습니다.
mkdir /tmp/ca cd /tmp/ca
# mkdir /tmp/ca # cd /tmp/ca
Copy to Clipboard Copied! 인증서를 설정합니다(이 텍스트를
ca
디렉터리의 명령줄로 복사).cat > ca.cnf <<EOF [ ca ] default_ca = CA_default [ CA_default ] dir = . database = \$dir/index.txt new_certs_dir = \$dir/newcerts certificate = \$dir/rootCA.crt serial = \$dir/serial private_key = \$dir/rootCA.key RANDFILE = \$dir/rand default_days = 365 default_crl_days = 30 default_md = sha256 policy = policy_any email_in_dn = no name_opt = ca_default cert_opt = ca_default copy_extensions = copy [ usr_cert ] authorityKeyIdentifier = keyid, issuer [ v3_ca ] subjectKeyIdentifier = hash authorityKeyIdentifier = keyid:always,issuer:always basicConstraints = CA:true keyUsage = critical, digitalSignature, cRLSign, keyCertSign [ policy_any ] organizationName = supplied organizationalUnitName = supplied commonName = supplied emailAddress = optional [ req ] distinguished_name = req_distinguished_name prompt = no [ req_distinguished_name ] O = Example OU = Example Test CN = Example Test CA EOF
# cat > ca.cnf <<EOF [ ca ] default_ca = CA_default [ CA_default ] dir = . database = \$dir/index.txt new_certs_dir = \$dir/newcerts certificate = \$dir/rootCA.crt serial = \$dir/serial private_key = \$dir/rootCA.key RANDFILE = \$dir/rand default_days = 365 default_crl_days = 30 default_md = sha256 policy = policy_any email_in_dn = no name_opt = ca_default cert_opt = ca_default copy_extensions = copy [ usr_cert ] authorityKeyIdentifier = keyid, issuer [ v3_ca ] subjectKeyIdentifier = hash authorityKeyIdentifier = keyid:always,issuer:always basicConstraints = CA:true keyUsage = critical, digitalSignature, cRLSign, keyCertSign [ policy_any ] organizationName = supplied organizationalUnitName = supplied commonName = supplied emailAddress = optional [ req ] distinguished_name = req_distinguished_name prompt = no [ req_distinguished_name ] O = Example OU = Example Test CN = Example Test CA EOF
Copy to Clipboard Copied! 다음 디렉터리를 생성합니다.
mkdir certs crl newcerts
# mkdir certs crl newcerts
Copy to Clipboard Copied! 다음 파일을 생성합니다.
touch index.txt crlnumber index.txt.attr
# touch index.txt crlnumber index.txt.attr
Copy to Clipboard Copied! 일련 파일에 숫자 01을 작성합니다.
echo 01 > serial
# echo 01 > serial
Copy to Clipboard Copied! 이 명령은 직렬 파일에 숫자 01을 씁니다. 인증서의 일련 번호입니다. 이 CA에서 새 인증서를 릴리스할 때마다 수가 1씩 증가합니다.
OpenSSL 루트 CA 키를 생성합니다.
openssl genrsa -out rootCA.key 2048
# openssl genrsa -out rootCA.key 2048
Copy to Clipboard Copied! 자체 서명된 루트 인증 기관 인증서를 생성합니다.
openssl req -batch -config ca.cnf \ -x509 -new -nodes -key rootCA.key -sha256 -days 10000 \ -set_serial 0 -extensions v3_ca -out rootCA.crt
# openssl req -batch -config ca.cnf \ -x509 -new -nodes -key rootCA.key -sha256 -days 10000 \ -set_serial 0 -extensions v3_ca -out rootCA.crt
Copy to Clipboard Copied! 사용자 이름에 대한 키를 생성합니다.
openssl genrsa -out example.user.key 2048
# openssl genrsa -out example.user.key 2048
Copy to Clipboard Copied! 이 키는 안전하지 않은 로컬 시스템에 생성되므로 키가 카드에 저장될 때 시스템에서 키를 제거합니다.
스마트 카드에 직접 키를 만들 수도 있습니다. 이렇게 하려면 스마트 카드 제조업체에서 생성한 지침을 따르십시오.
인증서 서명 요청 구성 파일을 생성합니다(이 텍스트를 ca 디렉터리의 명령줄로 복사).
cat > req.cnf <<EOF [ req ] distinguished_name = req_distinguished_name prompt = no [ req_distinguished_name ] O = Example OU = Example Test CN = testuser [ req_exts ] basicConstraints = CA:FALSE nsCertType = client, email nsComment = "testuser" subjectKeyIdentifier = hash keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment extendedKeyUsage = clientAuth, emailProtection, msSmartcardLogin subjectAltName = otherName:msUPN;UTF8:testuser@EXAMPLE.COM, email:testuser@example.com EOF
# cat > req.cnf <<EOF [ req ] distinguished_name = req_distinguished_name prompt = no [ req_distinguished_name ] O = Example OU = Example Test CN = testuser [ req_exts ] basicConstraints = CA:FALSE nsCertType = client, email nsComment = "testuser" subjectKeyIdentifier = hash keyUsage = critical, nonRepudiation, digitalSignature, keyEncipherment extendedKeyUsage = clientAuth, emailProtection, msSmartcardLogin subjectAltName = otherName:msUPN;UTF8:testuser@EXAMPLE.COM, email:testuser@example.com EOF
Copy to Clipboard Copied! example.user 인증서에 대한 인증서 서명 요청을 생성합니다.
openssl req -new -nodes -key example.user.key \ -reqexts req_exts -config req.cnf -out example.user.csr
# openssl req -new -nodes -key example.user.key \ -reqexts req_exts -config req.cnf -out example.user.csr
Copy to Clipboard Copied! 새 인증서를 구성합니다. 만료 기간은 1 년으로 설정됩니다.
openssl ca -config ca.cnf -batch -notext \ -keyfile rootCA.key -in example.user.csr -days 365 \ -extensions usr_cert -out example.user.crt
# openssl ca -config ca.cnf -batch -notext \ -keyfile rootCA.key -in example.user.csr -days 365 \ -extensions usr_cert -out example.user.crt
Copy to Clipboard Copied!
이 시점에서 인증 기관과 인증서가 성공적으로 생성되고 스마트 카드로 가져올 준비가 되었습니다.