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.

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