He had back channel talks going with kruschev and Castro and the cia was monitoring both talks. He wanted peace and he received bullets for it.
He had in the end more in common with his enemies in working toward peace than he did at home with the cia and pentagon plotting against his every move.
His foreign policy especially with regard to Indonesia, Africa and the Middle East has been buried because once you see it and read the transcripts and interviews it becomes clear why he was killed.
OTOH, he kept a deliberate somewhat hawkish public stance because he wanted to win re-election and move fast out of Vietnam etc then.
And he also was well aware he was in serious trouble with the cia and military. His public comments were partly for cover. If you check out the books I think you may agree