Governments rely on a variety of forms of coercion to aggregate distributed information relevant to governmental objectives --from the prosecution of regime stability threats to terrorism or epidemics--. To do so, they exploit the existing social structure, as reliable information will often come from friends and acquaintances. Civil liberties, in turn, restrict the government's ability to exercise such coercion. We present an equilibrium theory of the joint determination of social structure and civil liberties. The depth of civil liberties shapes citizens' decisions on how intensely and with whom to socialize. Features of the social structure such as its cohesiveness and the extent of segregation, in turn, shape the government's willingness to enforce civil liberties protections such as search and seizure restrictions, standards of proof, and equal treatment under the law. We show that the relationship between civil liberties and social structure is mediated by a commitment problem by the government, and that this commitment problem is in turn mediated by the strength of civil society. We also show that segregation and unequal treatment sustain each other, characterize when unequal treatment against a minority or a majority can be sustained, and how equilibrium social cohesiveness and civil liberties respond to the arrival of widespread surveillance technologies, shocks to collective perceptions about the likelihood of threats or the importance of privacy, or to community norms such as codes of silence.