Web Interface For Lite Argus Control modules
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.

97 lines
2.6 KiB

4 years ago
​
4 years ago
​
​
​
4 years ago
4 years ago
​
​
​
​
4 years ago
​
​
​
​
4 years ago
​
​
​
​
4 years ago
​
​
​
​
​
​
4 years ago
​
4 years ago
​
​
​
​
4 years ago
4 years ago
​
​
4 years ago
​
4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
4 years ago
4 years ago
4 years ago
​
​
  1. <?php
  2. require_once('lib/assembler.php');
  3. if( $SSL_INSTALLLED || 1 ){
  4. if( $CUser->Data['id'] > 1 ){
  5. if( $CUser->Data['access'] > 5 ){
  6. UI_PageHeaderExt(
  7. array('mojo_general.js','mojo_portal.js'),
  8. array(
  9. 'mojo_global_vars.js',
  10. 'mojo_reports.js',
  11. 'rgoose_devices.js',
  12. 'rgoose_cameras.js',
  13. 'rgoose_modules.js',
  14. 'mojo_monitoring.js',
  15. 'mojo_map.js',
  16. 'mojo_masks.js',
  17. 'mojo_dashboard.js',
  18. 'mojo_users.js',
  19. 'mojo_logs.js',
  20. 'mojo_metro.js',
  21. 'mojo_settings.js',
  22. 'mojo_windows.js?w='.((isset($_GET['w']))?intval($_GET['w']):0),
  23. 'mojo_main.js'
  24. )
  25. );
  26. } else {
  27. UI_PageHeaderExt(
  28. array('mojo_general.js','mojo_portal.js'),
  29. array(
  30. 'mojo_global_vars.js',
  31. 'mojo_reports.js',
  32. 'rgoose_devices.js',
  33. 'rgoose_cameras.js',
  34. 'rgoose_modules.js',
  35. 'mojo_monitoring.js',
  36. 'mojo_map.js',
  37. 'mojo_masks.js',
  38. 'mojo_dashboard.js',
  39. 'mojo_settings.js',
  40. 'mojo_windows.js?w='.((isset($_GET['w']))?intval($_GET['w']):0),
  41. 'mojo_main.js'
  42. )
  43. );
  44. };
  45. UI_PageBottomExt();
  46. } else {
  47. UI_PageHeader();
  48. UI_LoginForm();
  49. UI_PageBottom();
  50. };
  51. } else {
  52. $UPLOAD = false;
  53. $VALID = false;
  54. if( isset( $_FILES ) ){
  55. $UPLOAD = true;
  56. $Z = '/srv/www/web/lib/tmp/'.basename($_FILES["fcert"]["name"]);
  57. $JUJA = $_FILES["fcert"]["tmp_name"];
  58. $CMD = 'openssl verify -verbose -CAfile /srv/www/web/style/assets/rootCA.crt ' . $_FILES["fcert"]["tmp_name"];
  59. $DATA = `{$CMD}`;
  60. if( stripos( $DATA, ': OK')!== false ){
  61. $CMD = 'openssl x509 -ext subjectAltName -noout -in ' . $_FILES["fcert"]["tmp_name"];
  62. $DATA = `{$CMD}`;
  63. $TArr = explode( "\n", $DATA );
  64. if( count( $TArr ) > 1 ){
  65. $IPS = array();
  66. foreach( $TArr as $T ){
  67. $CL = explode( ',', trim( $T ) );
  68. foreach( $CL as $C ){
  69. $PArr = explode( ':', $C );
  70. if( stripos( $PArr[0], 'IP Address' )!== false ) $IPS[] = $PArr[1];
  71. };
  72. };
  73. if( count( $IPS ) ){
  74. foreach( $IPS as $IP ) if ( $IP == $_SERVER['HTTP_HOST'] ) $VALID = true;
  75. if( $VALID ){
  76. // Setup SSL
  77. @unlink($_FILES['fcert']['tmp_name']);
  78. } else {
  79. $ERR = $Labels->GetLabel('_SSL_CERT_IP_NO_');
  80. };
  81. } else {
  82. // No IP defined in Cert
  83. $ERR = $Labels->GetLabel('_SSL_NO_IP_CERT_');
  84. };
  85. } else {
  86. // No Extension
  87. $ERR = $Labels->GetLabel('_SSL_NO_EXT_CERT_');
  88. };
  89. } else {
  90. // CERT is invalid
  91. $ERR = $Labels->GetLabel('_SSL_CERT_INVALID__');
  92. };
  93. };
  94. UI_PageHeader();
  95. UI_SSLDialog();
  96. UI_PageBottom();
  97. };
  98. ?>