I can answer your question in regards to Cuba. All of this information comes from my research in the JFK assassination records. Castro and the Cuban regime were dismayed when they found out about JFK's assassination. At the time, JFK and Castro had been negotiating through back channels in an effort to possibly normalize relations. When JFK died, the hopes for normal relations died as well. LBJ did not want to appear soft on communism and stopped the negotiations. Some said he even thought that Oswald was some how a Cuban agent and that the assassination was ordered by Castro.
The Soviet leadership got a mix of paranoid and distressed as they thought there was a right-wing coup against Kennedy or that they would be in some ways blamed.
A source who has furnished reliable information in the past and who was in Russia on the date of the assassination of the late President John F. Kennedy advised on December 4, 1963, that the news of the assassination of President Kennedy was flashed to the Soviet people almost immediately after its occurrence. It was greeted by great shock and consternation and church bells were tolled in the memory of President Kennedy.
According to our source, officials of the Communist Party of the Soviet Union believed there was some well-organized conspiracy on the part of the “ultraright” in the United States to effect a “coup.” They seemed convinced that the assassination was not the deed of one man, but that it rose out of a carefully planned campaign in which several people played a part. They felt those elements interested in utilizing the assassination and playing on anticommunist sentiments in the United States would then utilize this act to stop negotiations with the Soviet Union, attack Cuba and thereafter spread the war. As a result of these feelings, the Soviet Union immediately went into a state of national alert.
Our source further stated that Soviet officials were fearful that without leadership, some irresponsible general in the United States might launch a missile at the Soviet Union. It was the further opinion of the Soviet officials that only maniacs would think that the “left” forces in the United States, as represented by the Communist Party, USA, would assassinate President Kennedy, especially in view of the abuse the Communist Party, USA, has taken from the “ultraleft” as a result of its support of peaceful coexistence and disarmament policies of the Kennedy administration.