A simple atmosphere will protect you from flares. I think even Mars's very thin atmosphere would be enough to save you.
I brought up a planet only for the fact that you would need something really really big to block all cosmic rays. I did not mean to imply it was necessary. People on Earth are hit from cosmic rays from "above" as part of our background radiation.
Atmospheres help but only somewhat. The radiation exposure on Mars' surface is still much, much higher than on the surface of Earth, enough to warrant taking extra precautions to lessen exposure (such as placing regolith filled sand bags on top of habitats).
Also, to be precise people aren't hit by primary cosmic rays on Earth but by secondary cosmic rays, the particle debris from high energy protons and nuclei colliding with atoms in the upper atmosphere.
I brought up a planet only for the fact that you would need something really really big to block all cosmic rays. I did not mean to imply it was necessary. People on Earth are hit from cosmic rays from "above" as part of our background radiation.