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.
77 lines
2.0 KiB
77 lines
2.0 KiB
<?php
|
|
require_once('lib/assembler.php');
|
|
if( $SSL_INSTALLLED || 1 ){
|
|
if( $CUser->Data['id'] > 1 ){
|
|
if( $CUser->Data['access'] > 5 ){
|
|
UI_PageHeaderExt(
|
|
'argus_general.js',
|
|
array(
|
|
'argus_global_vars.js',
|
|
'argus_settings.js',
|
|
'argus_main.js'
|
|
)
|
|
);
|
|
} else {
|
|
UI_PageHeaderExt(
|
|
'argus_general.js',
|
|
array(
|
|
'argus_global_vars.js',
|
|
'argus_settings.js',
|
|
'argus_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();
|
|
};
|
|
?>
|