One of the Salyut stations had a external 57mm automatic cannon.
Apparently they even test fired it. Once. The retrorockets mounted on the station didn’t *quite* compensate for the recoil.
Actually it was a 23mm machine cannon much like what they had on their fighters. The Salyut craft were the equivalent of our cancelled Manned Orbiting Laboratory, which was supposed to be a manned reconnaissance platform (even had a Keyhole designation KH-10). So it clearly had a military mission.