• Support
  • Forums
  • Blogs

privat key import bug [OSSIM]

determinedetermine

New Life Form
While importing totally valid openSSH private key, got such error:
"A valid private key is required"
the problem is in the /usr/share/ossim/www/vulnmeter/webconfig.php

in this place:
  166                        $file_arr = @file($tmp_private_key);
   167                       
   168                        foreach ($file_arr as $line)
   169                        {
   170                            if (!preg_match("/^\-+begin\s[a-zA-Z]+\sprivate\skey\-+$/i", $line) )// BEGIN
   171                             && !preg_match("/^\-+end\s[a-zA-Z]+\sprivate\skey\-+$/i", $line) // END
   172                             && !preg_match("/^[a-zA-Z0-9\+\/\=]+$/", $line)) // Base64 string
   173                            {
   174                                $_private_key_error = TRUE;
   175                            }
   176                        }


"170           if" never will be TRUE in such condition. every regex will be true, but not the all together.
 

Share post:

Comments

  • I've found the problem.
    if the key file has CR+LF chars at the end of the lines, parsing isn't correct and you will get the error "A valid private key is required"


    CR+LF at the end is common for Windows created files.
Sign In or Register to comment.