What is the meaning of [Sail close to the wind]

To act just within the limits of what’s legal or socially acceptable, to push boundaries. “They fired their accountant because he sailed too close to the wind.”