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.

33 lines
1.0 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. <?php
  2. require_once('../../scripts/sys_utils.php');
  3. require_once('../../scripts/distro_web_utils.php');
  4. print_PAGE_HEADER();
  5. if( isset( $_FILES["cert"] ) ){
  6. $target_dir = "/srv/etc/ssl/tmp";
  7. $target_file = $target_dir . '/' . basename($_FILES["cert"]["name"]);
  8. $tmp_file = $_FILES["cert"]["tmp_name"];
  9. move_uploaded_file( $tmp_file, $target_file );
  10. };
  11. if( $SYS_CONFIG['NGINX_AUTH_IS_SET'] == false ) {
  12. print_AUTH_WARNING();
  13. };
  14. print_CONNECTION_INFO();
  15. $A = print_CERT_INFO( $target_file );
  16. if( $A < 7 ){
  17. print_CERT_UPLOAD_FORM();
  18. } else {
  19. if( $SYS_CONFIG['NGINX_CERTIFICATE_INSTALLED'] ){
  20. @unlink( '/srv/etc/ssl/certs/host.crt' );
  21. rename( $target_file, '/srv/etc/ssl/certs/host.crt' );
  22. } else {
  23. rename( $target_file, '/srv/etc/ssl/certs/host.crt' );
  24. $SYS_CONFIG['NGINX_CERTIFICATE_INSTALLED'] = true;
  25. save_system_config();
  26. };
  27. if( $SYS_CONFIG['NGINX_CERTIFICATE_ENABLED'] ){
  28. // must restart NGINX
  29. create_cron_task( 14 );
  30. };
  31. };
  32. print_PAGE_BOTTOM();
  33. ?>