Yes. Castling rules only restrict the king — it can't be in check, pass through an attacked square, or land on one. The rook has no such limits: you may castle even if the rook is under attack, and when castling queenside the rook is allowed to pass over an attacked square (b1/b8).