[英]Get SSL certificates expiration date using powershell on ubuntu machine
I'm trying to execute the following script on ubuntu machine using PS mode but it shows me nothing, I want to know how can I do have this date. 我正在尝试使用PS模式在ubuntu机器上执行以下脚本,但它什么也没有显示,我想知道该如何约会。 Below is the script that I have wrote: 以下是我编写的脚本:
$var = (Get-ChildItem /etc/ssl/certs)[0].NotAfter
Write-Host $var
PowerShell doesn't magically parse certificate files for you. PowerShell不会为您神奇地解析证书文件。 Use the openssl
command. 使用openssl
命令。
$cert = (Get-ChildItem /etc/ssl/certs)[0].FullName
$var = ((& openssl x509 -in $cert -dates -noout) -match 'notAfter').Split('=')[1]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.