6.2. 로컬 인증서 생성


스마트 카드 인증을 테스트하려면 유효한 인증서 체인이 필요합니다. 관리자는 로컬 자체 서명된 CA(인증 기관)를 생성하고 이를 사용하여 사용자 인증서 요청에 서명하고 개발 환경을 위한 기능적인 인증 정보를 생성할 수 있습니다.

다음 작업을 수행하려면 다음 절차를 따르십시오.

  • OpenSSL 인증 기관 생성
  • 인증서 서명 요청 생성
주의

다음 단계는 테스트 목적으로만 사용됩니다. 로컬 자체 서명된 인증 기관에서 생성한 인증서는 AD, IdM 또는 RHCS 인증 기관 사용만큼 안전하지 않습니다. 호스트가 도메인에 속하지 않은 경우에도 엔터프라이즈 인증 기관에서 생성한 인증서를 사용해야 합니다.

프로세스

  1. 인증서를 생성할 수 있는 디렉터리를 생성합니다. 예를 들면 다음과 같습니다.

    # mkdir /tmp/ca
    # cd /tmp/ca
  2. 인증서를 설정합니다(이 텍스트를 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
  3. 다음 디렉터리를 생성합니다.

    # mkdir certs crl newcerts
  4. 다음 파일을 생성합니다.

    # touch index.txt crlnumber index.txt.attr
  5. 일련 파일에 숫자 01을 작성합니다.

    # echo 01 > serial

    이 명령은 직렬 파일에 숫자 01을 씁니다. 인증서의 일련 번호입니다. 이 CA에서 새 인증서를 릴리스할 때마다 수가 1씩 증가합니다.

  6. OpenSSL 루트 CA 키를 생성합니다.

    # openssl genrsa -out rootCA.key 2048
  7. 자체 서명된 루트 인증 기관 인증서를 생성합니다.

    # openssl req -batch -config ca.cnf \ -x509 -new -nodes -key rootCA.key -sha256 -days 10000 \ -set_serial 0 -extensions v3_ca -out rootCA.crt
  8. 사용자 이름에 대한 키를 생성합니다.

    # openssl genrsa -out example.user.key 2048

    이 키는 안전하지 않은 로컬 시스템에 생성되므로 키가 카드에 저장될 때 시스템에서 키를 제거합니다.

    스마트 카드에 직접 키를 만들 수도 있습니다. 이렇게 하려면 스마트 카드 제조업체에서 생성한 지침을 따르십시오.

  9. 인증서 서명 요청 구성 파일을 생성합니다(이 텍스트를 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
  10. example.user 인증서에 대한 인증서 서명 요청을 생성합니다.

    # openssl req -new -nodes -key example.user.key \ -reqexts req_exts -config req.cnf -out example.user.csr
  11. 새 인증서를 구성합니다. 만료 기간은 1 년으로 설정됩니다.

    # openssl ca -config ca.cnf -batch -notext \ -keyfile rootCA.key -in example.user.csr -days 365 \ -extensions usr_cert -out example.user.crt

    이 시점에서 인증 기관과 인증서가 성공적으로 생성되고 스마트 카드로 가져올 준비가 되었습니다.

Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 문서 정보

Legal Notice

Theme

© 2026 Red Hat
맨 위로 이동