It's not easy to do the right thing.
The subject is the dummy pronoun "it".
This is called an extraposed construction; one where the subject of the 'basic' version is extraposed to the end of the sentence, outside the verb phrase, and replaced by the semantically empty "it".
The basic non-extraposed version would be
[To do the right thing] is not easy, where the subject is the bracketed infinitival clause.
Evidence that "it" is the subject is provided by these facts:
(1) it inverts with the verb to form an interrogative: Is it not easy to do the right thing?.
(2) it occurs as the subject of an interrogative tag: It's not easy to do the right thing, is it? Only pronouns are admissible in such tags, and the subject of the 'anchor' normally becomes the subject of the tag.