ywdblog/httpsbook

6.7.3 获取线上证书语法错误

Opened this issue · 0 comments

  1. 下载 GitHub 站点的服务器证书链:
$ openssl s_client -connect www.github.com:443 -shwocerts 2>&1 </dev/null \
  | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' \
  > www_fullchain.pem
  1. 执行拆分操作存在错误输出:
# 将证书链文件拆分成各个文件
$ cat www_fullchain.pem | awk 'split_after==1{n++;split_after=0} \
  /-----END CERTIFICATE-----/ {split_after=1} \
  {print > "www_cert" n ".pem"}'
awk: syntax error at source line 3
 context is
	  {print > "www_cert" >>>  n <<<  ".pem"}
awk: illegal statement at source line 3

命名行提示输出步骤存在语法错误,请问如何解决?