Update-keydb with comments and better Algo check
This commit is contained in:
		
							
								
								
									
										8
									
								
								debian/usr/sbin/foodoor-update-keydb
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								debian/usr/sbin/foodoor-update-keydb
									
									
									
									
										vendored
									
									
								
							@@ -24,10 +24,10 @@ rm -f ${temp_outfile}
 | 
			
		||||
      if [ $? -eq 0 ]; then
 | 
			
		||||
        valid=false
 | 
			
		||||
        keyinfo=$(ssh-keygen -l -f ${keyfile}) # The whole key information
 | 
			
		||||
        crypto=$(echo "${keyinfo}" | cut -d" " -f4) # Looks like "(RSA)" or "(ED25519)"
 | 
			
		||||
        crypto=$(echo "${keyinfo}" | sed 's/.*(\(.*\))/\1/') # Looks like "RSA" or "ED25519"
 | 
			
		||||
        key_length=$(echo "${keyinfo}" | cut -d" " -f1) 
 | 
			
		||||
 | 
			
		||||
        if [ "${crypto}" == "(RSA)" ]; then
 | 
			
		||||
        if [ "${crypto}" == "RSA" ]; then
 | 
			
		||||
 | 
			
		||||
          if [ ${key_length} -lt 4096 ]; then
 | 
			
		||||
            echo "Key size of key ${keyfile} not equal to 4096. Not adding it to key database." >&2
 | 
			
		||||
@@ -36,12 +36,12 @@ rm -f ${temp_outfile}
 | 
			
		||||
            valid=true
 | 
			
		||||
          fi
 | 
			
		||||
 | 
			
		||||
        elif [ "${crypto}" == "(ED25519)" ]; then
 | 
			
		||||
        elif [ "${crypto}" == "ED25519" ]; then
 | 
			
		||||
          valid=true
 | 
			
		||||
        fi
 | 
			
		||||
 | 
			
		||||
        if [ "$valid" = true ]; then
 | 
			
		||||
          echo "command=\"/usr/sbin/foodoor \$action \",no-port-forwarding,no-X11-forwarding,no-agent-forwarding $(cat ${keyfile} | sed 's/\r//g')" >> ${temp_outfile}
 | 
			
		||||
          echo "command=\"/usr/sbin/foodoor \$action \",no-port-forwarding,no-X11-forwarding,no-agent-forwarding $(cat ${keyfile} | sed 's/\r//g') ${keyfile}" >> ${temp_outfile}
 | 
			
		||||
        fi
 | 
			
		||||
      fi
 | 
			
		||||
    done
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user