Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
ISPConfig 3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ISPConfig
ISPConfig 3
Commits
38fdcf89
Commit
38fdcf89
authored
4 years ago
by
Marius Burkard
Browse files
Options
Downloads
Patches
Plain Diff
- add logging to acme.sh commands and add that log file to internal log rotation
parent
3931f36e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1063
Resolve "Enable logging for acme.sh"
Pipeline
#3642
passed
4 years ago
Stage: syntax
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/lib/classes/cron.d/200-logfiles.inc.php
+8
-8
8 additions, 8 deletions
server/lib/classes/cron.d/200-logfiles.inc.php
server/lib/classes/letsencrypt.inc.php
+2
-2
2 additions, 2 deletions
server/lib/classes/letsencrypt.inc.php
with
10 additions
and
10 deletions
server/lib/classes/cron.d/200-logfiles.inc.php
+
8
−
8
View file @
38fdcf89
...
@@ -49,10 +49,10 @@ class cronjob_logfiles extends cronjob {
...
@@ -49,10 +49,10 @@ class cronjob_logfiles extends cronjob {
public
function
onRunJob
()
{
public
function
onRunJob
()
{
global
$app
,
$conf
;
global
$app
,
$conf
;
$app
->
uses
(
'getconf'
);
$app
->
uses
(
'getconf'
);
$server_config
=
$app
->
getconf
->
get_server_config
(
$conf
[
'server_id'
],
'server'
);
$server_config
=
$app
->
getconf
->
get_server_config
(
$conf
[
'server_id'
],
'server'
);
if
(
$server_config
[
'log_retention'
]
>
0
)
{
if
(
$server_config
[
'log_retention'
]
>
0
)
{
$max_syslog
=
$app
->
functions
->
intval
(
$server_config
[
'log_retention'
]);
$max_syslog
=
$app
->
functions
->
intval
(
$server_config
[
'log_retention'
]);
}
else
{
}
else
{
...
@@ -121,18 +121,18 @@ class cronjob_logfiles extends cronjob {
...
@@ -121,18 +121,18 @@ class cronjob_logfiles extends cronjob {
$app
->
system
->
exec_safe
(
"gzip -c ? > ?"
,
$logfile
,
$logfile
.
'.gz'
);
$app
->
system
->
exec_safe
(
"gzip -c ? > ?"
,
$logfile
,
$logfile
.
'.gz'
);
unlink
(
$logfile
);
unlink
(
$logfile
);
}
}
$cron_logfiles
=
array
(
'cron.log'
,
'cron_error.log'
,
'cron_wget.log'
);
$cron_logfiles
=
array
(
'cron.log'
,
'cron_error.log'
,
'cron_wget.log'
);
foreach
(
$cron_logfiles
as
$cron_logfile
)
{
foreach
(
$cron_logfiles
as
$cron_logfile
)
{
$cron_logfile
=
$rec
[
'document_root'
]
.
'/'
.
$log_folder
.
'/'
.
$cron_logfile
;
$cron_logfile
=
$rec
[
'document_root'
]
.
'/'
.
$log_folder
.
'/'
.
$cron_logfile
;
// rename older files (move up by one)
// rename older files (move up by one)
$num
=
$log_retention
;
$num
=
$log_retention
;
while
(
$num
>=
1
)
{
while
(
$num
>=
1
)
{
if
(
is_file
(
$cron_logfile
.
'.'
.
$num
.
'.gz'
))
rename
(
$cron_logfile
.
'.'
.
$num
.
'.gz'
,
$cron_logfile
.
'.'
.
(
$num
+
1
)
.
'.gz'
);
if
(
is_file
(
$cron_logfile
.
'.'
.
$num
.
'.gz'
))
rename
(
$cron_logfile
.
'.'
.
$num
.
'.gz'
,
$cron_logfile
.
'.'
.
(
$num
+
1
)
.
'.gz'
);
$num
--
;
$num
--
;
}
}
// compress current logfile
// compress current logfile
if
(
is_file
(
$cron_logfile
))
{
if
(
is_file
(
$cron_logfile
))
{
$app
->
system
->
exec_safe
(
"gzip -c ? > ?"
,
$cron_logfile
,
$cron_logfile
.
'.1.gz'
);
$app
->
system
->
exec_safe
(
"gzip -c ? > ?"
,
$cron_logfile
,
$cron_logfile
.
'.1.gz'
);
...
@@ -146,7 +146,7 @@ class cronjob_logfiles extends cronjob {
...
@@ -146,7 +146,7 @@ class cronjob_logfiles extends cronjob {
}
}
}
}
// rotate and compress the error.log
// rotate and compress the error.log
$error_logfile
=
$rec
[
'document_root'
]
.
'/'
.
$log_folder
.
'/error.log'
;
$error_logfile
=
$rec
[
'document_root'
]
.
'/'
.
$log_folder
.
'/error.log'
;
// rename older files (move up by one)
// rename older files (move up by one)
$num
=
$log_retention
;
$num
=
$log_retention
;
...
@@ -184,7 +184,7 @@ class cronjob_logfiles extends cronjob {
...
@@ -184,7 +184,7 @@ class cronjob_logfiles extends cronjob {
//######################################################################################################
//######################################################################################################
$ispconfig_logfiles
=
array
(
'ispconfig.log'
,
'cron.log'
,
'auth.log'
);
$ispconfig_logfiles
=
array
(
'ispconfig.log'
,
'cron.log'
,
'auth.log'
,
'acme.log'
);
foreach
(
$ispconfig_logfiles
as
$ispconfig_logfile
)
{
foreach
(
$ispconfig_logfiles
as
$ispconfig_logfile
)
{
$num
=
$max_syslog
;
$num
=
$max_syslog
;
$ispconfig_logfile
=
$conf
[
'ispconfig_log_dir'
]
.
'/'
.
$ispconfig_logfile
;
$ispconfig_logfile
=
$conf
[
'ispconfig_log_dir'
]
.
'/'
.
$ispconfig_logfile
;
...
@@ -240,7 +240,7 @@ class cronjob_logfiles extends cronjob {
...
@@ -240,7 +240,7 @@ class cronjob_logfiles extends cronjob {
*/
*/
$sql
=
"DELETE FROM sys_log WHERE tstamp < ? AND server_id != 0"
;
$sql
=
"DELETE FROM sys_log WHERE tstamp < ? AND server_id != 0"
;
$app
->
dbmaster
->
query
(
$sql
,
$tstamp
);
$app
->
dbmaster
->
query
(
$sql
,
$tstamp
);
/*
/*
* now delete those entries without a linked datalog entry (datalog_id = 0)
* now delete those entries without a linked datalog entry (datalog_id = 0)
*/
*/
...
...
This diff is collapsed.
Click to expand it.
server/lib/classes/letsencrypt.inc.php
+
2
−
2
View file @
38fdcf89
...
@@ -54,7 +54,7 @@ class letsencrypt {
...
@@ -54,7 +54,7 @@ class letsencrypt {
}
}
public
function
get_acme_command
(
$domains
,
$key_file
,
$bundle_file
,
$cert_file
,
$server_type
=
'apache'
)
{
public
function
get_acme_command
(
$domains
,
$key_file
,
$bundle_file
,
$cert_file
,
$server_type
=
'apache'
)
{
global
$app
;
global
$app
,
$conf
;
$letsencrypt
=
$this
->
get_acme_script
();
$letsencrypt
=
$this
->
get_acme_script
();
...
@@ -74,7 +74,7 @@ class letsencrypt {
...
@@ -74,7 +74,7 @@ class letsencrypt {
$cert_arg
=
'--fullchain-file '
.
escapeshellarg
(
$bundle_file
)
.
' --cert-file '
.
escapeshellarg
(
$cert_file
);
$cert_arg
=
'--fullchain-file '
.
escapeshellarg
(
$bundle_file
)
.
' --cert-file '
.
escapeshellarg
(
$cert_file
);
}
}
$cmd
=
'R=0 ; C=0 ; '
.
$letsencrypt
.
' --issue '
.
$cmd
.
' -w /usr/local/ispconfig/interface/acme ; R=$? ; if [[ $R -eq 0 || $R -eq 2 ]] ; then '
.
$letsencrypt
.
' --install-cert '
.
$cmd
.
' --key-file '
.
escapeshellarg
(
$key_file
)
.
' '
.
$cert_arg
.
' --reloadcmd '
.
escapeshellarg
(
$this
->
get_reload_command
())
.
'; C=$? ; fi ; if [[ $C -eq 0 ]] ; then exit $R ; else exit $C ; fi'
;
$cmd
=
'R=0 ; C=0 ; '
.
$letsencrypt
.
' --issue '
.
$cmd
.
' -w /usr/local/ispconfig/interface/acme ; R=$? ; if [[ $R -eq 0 || $R -eq 2 ]] ; then '
.
$letsencrypt
.
' --install-cert '
.
$cmd
.
' --key-file '
.
escapeshellarg
(
$key_file
)
.
' '
.
$cert_arg
.
' --reloadcmd '
.
escapeshellarg
(
$this
->
get_reload_command
())
.
' --log '
.
escapeshellarg
(
$conf
[
'ispconfig_log_dir'
]
.
'/acme.log'
)
.
'; C=$? ; fi ; if [[ $C -eq 0 ]] ; then exit $R ; else exit $C ; fi'
;
return
$cmd
;
return
$cmd
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment