Hello, Windows Admin Center!
目前版本为Windows Admin Center (version 1904)
由于Windows Admin Center在安装时需要绑定443端口,所以有两种安装方式
要么使用安装工具生成一个自签名证书(60天过期)
要么使用现有的证书绑定指纹
由于Admin Center多用于企业内部,外网肯定是不需要用到的,但是这里生成的自签名证书有效期又太短
所以我们可以用Powershell自己生成一个有效期长的自签名证书
New-SelfSignedCertificate使用规范:
New-SelfSignedCertificate
[-SecurityDescriptor <FileSecurity>]
[-TextExtension <String[]>]
[-Extension <X509Extension[]>]
[-HardwareKeyUsage <HardwareKeyUsage[]>]
[-KeyUsageProperty <KeyUsageProperty[]>]
[-KeyUsage <KeyUsage[]>]
[-KeyProtection <KeyProtection[]>]
[-KeyExportPolicy <KeyExportPolicy[]>]
[-KeyLength <Int32>]
[-KeyAlgorithm <String>]
[-SmimeCapabilities]
[-ExistingKey]
[-KeyLocation <String>]
[-SignerReader <String>]
[-Reader <String>]
[-SignerPin <SecureString>]
[-Pin <SecureString>]
[-KeyDescription <String>]
[-KeyFriendlyName <String>]
[-Container <String>]
[-Provider <String>]
[-CurveExport <CurveParametersExportType>]
[-KeySpec <KeySpec>]
[-Type <CertificateType>]
[-FriendlyName <String>]
[-NotAfter <DateTime>]
[-NotBefore <DateTime>]
[-SerialNumber <String>]
[-Subject <String>]
[-DnsName <String[]>]
[-SuppressOid <String[]>]
[-HashAlgorithm <String>]
[-AlternateSignatureAlgorithm]
[-TestRoot]
[-Signer <Certificate>]
[-CloneCert <Certificate>]
[-CertStoreLocation <String>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
打开powershell,这里以生成有效期5年为例,输入:
New-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\My\ -DnsName 'yoursite' -NotAfter (Get-Date).AddMonths(60)
打开certlm.msc
可以看到,我们的自签名证书已经生成好了
以导出pfx格式为例
PS C:\> $certPwd = ConvertTo-SecureString -String ‘yourcert_pwd’ -Force -AsPlainText
PS C:\> $thumbprint = 'yourcert_thumbprint'
PS C:\> $cerPath = Get-Item Cert:\LocalMachine\My\$thumbprint
PS C:\> Export-PfxCertificate -Cert $cerPath -Force d:\yoursite.pfx -Password $certPwd
⚠️注意指定具体的值
导出成功如图
直接双击安装包,在指定证书这里,填上端口443和证书的指纹
完成剩下安装即可
打开给出的访问地址https://infra-srv发现还不能访问
因为我们的dns配置没有把域名指向正确的ip地址
使用管理员权限打开notepad
选择打开,定位到C:\Windows\System32\drivers\etc
修改hosts文件,末尾加上对应的ip和域名
打开cmd,ipconfig /flushdns
刷新一下dns,这时候再ping infra-srv就有解析结果了
浏览器打开https://infra-srv
只要是在内网环境的电脑,都可以访问Admin Center了!