There are two Moshiach’s; Moshiach ben Dovid and Moshiach ben Yosef. Both have something in common. Rashi says that thanking Hashem makes you close to Him. This is Shevet “Yehuda” which means “Hoda'ah”. And Yosef was known for Kedusha, and when you have Pritzus, it says: וְׁשָב מֵאַחֲרֶיךָ Hashem goes away from you. If you are careful in Inyanei Kedusha and Shmiras Einayim, then you are close to Hashem. And the last Mishna in Sotah says about the days before Moshiach: אֵין לָּנוּ לִ יׁשָּ עֵ ן אֶ לָּא עַל אָּ בִ ינּו ׁשֶ בַ שָּ מַ יִם we have no one on whom to rely other than our loving Father in Heaven. We see how these days we try to get extra close to Hashem, like the Chofetz Chaim said that in Ik'visa Dim'shicha you have to be especially involved in Bitachon.
