After dark, not in a safe marina,
companionway shut and latched from inside, Mossberg
pump or loaded pistol within hand's reach. Then enjoy the evening. Keeping a firearm ready in case it is needed is not a big deal once you are used to it. I keep a loaded pistol close to me covered with a hand towel on a table or counter top. I know it's there, I know how to use it and I tell guests not to pick up that towel because there's a pistol under it. Yes, it's something to keep an eye on and you need to be responsible about it, but it's a lot easier to sleep at night knowing it's there.
Panama and Costa Rica are pretty good about permits for weapons. I believe
Panama is looking them closer now after an incident involving firearms used by some Guatemalans last year. They were talking about not issuing more permits to foreigners, but I'm not sure if they ever changed their procedure.
Not to get into the gun argument please. I read a blog written by a trans-navigator who was approached by a skiff in a pirate area. The occupants motioned for him to invite them aboard for a drink and reached to grab onto his boat to pull themselves alongside. He shook his
head and raised his
pump shotgun, motioning them away. They then returned to the larger sailing craft which had been towing the skiff and shadowed him for some time. Finally, they decided to look for easier pray and left. He said that anyone cruising the open sea without a weapon is crazy and quoted a Freighter
Captain a saying that anyone who approaches your vessel at sea is your enemy. Not sure I agree with all that strictly, but worthy of consideration as the source had actually had a close encounter.
Again, it's a question of where you are at and weighing the risks.