I used to build shocks and leaking is THE problem. What i used to do was put non-hardening Permatex on the cover threads and let the shock sit for a few days before filling. BTW, I cleaned the shock and cover with denatured alcohol before applying Permatex. I usually worked ok......but not always!
Also, my above is when a shock is off the car, clean, etc. Stopping one leaking on the car would be likely impossible IMHO.
On most show car shocks, I greased them up inside with chassis lube and told the owner not to fill them until they are thru showing them!!