I always salute any officer I recognize even if they are in civilian clothing, or if I am in civilians and they are in uniform (gotta keep my bases covered

). I do not know if it is SOP elsewhere, or if it is just left as a matter of courtesy.
There are also "safe" zones where saluting is not required, such as the Pentagon courtyard (I believe covers are also optional there), which is the largest such zone. Here we have a no-salute zone going out 15 meters from the officers' offices, outside, since there is so much brass traffic in that area.