A standard method of preventing replay attacks is to use a static list of sequences that is shared between client and server. When the state of this list gets reset, you're susceptible to replay attacks. This method generates the next random sequence on the fly and synchronizes the client and server over a secure channel, effectively preventing the possibility of a replay attack.
It utilizes a modified version of Judd Vinet's knockd and some shell scripts to accommodate the ratchet. I've had some individuals review the control flow and I've been told it's sound... I'll push it to github.com/StevenPolley in the coming days.