Cómo asignar un certificado SSL al sitio IIS7 desde el Símbolo del sistema


¿Puede aconsejarme si es posible o no asignar un certificado SSL a un sitio web en IIS7 utilizando la aplicación APPCMD?

Estoy familiarizado con el comando para establecer el enlace HTTPS

appcmd set site /site.name:"A Site" /+bindings.[protocol='https',bindingInformation='*:443:www.mysite.com']

Y cómo obtener asignaciones de corriente

%windir%\system32\inetsrv\Appcmd

Pero parece que no puede encontrar ninguna manera de asignar un sitio a un certificado (digamos el hash de certificados, por ejemplo)

Author: David Christiansen, 2009-02-26

5 answers

La respuesta es usar NETSH. Por ejemplo

netsh http add sslcert ipport=0.0.0.0:443 certhash='baf9926b466e8565217b5e6287c97973dcd54874' appid='{ab3c58f7-8316-42e3-bc6e-771d4ce4b201}'
 51
Author: David Christiansen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-04-12 21:14:17

Esto me ayudó mucho: una guía simple, de Sukesh Ashok Kumar, para configurar SSL para IIS desde la línea de comandos. Incluye importar / generar el certificado con certutil / makecert.

Http://www.awesomeideas.net/post/How-to-configure-SSL-on-IIS7-under-Windows-2008-Server-Core.aspx

EDITAR: si la URL original está desactivada, todavía está disponible a través de la Wayback Machine.

 17
Author: orip,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-02-11 15:31:48

Con PowerShell y el módulo WebAdministration, puede hacer lo siguiente para asignar un certificado SSL a un sitio de IIS:

# ensure you have the IIS module imported
Import-Module WebAdministration

cd IIS:\SslBindings
Get-Item cert:\LocalMachine\My\7ABF581E134280162AFFFC81E62011787B3B19B5 | New-Item 0.0.0.0!443

Cosas a tener en cuenta... el valor "7ABF581E134280162AFFFC81E62011787B3B19B5" es la huella digital del certificado que desea importar. Por lo tanto, primero debe importarse al almacén de certificados. El cmdlet New-Item toma la dirección IP (0.0.0.0 para todas las direcciones IP) y el puerto.

Véase http://learn.iis.net/page.aspx/491/powershell-snap-in-configuring-ssl-with-the-iis-powershell-snap-in/ para más detalles.

He probado esto en Windows Server 2008 R2, así como Windows Server 2012 pre-release.

 8
Author: David Mohundro,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-08-07 19:55:32

@David y @orip tienen razón.

Sin embargo, quería mencionar que el parámetro ipport especificado en el ejemplo (0.0.0.0:443) es lo que el MSDN llama la "dirección no especificada (IPv4: 0.0.0.0 o IPv6: [::])".

Fui a buscarlo, así que pensé en documentar aquí para ahorrarle el tiempo a alguien más. Este artículo se centra en SQL Server, pero la información sigue siendo relevante:

Http://msdn.microsoft.com/en-us/library/ms186362.aspx

 4
Author: fordareh,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-12-01 00:29:52

Usando las respuestas de este post, creé un solo script que hizo el truco para mí. Comienza desde el archivo pfx, pero podría omitir ese paso.

Aquí está:

cd C:\Windows\System32\inetsrv

certutil -f -p "pa$$word" -importpfx "C:\temp\mycert.pfx"

REM The thumbprint is gained by installing the certificate, going to cert manager > personal, clicking on it, then getting the Thumbprint.
REM Be careful copying the thumbprint. It can add hidden characters, esp at the front.
REM appid can be any valid guid
netsh http add sslcert ipport=0.0.0.0:443 certhash=5de934dc39cme0234098234098dd111111111115 appid={75B2A5EC-5FD8-4B89-A29F-E5D038D5E289}

REM bind to all ip's with no domain. There are plenty of examples with domain binding on the web
appcmd set site "Default Web Site" /+bindings.[protocol='https',bindingInformation='*:443:']
 0
Author: HockeyJ,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-01-12 09:33:05