You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
2.4 KiB
95 lines
2.4 KiB
<?php
|
|
require_once('lib/assembler.php');
|
|
if( $SSL_INSTALLLED || 1 ){
|
|
if( $CUser->Data['id'] > 1 ){
|
|
if( $CUser->Data['access'] > 5 ){
|
|
UI_PageHeaderExt(
|
|
'mojo_general.js',
|
|
array(
|
|
'mojo_global_vars.js',
|
|
'rgoose_map.js',
|
|
'mojo_reports.js',
|
|
'rgoose_devices.js',
|
|
'rgoose_cameras.js',
|
|
'rgoose_modules.js',
|
|
'mojo_monitoring.js',
|
|
'rgoose_location_editor.js',
|
|
'mojo_dashboard.js',
|
|
'mojo_users.js',
|
|
'mojo_logs.js',
|
|
'mojo_metro.js',
|
|
'mojo_settings.js',
|
|
'mojo_main.js'
|
|
)
|
|
);
|
|
} else {
|
|
UI_PageHeaderExt(
|
|
'mojo_general.js',
|
|
array(
|
|
'mojo_global_vars.js',
|
|
'rgoose_map.js',
|
|
'mojo_reports.js',
|
|
'rgoose_devices.js',
|
|
'rgoose_cameras.js',
|
|
'rgoose_modules.js',
|
|
'mojo_monitoring.js',
|
|
'mojo_dashboard.js',
|
|
'mojo_settings.js',
|
|
'mojo_main.js'
|
|
)
|
|
);
|
|
};
|
|
UI_PageBottomExt();
|
|
} else {
|
|
UI_PageHeader();
|
|
UI_LoginForm();
|
|
UI_PageBottom();
|
|
};
|
|
} else {
|
|
$UPLOAD = false;
|
|
$VALID = false;
|
|
if( isset( $_FILES ) ){
|
|
$UPLOAD = true;
|
|
$Z = '/srv/www/web/lib/tmp/'.basename($_FILES["fcert"]["name"]);
|
|
$JUJA = $_FILES["fcert"]["tmp_name"];
|
|
$CMD = 'openssl verify -verbose -CAfile /srv/www/web/style/assets/rootCA.crt ' . $_FILES["fcert"]["tmp_name"];
|
|
$DATA = `{$CMD}`;
|
|
if( stripos( $DATA, ': OK')!== false ){
|
|
$CMD = 'openssl x509 -ext subjectAltName -noout -in ' . $_FILES["fcert"]["tmp_name"];
|
|
$DATA = `{$CMD}`;
|
|
$TArr = explode( "\n", $DATA );
|
|
if( count( $TArr ) > 1 ){
|
|
$IPS = array();
|
|
foreach( $TArr as $T ){
|
|
$CL = explode( ',', trim( $T ) );
|
|
foreach( $CL as $C ){
|
|
$PArr = explode( ':', $C );
|
|
if( stripos( $PArr[0], 'IP Address' )!== false ) $IPS[] = $PArr[1];
|
|
};
|
|
};
|
|
if( count( $IPS ) ){
|
|
foreach( $IPS as $IP ) if ( $IP == $_SERVER['HTTP_HOST'] ) $VALID = true;
|
|
if( $VALID ){
|
|
// Setup SSL
|
|
@unlink($_FILES['fcert']['tmp_name']);
|
|
} else {
|
|
$ERR = $Labels->GetLabel('_SSL_CERT_IP_NO_');
|
|
};
|
|
} else {
|
|
// No IP defined in Cert
|
|
$ERR = $Labels->GetLabel('_SSL_NO_IP_CERT_');
|
|
};
|
|
} else {
|
|
// No Extension
|
|
$ERR = $Labels->GetLabel('_SSL_NO_EXT_CERT_');
|
|
};
|
|
} else {
|
|
// CERT is invalid
|
|
$ERR = $Labels->GetLabel('_SSL_CERT_INVALID__');
|
|
};
|
|
};
|
|
UI_PageHeader();
|
|
UI_SSLDialog();
|
|
UI_PageBottom();
|
|
};
|
|
?>
|