Governments, often in the name of security or service delivery, are investing heavily in technologies that allow them to monitor what citizens say, do, and access online.