Update intranet and docker-compose

This commit is contained in:
cytopia 2022-12-23 19:37:50 +01:00
parent f2c0372618
commit d354d84165
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
7 changed files with 191 additions and 33 deletions

View File

@ -13,8 +13,8 @@ error_reporting(-1);
putenv('RES_OPTIONS=retrans:1 retry:1 timeout:1 attempts:1');
$DEVILBOX_VERSION = 'v2.4.0';
$DEVILBOX_DATE = '2022-12-18';
$DEVILBOX_VERSION = 'v3.0.0-beta-0.1';
$DEVILBOX_DATE = '2022-12-23';
$DEVILBOX_API_PAGE = 'devilbox-api/status.json';
//

View File

@ -0,0 +1,129 @@
<?php require '../config.php'; ?>
<?php loadClass('Helper')->authPage(); ?>
<?php if ( isset($_POST['watcherd']) && $_POST['watcherd'] == 'reload' ) {
loadClass('Helper')->exec('supervisorctl -c /etc/supervisor/custom.d/supervisorctl.conf restart watcherd');
sleep(1);
loadClass('Helper')->redirect('/cnc.php');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<?php echo loadClass('Html')->getHead(true); ?>
</head>
<body>
<?php echo loadClass('Html')->getNavbar(); ?>
<div class="container">
<h1>Command & Control</h1>
<br/>
<br/>
<div class="row">
<div class="col-md-12">
<?php
$status_w = loadClass('Helper')->exec('supervisorctl -c /etc/supervisor/custom.d/supervisorctl.conf status watcherd');
$status_h = loadClass('Helper')->exec('supervisorctl -c /etc/supervisor/custom.d/supervisorctl.conf status httpd');
$words = preg_split("/\s+/", $status_w);
$data_w = array(
'name' => $words[0],
'state' => $words[1],
'pid' => preg_replace('/,$/', '', $words[3]),
'uptime' => $words[5],
);
$words = preg_split("/\s+/", $status_h);
$data_h = array(
'name' => $words[0],
'state' => $words[1],
'pid' => preg_replace('/,$/', '', $words[3]),
'uptime' => $words[5],
);
?>
<h3>Daemon overview</h3><br/>
<p>If you made a change to any vhost settings, you can trigger a manual reload here.</p>
<table class="table table-striped">
<thead class="thead-inverse">
<tr>
<th>Daemon</th>
<th>Status</th>
<th>Pid</th>
<th>Uptime</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo $data_w['name']; ?></td>
<td><?php echo $data_w['state']; ?></td>
<td><?php echo $data_w['pid']; ?></td>
<td><?php echo $data_w['uptime']; ?></td>
<td><form method="post"><button type="submit" name="watcherd" value="reload" class="btn btn-primary">Reload</button></form></td>
</tr>
<tr>
<td><?php echo $data_h['name']; ?></td>
<td><?php echo $data_h['state']; ?></td>
<td><?php echo $data_h['pid']; ?></td>
<td><?php echo $data_h['uptime']; ?></td>
<td></td>
</tr>
</tbody>
</table>
<br/>
<br/>
<h3>watcherd stderr</h3>
<br/>
<?php
$output = loadClass('Helper')->exec('supervisorctl -c /etc/supervisor/custom.d/supervisorctl.conf tail -1000000 watcherd stderr');
echo '<pre>' . $output . '</pre>';
?>
<h3>watcherd stdout</h3>
<br/>
<?php
$output = loadClass('Helper')->exec('supervisorctl -c /etc/supervisor/custom.d/supervisorctl.conf tail -1000000 watcherd');
echo '<pre>' . $output . '</pre>';
?>
</div>
</div>
</div><!-- /.container -->
<?php echo loadClass('Html')->getFooter(); ?>
<script>
$(function() {
$('.subject').click(function() {
const id = ($(this).attr('id'));
const row = $('#mail-'+id);
row.toggle();
const bodyElement = row.find('.email-body')[0];
if(bodyElement.shadowRoot !== null){
// We've already fetched the message content.
return;
}
bodyElement.attachShadow({ mode: 'open' });
bodyElement.shadowRoot.innerHTML = 'Loading...';
$.get('?get-body=' + id, function(response){
response = JSON.parse(response);
row.find('.raw-email-body').html(response.raw);
const body = response.body;
if(body === null){
row.find('.alert').show();
}
else{
bodyElement.shadowRoot.innerHTML = body;
}
})
})
// Handler for .ready() called.
});
</script>
</body>
</html>

View File

@ -250,7 +250,7 @@ $messages = $MyMbox->get($sortOrderArr);
$.get('?get-body=' + id, function(response){
response = JSON.parse(response);
row.find('.raw-email-body').html(response.raw);
const body = response.body;
if(body === null){
row.find('.alert').show();

View File

@ -31,7 +31,7 @@
</thead>
<tbody>
<?php
$totals = 70;
$totals = 10;
$filler = '&nbsp;';
for ($i=0; $i<$totals; $i++) {
$filler = $filler. '&nbsp;';

View File

@ -18,6 +18,10 @@ class Html
'name' => 'Virtual Hosts',
'path' => '/vhosts.php'
),
array(
'name' => 'C&C',
'path' => '/cnc.php'
),
array(
'name' => 'Emails',
'path' => '/mail.php'

View File

@ -46,7 +46,7 @@ services:
##
## Debug?
##
- DEBUG_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
- DEBUG_ENTRYPOINT=${DEBUG_ENTRYPOINT:-2}
##
## Memory consumption
@ -112,11 +112,17 @@ services:
- ./.env
environment:
##
## Supervisord Management (to connect to HTTPD supvervisord)
##
- SVCTL_LISTEN_PORT=9001
- SVCTL_USER=${DEVILBOX_HTTPD_MGMT_USER:-supervisor}
- SVCTL_PASS=${DEVILBOX_HTTPD_MGMT_PASS:-mypassword}
##
## Debug/Logging
##
- DEBUG_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
- DEBUG_COMPOSE_ENTRYPOINT
- DEBUG_ENTRYPOINT=${DEBUG_ENTRYPOINT:-2}
- DOCKER_LOGS
##
@ -225,16 +231,26 @@ services:
# Web Server
# ------------------------------------------------------------
httpd:
image: devilbox/${HTTPD_SERVER}:${HTTPD_FLAVOUR:-alpine}-0.48
image: devilbox/${HTTPD_SERVER}:${HTTPD_FLAVOUR:-alpine}-release-0.49b
hostname: httpd
environment:
##
## Supervisord Management
##
- SVCTL_ENABLE=1
- SVCTL_LISTEN_ADDR=0.0.0.0
- SVCTL_LISTEN_PORT=9001
- SVCTL_REMOTE_LOGS_ENABLE=1
- SVCTL_USER=${DEVILBOX_HTTPD_MGMT_USER:-supervisor}
- SVCTL_PASS=${DEVILBOX_HTTPD_MGMT_PASS:-mypassword}
##
## Debug/Logging
##
- DEBUG_ENTRYPOINT=${DEBUG_COMPOSE_ENTRYPOINT}
- DEBUG_RUNTIME=${DEBUG_COMPOSE_ENTRYPOINT}
- DEBUG_ENTRYPOINT=${DEBUG_ENTRYPOINT:-2}
- DEBUG_RUNTIME=1
- DOCKER_LOGS
##
@ -268,25 +284,23 @@ services:
- MAIN_VHOST_SSL_TYPE=${HTTPD_VHOST_SSL_TYPE:-both}
- MAIN_VHOST_SSL_GEN=1
- MAIN_VHOST_SSL_CN=${DEVILBOX_UI_SSL_CN:-localhost}
- MAIN_VHOST_BACKEND=conf:phpfpm:tcp:172.16.238.10:9000
- MAIN_VHOST_BACKEND_TIMEOUT=${HTTPD_BACKEND_TIMEOUT:-180}
- MAIN_VHOST_ALIASES_ALLOW=/devilbox-api/:/var/www/default/api, /vhost.d/:/etc/httpd
##
## Enable Mass Vhosts
##
- MASS_VHOST_ENABLE=1
- MASS_VHOST_TLD=.${TLD_SUFFIX}
- MASS_VHOST_DOCROOT=${HTTPD_DOCROOT_DIR}
- MASS_VHOST_TPL=${HTTPD_TEMPLATE_DIR}
- MASS_VHOST_TLD_SUFFIX=.${TLD_SUFFIX}
- MASS_VHOST_DOCROOT_DIR=${HTTPD_DOCROOT_DIR}
- MASS_VHOST_TEMPLATE_DIR=${HTTPD_TEMPLATE_DIR}
- MASS_VHOST_SSL_TYPE=${HTTPD_VHOST_SSL_TYPE:-both}
- MASS_VHOST_SSL_GEN=1
##
## PHP-FPM Remote Server
##
- COMPAT=${PHP_SERVER}
- PHP_FPM_ENABLE=1
- PHP_FPM_SERVER_ADDR=172.16.238.10
- PHP_FPM_SERVER_PORT=9000
- PHP_FPM_TIMEOUT=${HTTPD_TIMEOUT_TO_PHP_FPM:-180}
- MASS_VHOST_BACKEND=conf:phpfpm:tcp:172.16.238.10:9000
- MASS_VHOST_BACKEND_REWRITE=file:backend.cfg
- MASS_VHOST_BACKEND_TIMEOUT=${HTTPD_BACKEND_TIMEOUT:-180}
- MASS_VHOST_ALIASES_ALLOW=/devilbox-api/:/var/www/default/api:http(s)?://(.*)$$
ports:
# ---- Format: ----
@ -315,7 +329,7 @@ services:
- ${DEVILBOX_PATH}/cfg/vhost-gen:/etc/vhost-gen.d:rw${MOUNT_OPTIONS}
# Mount logs
- ${DEVILBOX_PATH}/log/${HTTPD_SERVER}:/var/log/${HTTPD_SERVER}:rw${MOUNT_OPTIONS}
- ${DEVILBOX_PATH}/log/${HTTPD_SERVER}:/var/log/httpd:rw${MOUNT_OPTIONS}
# Certificate Authority public key
- ${DEVILBOX_PATH}/ca:/ca:rw${MOUNT_OPTIONS}

View File

@ -28,10 +28,12 @@
### Show all executed commands in each
### docker image during docker-compose up?
###
### 0: Quiet
### 1: Verbose
### 2: More verbose
DEBUG_COMPOSE_ENTRYPOINT=2
### 0: Errors
### 1: Errors, Warnings
### 2: Errors, Warnings, Infos (Recommended)
### 3: Errors, Warnings, Infos, Debug
### 4: Errors, Warnings, Infos, Debug, Trace
DEBUG_ENTRYPOINT=2
###
@ -236,6 +238,12 @@ DEVILBOX_VENDOR_PHPMYADMIN_AUTOLOGIN=1
###
DEVILBOX_VENDOR_PHPPGADMIN_AUTOLOGIN=1
###
### HTTPD Supvervisord management
###
DEVILBOX_HTTPD_MGMT_USER=supervisord
DEVILBOX_HTTPD_MGMT_PASS=mypassword
################################################################################
@ -515,7 +523,7 @@ PHP_MODULES_ENABLE=
###
### PHP_MODULES_DISABLE=xdebug,imagick,swoole
###
PHP_MODULES_DISABLE=oci8,PDO_OCI,pdo_sqlsrv,sqlsrv,rdkafka,swoole
PHP_MODULES_DISABLE=oci8,PDO_OCI,pdo_sqlsrv,sqlsrv,rdkafka,swoole,psr,phalcon
###
@ -609,13 +617,16 @@ HTTPD_TEMPLATE_DIR=.devilbox
###
### Webserver timeout (in seconds) to upstream PHP-FPM server
### Remote (Upstream) Backend Timeout
###
### This value should be greater than PHP's max_execution_time,
### otherwise the php script could still run and the webserver will
### simply drop the connection before getting an answer by PHP.
### This setting specifies the Timeout for a remote Backend server,
### such as PHP-FPM or a Reverse Proxy.
###
HTTPD_TIMEOUT_TO_PHP_FPM=180
### As for PHP, keep in mind that this value should be greater than
### PHP's max_execution_time,otherwise the php script could still
### run and the webserver will simply drop the connection before getting an answer by PHP.
###
HTTPD_BACKEND_TIMEOUT=180
###