You have not described what the "hack" was 😎 so all of this is educated guess.
If you don't have a specific knowledge, you should deploy︅ a solution proposed by @0xDEADBEEF - a Teleport.
Ofc, never expose critical service or infrastructure to public. We don't know if you used that VPS for internal needs or were simply hosting a public facing website.
If you used Ubuntu as Linux O/S that means that you can filter traffic properly with default policy DROP - not REJECT (higher CPU usage and notification to adversary) - for all chains and allow only specific ports with both packet state and source︀ and destination address filtering.
If you don't have a specific knowledge, you should deploy︅ a solution proposed by @0xDEADBEEF - a Teleport.
Ofc, never expose critical service or infrastructure to public. We don't know if you used that VPS for internal needs or were simply hosting a public facing website.
If you used Ubuntu as Linux O/S that means that you can filter traffic properly with default policy DROP - not REJECT (higher CPU usage and notification to adversary) - for all chains and allow only specific ports with both packet state and source︀ and destination address filtering.