Certbot installation procedure for Windows
Tags: webdev, tutorial, ssl, certificate
Published: 2021-11-10 16:32:16

###_Note::_
   Certbot is now officially available for Windows. If you find that Certbot is not the most suitable Let's Encrypt client application for your use case, there are many other clients written by other organizations and developers that you may be able to use to obtain a certificate from Let's Encrypt.

##1.Important notes

This procedure follows the current Certbot implementation for Windows, in particular the fact that it installs as a system component, and requires administrative privileges. These instructions will be updated when a future version of Certbot switches to a different installation method. No installers for HTTP servers are supported for now (Certbot for Windows can currently obtain your certificate from Let's Encrypt, but not install it into your web server application).

##2.Specific Windows system requirements and user knowledge requirements

1.The user needs to be familiar with the command-line interface 
   (CLI), because Certbot is a pure CLI program.
2.The user must use an account with administrative privileges to 
   install and run Certbot.
3.PowerShell and CMD.EXE are supported; both need to be started 
   with elevated privileges before invoking Certbot.
4.Path C:\Certbot must be writable by the current user.

##3.Specific Windows limitations and configuration

1.All usual operations to create and manage an account, manage 
   existing certificates, or select the ACME server, are 
   supported.
2.Only standalone, manual and webroot authenticator plugins are 
   supported. DNS plugins will be available soon. This means that 
   Certbot for Windows is currently unable to automatically renew 
   wildcard certificates, since these require a DNS plugin in 
   order to be renewed without user intervention.
3.No installer plugins are supported. The Apache and Nginx plugins 
   will be available soon, and a plugin to install certificates 
   into IIS is under development.
4.Automated certificate renewals (using standalone and webroot 
   plugins) are supported.

##4.Installation instructions (default)

1.Connect to the server.
2.Connect locally or remotely (using Remote Desktop) to the 
  server using an account that has administrative privileges for 
 thismachine.
3.Install Certbot.
4.Download the latest version of the Certbot installer for Windows 
  at https://dl.eff.org/certbot-beta-installer-win32.exe.
5.Run the installer and follow the wizard. The installer will 
  propose a default installation directory, C:\Program Files(x86), 
  that can be customized.)
6.To start a shell for Certbot, select the Start menu, enter cmd 
  (to run CMD.EXE) or powershell (to run PowerShell), and click on 
  “Run as administrator” in the contextual menu that shows up
above.
7.Run Certbot as a shell command.

 To run a command on Certbot, enter the name certbot in the shell, 
 followed by the command and its parameters. For instance, to 
 display the inline help, run:

     ::C:\WINDOWS\system32> certbot --help.

##5.Choose how you’d like to run Certbot
      ::Are you ok with temporarily stopping your website?
###Yes, my web server is not currently running on this machine.
Stop your webserver, then run this command to get a certificate. Certbot will temporarily spin up a webserver on your machine.

    ::C:\WINDOWS\system32> certbot certonly --standalone.
###Important Note:
    ::To use the webroot plugin, your server must be configured to serve files from hidden directories. If /.well-known is treated specially by your webserver configuration, you might need to modify the configuration to ensure that files inside /.well-known/acme-challenge are served by the webserver.::
##6.Install your certificate

You'll need to install your new certificate in the configuration file or interface for your webserver. Certificates are located in
 
        ::C:\Certbot\live\[certificate_name].

where [certificate_name] is the name of your certificate (usually the first domain if the --cert-name flag has not been used on the certonly command). Currently, Certbot for Windows cannot automate the installation step; future versions will be able to automate it for specific webserver applications.

##7.Test automatic renewal

The Certbot installation on your system comes with a pre-installed Scheduled Task that will renew your certificates automatically before they expire. You will not need to run Certbot again, unless you change your configuration. You can test automatic renewal for your certificates by running the command

      ::C:\WINDOWS\system32> certbot renew --dry-run

If you needed to stop your webserver to run Certbot (for example, if you used the standalone authenticator on a machine where port 80 is normally in use), you'll want to edit the built-in command to add the --pre-hook and --post-hook flags to stop and start your webserver automatically. For example, if your webserver is Apache 2.4, add the following to the certbot renew command.

      ::--pre-hook "net.exe stop Apache2.4" --post-hook "net.exe start Apache2.4"
##8.Confirm that Certbot worked
To confirm that your site is set up properly.

##9.Note for Windows Apache or Nginx users

As described in section 5 above, Certbot for Windows currently cannot install the certificate in Apache or Nginx for you. As of the most recent release, you will have to edit your web server application’s configuration to install the certificate yourself after Certbot has obtained it. If this limitation is acceptable to you, please start from the beginning of this document to learn more about installing and using Certbot on Windows.