I have been trying for more than 20 years now to figure out why anyone would buy a house (or home of any sort) with a HOA or pretty much any restrictive covenant. A friend of mine once showed me the binder, a huge 5" (largest you can get) 3-ring binder stuffed to overflowing, that was the contract he agreed to when he bought his house. "Did you read this?" "No...."
The answer is that covenants (and by extension homeowner's association rules) are not laws and they can (you could argue that they always) restrict otherwise legal activities. It is legal to paint your house fuchsia. It is just a violation of your agreement with the sellers of your home (and by extension with the HOA) to do so. The HOA cannot arrest you for painting your house fuchsia, but they can make your life miserable. Same for guns if they want to go that route. They can't arrest you but they can take your house and cost you a lot of money.
The scope of covenants (and by extension HOAs) is limited in two ways.
1) Does the contract violate state/federal police powers?
2) Can a court enforce the contract?
Police powers are what give you zoning laws, FCC regulations, environmental protections, etc.. If your homeowner's association demands that you do something that goes against building code, FCC regs, or the like that requirement is unenforceable
but they can make your life miserable anyway.
The other side should seal it. Courts can't enforce a contract if the result would be a violation of the constitution. The area this has played out for the good in the lifetimes of some people on this list is in racist covenants. Hard to believe today but at one point people actually tried to write into a covenant that the new owner of a property couldn't sell to anyone of a different race. The courts took one look at that and said "we can't enforce this, it would violate the 14th!" Of course, that's what should happen with an anti-2A covenant. "We can't enforce this, it would violate the 2nd!"
Of course, since we've accepted "reasonable restrictions" to our rights instead of accepting the consequences of exercising our rights (in other words, we accept that we can't yell "fire" in a crowded theater instead of saying we can yell fire anywhere we want and if people are injured as a direct result those injuries are our responsibility), don't count on that.