craigmcd,
There are 4 drain tubes to the dual sunroof, one at each front and rear corner. The sunroofs will leak water into the headliner if the drain tubes are plugged at the roof or at the bottom where the tubes drain, or if the drain tubes themselves split where they attach to the roof channels at the corners. If the tubes have split, then the headliner must come down to replace them (not a hard job, just very time consuming, and not worth the $1000 the dealership will want to do the fix.)
From the top of the car with the sunroofs open, the first solution is to clean the drain tubes at the end of the sun roof channels using an extended air gun and compressed air. One could also use a reasonably stiff wire to push through the dirt plug at the drain tubes' entrance.
The front drain tubes exit the bottom of the car between the front fender and the car's body, just in front of the door. Usually they can't be seen unless the front fenders are removed. The rear sunroof drain tubes drain exit behind the rear wheels through the side of the car body. When the rear bumper cover is removed you can see them.
As for the tailgate rear lens water leak, pull all of the interior plastic panels of the tailgate to gain access to the tail light mounting bolt nuts (You'll need a 10 mm deep socket on those nuts.) Once the nuts are removed wiggle and pry the lens assembly from the tailgate (you might even have to cut the seal to get it to separate.). Once you have the water removed from the lens assembly (hairdrier), either buy a new seal, make your own from automotive dumdum or plumber's putty.
Dumdum comes in 12 inch long string sections (like the very thin red licorice). use 3 or 4 sections and rub it between your palms to make a 3/8 's inch single roll and lay it around the lens mating surface (or do the same with plumber's putty). once stuck to the lens, push it back onto the tailgate and press firmly to get the lens to the same level as your other lens assembly on the other side, and reinstall the parts back on the car.
Yes, I have had to fix both issues on subies over the years.
Good Luck!