Perhaps I can say that finitely generated modules for which 
$$R \to \mathrm{Hom}_R(M, M) \;\;\;\text{is an isomorphism, where $1 \mapsto id$}$$
and 
$$\mathrm{Ext}^i_R(M,M) = 0 \;\;\;\text{ for $i > 0$}$$
are called *semi-dualizing modules* (if they are in $D^b_{coh}(R)$, they are called *semi-dualizing complexes*).  
This can be more compactly written as 
$$R \to {\bf R}\mathrm{Hom}_R(M, M)$$
is an isomorphism.
The point is that $M$ would be a dualizing/canonical module (respectively complex) if it had finite injective dimension.

There's actually a lot of work on identifying semi-dualizing modules/complexes, and they are relatively rare.  For a Gorenstein local ring $R$, the *only* semi-dualizing module is $R$ itself up to isomorphism (in fact, the only semi-dualizing complex is $R$ up to shift).  See Corollary 8.6 in 
[Christensen, Semi-dualizing complexes and their Auslander categories][1].  For a Gorenstein variety, it follows that the only semi-dualizing modules are line bundles.

If you weaken the condition of Gorenstein to Cohen-Macaulay, then there can be more.  If I recall correctly, there are still only finitely many, and there's an even number (see [Christensen-Wagstaff][2]).  In fact, unless things have changed in the past few years, no one knows an example where the number of semi-dualizing modules/complexes is not $2^n$ for some $n$.  

I also found this somewhat older survey of semi-dualizing modules by Sather-Wagstaff:
[Semidualizing modules][3].


  [1]: https://www.ams.org/journals/tran/2001-353-05/S0002-9947-01-02627-7/S0002-9947-01-02627-7.pdf
  [2]: https://arxiv.org/abs/0704.2734
  [3]: https://ssather.people.clemson.edu/DOCS/sdm.pdf