Different government departments will do it differently. Everything is done with the person's consent. There are privacy issues here. There's also the fact that a lot of what you might find out about someone on the Internet is in fact completely false. There are controls in place to make sure that when a department gathers information about an individual specifically for an Internet inquiry, they bring that back to the individual, if it's potentially security relevant, to ask, “Is this actually you?”, and verify that the information is in fact accurate.
