A) In this case I suppose you are allowed to ask only yes-or-no questions.
In this case 2 questions allows you to chose only between 2x2=4 options, so you need at least 3 questions.
It is very easy to formulate them. Just ask each time "What would you answer if I ask you blabla" and you will know the truth about blabla. Let's use WWYA shortcut for all these words. Then 3 questions you will need to ask:
1. WWYA is a freedom-door among first 4?
2. WWYA is a freedom-door among 1 and 2? (or just go to the 5th, if you've just got No)
3. WWYA is a freedom-door the 1st? (or "the 3rd", if you've just got No)
B) It is much more interesting to find a question when you are allowed to ask any questions. You can not ask "What you would answer if you are asked, which door leads to freedom?", since liar would answer the wrong door number and then it would lie about this number, but here he can use another wrong number, fortunately for him he has 3 more bad doors left.
But I think "What you can not answer because of your nature when you are asked, which door leads to hazards?" will do the job. To "Which door leads to hazards?" liar must answer the freedom-door. Then to "What you can not answer ...?" he would have the only one wrong answer to tell: the freedom-door. Meanwhile truthteller can answer to "Which door leads to hazards?" any door out of 4 bad-doors, therefore to "What you can not answer ...?" truthteller have also only one answer possible: the freedom-door.