I assume you're asking about an IMC flight solely in Class G airspace. It's legal. You must comply with all applicable FARs. Compliance is not possible where controlled airspace begins at 1200' AGL or lower due to FARs 91.177 and 91.179. Even then you must have VMC before descending below...