  The problem of deforming geometries is particularly important in the context
of constructing new exact solutions of Einstein's equation. This issue often
appears when extensions of the general relativity are treated, for instance in
brane world scenarios. In this paper we investigate spacetimes in which the
energy-momentum tensor obeys a linear constraint. Extensions of the usual
vacuum and electrovacuum solutions of general relativity are derived and an
exact solution is presented. The classes of geometries obtained include a wide
variety of compact objects, among them black holes and wormholes. The general
metric derived in this work generalizes several solutions already published in
the literature. Perturbations around the exact solution are also considered.
