mirror of
				https://git.coolaj86.com/coolaj86/greenlock-cli.js
				synced 2025-11-04 11:02:47 +00:00 
			
		
		
		
	add installer and features
This commit is contained in:
		
							parent
							
								
									5e832fa3d6
								
							
						
					
					
						commit
						6a0f25c685
					
				
							
								
								
									
										94
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										94
									
								
								README.md
									
									
									
									
									
								
							@ -1,38 +1,84 @@
 | 
			
		||||
# greenlock-cli (letsencrypt-cli for node.js)
 | 
			
		||||

 | 
			
		||||
 | 
			
		||||
| [greenlock (library)](https://git.coolaj86.com/coolaj86/greenlock.js)
 | 
			
		||||
| **greenlock-cli**
 | 
			
		||||
| [greenlock-express](https://git.coolaj86.com/coolaj86/greenlock-express.js)
 | 
			
		||||
| [greenlock-koa](https://git.coolaj86.com/coolaj86/greenlock-koa.js)
 | 
			
		||||
| [greenlock-hapi](https://git.coolaj86.com/coolaj86/greenlock-hapi.js)
 | 
			
		||||
|
 | 
			
		||||
# Greenlock™ for Web Servers
 | 
			
		||||
 | 
			
		||||
CLI for node-greenlock modeled after the official client.
 | 
			
		||||
A server-friendly commandline tool for Free SSL, Free Wildcard SSL, and Fully Automated HTTPS
 | 
			
		||||
<small>certificates issued by Let's Encrypt v2 via ACME</small>
 | 
			
		||||
 | 
			
		||||
* Free SSL Certificates
 | 
			
		||||
* 90-day certificate lifetime
 | 
			
		||||
* One-off standalone registration / renewal
 | 
			
		||||
* On-the-fly registration / renewal via webroot
 | 
			
		||||
Greenlock is also available
 | 
			
		||||
[for Browsers](https://git.coolaj86.com/coolaj86/greenlock.html),
 | 
			
		||||
[for node.js](https://git.coolaj86.com/coolaj86/greenlock-express.js),
 | 
			
		||||
and [for API integrations](https://git.coolaj86.com/coolaj86/greenlock.js)
 | 
			
		||||
 | 
			
		||||
## Install Node
 | 
			
		||||
Features
 | 
			
		||||
========
 | 
			
		||||
 | 
			
		||||
For **Windows**:
 | 
			
		||||
  - [x] Automatic HTTPS
 | 
			
		||||
    - [x] Free SSL
 | 
			
		||||
    - [x] Free Wildcard SSL
 | 
			
		||||
    - [x] Multiple domain support (up to 100 altnames per SAN)
 | 
			
		||||
    - [x] Virtual Hosting (vhost)
 | 
			
		||||
    - [x] Automatical renewal (10 to 14 days before expiration)
 | 
			
		||||
  - [x] Let's Encrypt v2 ACME API
 | 
			
		||||
  - [x] Extensible via Plugins
 | 
			
		||||
    - [x] HTTP Challenge Plugins - AWS S3, Azure, Consul, etcd
 | 
			
		||||
    - [x] DNS Challenge Plugins - AWS Route53, CloudFlare, Digital Ocean
 | 
			
		||||
    - [x] Account & Certificate Storage Plugins - AWS S3, Redis
 | 
			
		||||
  - [x] HTTPS for Web Servers
 | 
			
		||||
    - [x] node.js
 | 
			
		||||
    - [x] Apache
 | 
			
		||||
    - [x] Nginx
 | 
			
		||||
    - [x] HAProxy
 | 
			
		||||
    - [x] manual
 | 
			
		||||
 | 
			
		||||
Choose **Stable** from <https://nodejs.org/en/>
 | 
			
		||||
Demo
 | 
			
		||||
====
 | 
			
		||||
 | 
			
		||||
For Linux and **OS X**:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
curl -L bit.ly/nodejs-min | bash
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
# Install Greenlock
 | 
			
		||||
Run as a webserver:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
npm install -g greenlock-cli@2.x
 | 
			
		||||
sudo greenlock --daemon --root /srv/www/example.com --domains example.com,www.example.com
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
## Usage
 | 
			
		||||
Fetch certificates for Apache, Nginx, or HAProxy:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
greenlock --domains example.com,www.example.com \
 | 
			
		||||
  --webroot-path /srv/www/example.com \
 | 
			
		||||
  --privkey-path /etc/ssl/privkey.pem \
 | 
			
		||||
  --fullchain-path /etc/ssl/fullchain.pem
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
See explanations below in the **Usage** section.
 | 
			
		||||
 | 
			
		||||
Install
 | 
			
		||||
=======
 | 
			
		||||
 | 
			
		||||
Windows
 | 
			
		||||
-------
 | 
			
		||||
 | 
			
		||||
1. Install node.js
 | 
			
		||||
2. Open `Node.js cmd.exe`
 | 
			
		||||
2. Run the command `npm install -g greenlock-cli`
 | 
			
		||||
 | 
			
		||||
Mac
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
Open Terminal
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
curl -fsS https://get.greenlock.app/ | bash
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Linux
 | 
			
		||||
-----
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
curl -fsS https://get.greenlock.app/ | bash
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Usage
 | 
			
		||||
=====
 | 
			
		||||
 | 
			
		||||
These commands are shown using the **testing server**.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										113
									
								
								installer/get.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										113
									
								
								installer/get.sh
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,113 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
# This is a 3 step process
 | 
			
		||||
# 	1. First we need to figure out whether to use wget or curl for fetching remote files
 | 
			
		||||
# 	2. Next we need to figure out whether to use unzip or tar for downloading releases
 | 
			
		||||
#   3. We need to actually install the stuff
 | 
			
		||||
 | 
			
		||||
set -e
 | 
			
		||||
set -u
 | 
			
		||||
 | 
			
		||||
###############################
 | 
			
		||||
#                             #
 | 
			
		||||
#         http_get            #
 | 
			
		||||
# boilerplate for curl / wget #
 | 
			
		||||
#                             #
 | 
			
		||||
###############################
 | 
			
		||||
 | 
			
		||||
# See https://git.coolaj86.com/coolaj86/snippets/blob/master/bash/http-get.sh
 | 
			
		||||
 | 
			
		||||
_my_http_get=""
 | 
			
		||||
_my_http_opts=""
 | 
			
		||||
_my_http_out=""
 | 
			
		||||
 | 
			
		||||
detect_http_get()
 | 
			
		||||
{
 | 
			
		||||
  set +e
 | 
			
		||||
  if type -p curl >/dev/null 2>&1; then
 | 
			
		||||
    _my_http_get="curl"
 | 
			
		||||
    _my_http_opts="-fsSL"
 | 
			
		||||
    _my_http_out="-o"
 | 
			
		||||
  elif type -p wget >/dev/null 2>&1; then
 | 
			
		||||
    _my_http_get="wget"
 | 
			
		||||
    _my_http_opts="--quiet"
 | 
			
		||||
    _my_http_out="-O"
 | 
			
		||||
  else
 | 
			
		||||
    echo "Aborted, could not find curl or wget"
 | 
			
		||||
    return 7
 | 
			
		||||
  fi
 | 
			
		||||
  set -e
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
http_get()
 | 
			
		||||
{
 | 
			
		||||
  $_my_http_get $_my_http_opts $_my_http_out "$2" "$1"
 | 
			
		||||
  touch "$2"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
http_bash()
 | 
			
		||||
{
 | 
			
		||||
  _http_url=$1
 | 
			
		||||
  my_args=${2:-}
 | 
			
		||||
  rm -rf my-tmp-runner.sh
 | 
			
		||||
  $_my_http_get $_my_http_opts $_my_http_out my-tmp-runner.sh "$_http_url"; bash my-tmp-runner.sh $my_args; rm my-tmp-runner.sh
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
detect_http_get
 | 
			
		||||
 | 
			
		||||
###############################
 | 
			
		||||
##       END HTTP_GET        ##
 | 
			
		||||
###############################
 | 
			
		||||
 | 
			
		||||
echo ""
 | 
			
		||||
echo ""
 | 
			
		||||
 | 
			
		||||
if [ -z "${GREENLOCK_PATH:-}" ]; then
 | 
			
		||||
  echo 'GREENLOCK_PATH="'${GREENLOCK_PATH:-}'"'
 | 
			
		||||
  GREENLOCK_PATH=/opt/greenlock
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
echo "Installing Greenlock to '$GREENLOCK_PATH'"
 | 
			
		||||
echo ""
 | 
			
		||||
 | 
			
		||||
# until node v10.x gets fix for ursa we have no advantage to switching from 8.x
 | 
			
		||||
export NODEJS_VER=v8.11.1
 | 
			
		||||
export NODE_PATH="$GREENLOCK_PATH/lib/node_modules"
 | 
			
		||||
export NPM_CONFIG_PREFIX="$GREENLOCK_PATH"
 | 
			
		||||
export PATH="$GREENLOCK_PATH/bin:$PATH"
 | 
			
		||||
sleep 1
 | 
			
		||||
http_bash https://git.coolaj86.com/coolaj86/node-installer.sh/raw/branch/master/install.sh --no-dev-deps
 | 
			
		||||
 | 
			
		||||
my_tree="master"
 | 
			
		||||
my_node="$GREENLOCK_PATH/bin/node"
 | 
			
		||||
my_npm="$my_node $GREENLOCK_PATH/bin/npm"
 | 
			
		||||
my_tmp="$GREENLOCK_PATH/tmp"
 | 
			
		||||
mkdir -p $my_tmp
 | 
			
		||||
 | 
			
		||||
echo "blah"
 | 
			
		||||
set +e
 | 
			
		||||
my_unzip=$(type -p unzip)
 | 
			
		||||
my_tar=$(type -p tar)
 | 
			
		||||
if [ -n "$my_unzip" ]; then
 | 
			
		||||
  rm -f $my_tmp/greenlock-$my_tree.zip
 | 
			
		||||
  http_get https://git.coolaj86.com/coolaj86/greenlock-cli.js/archive/$my_tree.zip $my_tmp/greenlock-$my_tree.zip
 | 
			
		||||
  # -j is the same as --strip 1, it nixes the top-level directory
 | 
			
		||||
  $my_unzip -j $my_tmp/greenlock-$my_tree.zip -d $GREENLOCK_PATH/
 | 
			
		||||
elif [ -n "$my_tar" ]; then
 | 
			
		||||
  rm -f $my_tmp/greenlock-$my_tree.tar.gz
 | 
			
		||||
  http_get https://git.coolaj86.com/coolaj86/greenlock-cli.js/archive/$my_tree.tar.gz $my_tmp/greenlock-$my_tree.tar.gz
 | 
			
		||||
  ls -lah $my_tmp/greenlock-$my_tree.tar.gz
 | 
			
		||||
  $my_tar -xzf $my_tmp/greenlock-$my_tree.tar.gz --strip 1 -C $GREENLOCK_PATH/
 | 
			
		||||
else
 | 
			
		||||
  echo "Neither tar nor unzip found. Abort."
 | 
			
		||||
  exit 13
 | 
			
		||||
fi
 | 
			
		||||
set -e
 | 
			
		||||
 | 
			
		||||
pushd $GREENLOCK_PATH
 | 
			
		||||
  $my_npm install
 | 
			
		||||
popd
 | 
			
		||||
 | 
			
		||||
#https://git.coolaj86.com/coolaj86/greenlock-cli.js.git
 | 
			
		||||
#https://git.coolaj86.com/coolaj86/greenlock-cli.js/archive/:tree:.tar.gz
 | 
			
		||||
#https://git.coolaj86.com/coolaj86/greenlock-cli.js/archive/:tree:.zip
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user