Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
a6feb0a8
Commit
a6feb0a8
authored
Feb 11, 2017
by
neil
Committed by
GitHub
Feb 11, 2017
Browse files
Merge pull request #608 from Neilpang/dev
Dev
parents
31e39f1f
cd9c3a79
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
a6feb0a8
...
@@ -147,7 +147,7 @@ You **MUST** use this command to copy the certs to the target files, **DO NOT**
...
@@ -147,7 +147,7 @@ You **MUST** use this command to copy the certs to the target files, **DO NOT**
**Apache**
example:
**Apache**
example:
```
bash
```
bash
acme.sh
--installcert
-d
example.com
\
acme.sh
--install
-
cert
-d
example.com
\
--certpath
/path/to/certfile/in/apache/cert.pem
\
--certpath
/path/to/certfile/in/apache/cert.pem
\
--keypath
/path/to/keyfile/in/apache/key.pem
\
--keypath
/path/to/keyfile/in/apache/key.pem
\
--fullchainpath
/path/to/fullchain/certfile/apache/fullchain.pem
\
--fullchainpath
/path/to/fullchain/certfile/apache/fullchain.pem
\
...
@@ -156,7 +156,7 @@ acme.sh --installcert -d example.com \
...
@@ -156,7 +156,7 @@ acme.sh --installcert -d example.com \
**Nginx**
example:
**Nginx**
example:
```
bash
```
bash
acme.sh
--installcert
-d
example.com
\
acme.sh
--install
-
cert
-d
example.com
\
--keypath
/path/to/keyfile/in/nginx/key.pem
\
--keypath
/path/to/keyfile/in/nginx/key.pem
\
--fullchainpath
/path/to/fullchain/nginx/cert.pem
\
--fullchainpath
/path/to/fullchain/nginx/cert.pem
\
--reloadcmd
"service nginx force-reload"
--reloadcmd
"service nginx force-reload"
...
...
acme.sh
View file @
a6feb0a8
...
@@ -61,6 +61,10 @@ LOG_LEVEL_2=2
...
@@ -61,6 +61,10 @@ LOG_LEVEL_2=2
LOG_LEVEL_3
=
3
LOG_LEVEL_3
=
3
DEFAULT_LOG_LEVEL
=
"
$LOG_LEVEL_1
"
DEFAULT_LOG_LEVEL
=
"
$LOG_LEVEL_1
"
SYSLOG_INFO
=
"user.info"
SYSLOG_ERROR
=
"user.error"
SYSLOG_DEBUG
=
"user.debug"
_DEBUG_WIKI
=
"https://github.com/Neilpang/acme.sh/wiki/How-to-debug-acme.sh"
_DEBUG_WIKI
=
"https://github.com/Neilpang/acme.sh/wiki/How-to-debug-acme.sh"
_PREPARE_LINK
=
"https://github.com/Neilpang/acme.sh/wiki/Install-preparations"
_PREPARE_LINK
=
"https://github.com/Neilpang/acme.sh/wiki/Install-preparations"
...
@@ -128,18 +132,30 @@ _dlg_versions() {
...
@@ -128,18 +132,30 @@ _dlg_versions() {
fi
fi
}
}
#class
_syslog
()
{
if
[
-z
"
$SYS_LOG
"
]
||
[
"
$SYS_LOG
"
=
"0"
]
;
then
return
fi
_logclass
=
"
$1
"
shift
logger
-i
-t
"
$PROJECT_NAME
"
-p
"
$_logclass
"
"
$(
_printargs
"
$@
"
)
"
>
/dev/null 2>&1
}
_log
()
{
_log
()
{
_syslog
"
$@
"
[
-z
"
$LOG_FILE
"
]
&&
return
[
-z
"
$LOG_FILE
"
]
&&
return
shift
_printargs
"
$@
"
>>
"
$LOG_FILE
"
_printargs
"
$@
"
>>
"
$LOG_FILE
"
}
}
_info
()
{
_info
()
{
_log
"
$@
"
_log
"
$SYSLOG_INFO
"
"
$@
"
_printargs
"
$@
"
_printargs
"
$@
"
}
}
_err
()
{
_err
()
{
_log
"
$@
"
_log
"
$SYSLOG_ERROR
"
"
$@
"
if
[
-z
"
$NO_TIMESTAMP
"
]
||
[
"
$NO_TIMESTAMP
"
=
"0"
]
;
then
if
[
-z
"
$NO_TIMESTAMP
"
]
||
[
"
$NO_TIMESTAMP
"
=
"0"
]
;
then
printf
--
"%s"
"[
$(
date
)
] "
>
&2
printf
--
"%s"
"[
$(
date
)
] "
>
&2
fi
fi
...
@@ -159,7 +175,7 @@ _usage() {
...
@@ -159,7 +175,7 @@ _usage() {
_debug
()
{
_debug
()
{
if
[
-z
"
$LOG_LEVEL
"
]
||
[
"
$LOG_LEVEL
"
-ge
"
$LOG_LEVEL_1
"
]
;
then
if
[
-z
"
$LOG_LEVEL
"
]
||
[
"
$LOG_LEVEL
"
-ge
"
$LOG_LEVEL_1
"
]
;
then
_log
"
$@
"
_log
"
$SYSLOG_DEBUG
"
"
$@
"
fi
fi
if
[
-z
"
$DEBUG
"
]
;
then
if
[
-z
"
$DEBUG
"
]
;
then
return
return
...
@@ -169,19 +185,19 @@ _debug() {
...
@@ -169,19 +185,19 @@ _debug() {
_debug2
()
{
_debug2
()
{
if
[
"
$LOG_LEVEL
"
]
&&
[
"
$LOG_LEVEL
"
-ge
"
$LOG_LEVEL_2
"
]
;
then
if
[
"
$LOG_LEVEL
"
]
&&
[
"
$LOG_LEVEL
"
-ge
"
$LOG_LEVEL_2
"
]
;
then
_log
"
$@
"
_log
"
$SYSLOG_DEBUG
"
"
$@
"
fi
fi
if
[
"
$DEBUG
"
]
&&
[
"
$DEBUG
"
-ge
"2"
]
;
then
if
[
"
$DEBUG
"
]
&&
[
"
$DEBUG
"
-ge
"2"
]
;
then
_
debug
"
$@
"
_
printargs
"
$@
"
>
&2
fi
fi
}
}
_debug3
()
{
_debug3
()
{
if
[
"
$LOG_LEVEL
"
]
&&
[
"
$LOG_LEVEL
"
-ge
"
$LOG_LEVEL_3
"
]
;
then
if
[
"
$LOG_LEVEL
"
]
&&
[
"
$LOG_LEVEL
"
-ge
"
$LOG_LEVEL_3
"
]
;
then
_log
"
$@
"
_log
"
$SYSLOG_DEBUG
"
"
$@
"
fi
fi
if
[
"
$DEBUG
"
]
&&
[
"
$DEBUG
"
-ge
"3"
]
;
then
if
[
"
$DEBUG
"
]
&&
[
"
$DEBUG
"
-ge
"3"
]
;
then
_
debug
"
$@
"
_
printargs
"
$@
"
>
&2
fi
fi
}
}
...
@@ -4286,6 +4302,7 @@ Parameters:
...
@@ -4286,6 +4302,7 @@ Parameters:
--accountkeylength, -ak [2048] Specifies the account key length.
--accountkeylength, -ak [2048] Specifies the account key length.
--log [/path/to/logfile] Specifies the log file. The default is:
\"
$DEFAULT_LOG_FILE
\"
if you don't give a file path here.
--log [/path/to/logfile] Specifies the log file. The default is:
\"
$DEFAULT_LOG_FILE
\"
if you don't give a file path here.
--log-level 1|2 Specifies the log level, default is 1.
--log-level 1|2 Specifies the log level, default is 1.
--syslog [1|0] Enable/Disable syslog.
These parameters are to install the cert to nginx/apache or anyother server after issue/renew a cert:
These parameters are to install the cert to nginx/apache or anyother server after issue/renew a cert:
...
@@ -4444,6 +4461,7 @@ _process() {
...
@@ -4444,6 +4461,7 @@ _process() {
_listen_v4
=
""
_listen_v4
=
""
_listen_v6
=
""
_listen_v6
=
""
_openssl_bin
=
""
_openssl_bin
=
""
_syslog
=
""
while
[
${#}
-gt
0
]
;
do
while
[
${#}
-gt
0
]
;
do
case
"
${
1
}
"
in
case
"
${
1
}
"
in
...
@@ -4774,6 +4792,15 @@ _process() {
...
@@ -4774,6 +4792,15 @@ _process() {
LOG_LEVEL
=
"
$_log_level
"
LOG_LEVEL
=
"
$_log_level
"
shift
shift
;;
;;
--syslog
)
if
!
_startswith
"
$2
"
'-'
;
then
_syslog
=
"
$2
"
shift
fi
if
[
-z
"
$_syslog
"
]
;
then
_syslog
=
"1"
fi
;;
--auto-upgrade
)
--auto-upgrade
)
_auto_upgrade
=
"
$2
"
_auto_upgrade
=
"
$2
"
if
[
-z
"
$_auto_upgrade
"
]
||
_startswith
"
$_auto_upgrade
"
'-'
;
then
if
[
-z
"
$_auto_upgrade
"
]
||
_startswith
"
$_auto_upgrade
"
'-'
;
then
...
@@ -4821,6 +4848,21 @@ _process() {
...
@@ -4821,6 +4848,21 @@ _process() {
LOG_LEVEL
=
"
$_log_level
"
LOG_LEVEL
=
"
$_log_level
"
fi
fi
if
[
"
$_syslog
"
]
;
then
if
_exists logger
;
then
if
[
"
$_syslog
"
=
"0"
]
;
then
_clearaccountconf
"SYS_LOG"
else
_saveaccountconf
"SYS_LOG"
"
$_syslog
"
fi
SYS_LOG
=
"
$_syslog
"
else
_err
"The 'logger' command is not found, can not enable syslog."
_clearaccountconf
"SYS_LOG"
SYS_LOG
=
""
fi
fi
_processAccountConf
_processAccountConf
fi
fi
...
@@ -4913,6 +4955,21 @@ _process() {
...
@@ -4913,6 +4955,21 @@ _process() {
if
[
"
$_log_level
"
]
;
then
if
[
"
$_log_level
"
]
;
then
_saveaccountconf
"LOG_LEVEL"
"
$_log_level
"
_saveaccountconf
"LOG_LEVEL"
"
$_log_level
"
fi
fi
if
[
"
$_syslog
"
]
;
then
if
_exists logger
;
then
if
[
"
$_syslog
"
=
"0"
]
;
then
_clearaccountconf
"SYS_LOG"
else
_saveaccountconf
"SYS_LOG"
"
$_syslog
"
fi
else
_err
"The 'logger' command is not found, can not enable syslog."
_clearaccountconf
"SYS_LOG"
SYS_LOG
=
""
fi
fi
_processAccountConf
_processAccountConf
fi
fi
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment