find free city hosts
German railway stations do not like persons who sleep there ...
The German railway becomes more an more arrogant, want to be like airports and planes ... but do forget, that they are the medium of transport for normal people and young travellers.
I know that you can sleep in Scandinavia everywhere on public ground. So it is as well in Germany. There exists now law, but if you go on the country side, somewhere who nobody sees you, you will not have any problems (but pay attention with open fire and do not leave any trash there). But if you see that is private ground and no open meadow, it is better to ask somewhere before.