태그 보관물: apache-2.2

apache-2.2

SSL 인증서 요청의 비 대화식 작성 be incorporated into your

초기 명령에 필요한 모든 매개 변수를 지정하여 SSL 인증서 요청을 작성하는 방법이 있습니까? CLI 기반 웹 서버 제어판을 작성 중이며 가능한 경우 실행할 때 expect 사용을 피하고 싶습니다 openssl.

인증 요청을 작성하는 일반적인 방법입니다.

$ openssl req -new -newkey rsa:2048 -nodes -sha256 -keyout foobar.com.key -out foobar.com.csr
Generating a 2048 bit RSA private key
.................................................+++
........................................+++
writing new private key to 'foobar.com.key'
-----
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
-----
Country Name (2 letter code) [AU]:US
State or Province Name (full name) [Some-State]:New Sweden
Locality Name (eg, city) []:Stockholm
Organization Name (eg, company) [Internet Widgits Pty Ltd]:Scandanavian Ventures, Inc.
Organizational Unit Name (eg, section) []:
Common Name (e.g. server FQDN or YOUR name) []:foobar.com
Email Address []:gustav@foobar.com

Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:FooBar

다음과 같은 것을보고 싶습니다. (작동하지 않는 예)

$ openssl req -new -newkey rsa:2048 -nodes -sha256 -keyout foobar.com.key -out foobar.com.csr \
-Country US \
-State "New Sweden" \
-Locality Stockholm \
-Organization "Scandanavian Ventures, Inc." \
-CommonName  foobar.com \
-EmailAddress gustav@foobar.com \
-Company FooBar

훌륭한 맨 페이지는 그 문제에 대해 아무 말도하지 않았으며 Google을 통해 아무것도 찾을 수 없었습니다. SSL 인증서 요청 생성은 대화식 프로세스 여야합니까, 아니면 단일 명령으로 모든 매개 변수를 지정할 수있는 방법이 있습니까?

이것은 데비안에서 파생 된 Linux 배포판에서 실행 openssl 1.0.1됩니다.



답변

두 부분이 누락되었습니다.

제목 줄은

-subj "/C=US/ST=New Sweden/L=Stockholm /O=.../OU=.../CN=.../emailAddress=..."
  • X=X509 코드 인 …을 값으로 대체 ( O rganisation / O rganisation U nit / etc …

암호 값으로,

-passout pass:client11
-passin  pass:client11
  • 출력 / 입력 암호를 ​​제공

새 키를 요구하는 모습

openssl genrsa -aes256 -out lib/client1.key -passout pass:client11 1024
openssl rsa -in lib/client1.key -passin pass:client11 -out lib/client1-nokey.key

openssl req -new -key lib/client1.key -subj req -new \
    -passin pass:client11 -out lib/client1.csr \
    -subj "/C=US/ST=New Sweden/L=Stockholm/O=.../OU=.../CN=.../emailAddress=..."

(지금은 두 가지가 있습니다 -new…)


답변

공식 문서에-batch 설명 된대로 옵션을 확인하십시오 .


답변

일반 openssl 명령에 추가합니다.

openssl req -x509 -nodes -days 7300 -newkey rsa : 2048 -keyout /etc/ssl/private/key.pem -out /etc/ssl/private/cert.pem

이 줄 :

-subj "/C=PE/ST=Lima/L=Lima/O=Acme Inc. /OU=IT Department/CN=acme.com"

기술:

  • 국가 이름 (2 자 코드) [AU] : PE
  • 시 /도 이름 (이름) [일부 상태] : 리마
  • 지역 이름 (예 : 도시) [] : 리마
  • 조직 이름 (예 : 회사) [Internet Widgits Pty Ltd] : Acme Inc.
  • 조직 구성 단위 이름 (예 : 섹션) [] : IT 부서
  • 일반 이름 (예 : 서버 FQDN 또는 사용자 이름) [] : acme.com

구분 기호처럼 “/”를 사용하십시오.


답변