Wanted to see if anyone had a recommendation for a script to update an .htaccess file with your current IP address.
I am looking to keep some admin bits a little more restricted over the web, and would prefer script kiddies not to just bash at usernames and passwords.
Allow from yourhomeip in format 123.456.789.012
Allow from yourwebserverip in format 123.456.789.012
Allow from is a great tool, but it is built with (gee) security in mind. Since it does a forward and a reverse lookup, your dyndns.org assigned name, such as myhomemachine.dyndns.org will generally never resolve back successfully, since apache will look that up, map it to 22.214.171.124, then nslookup 126.96.36.199 and see that it resolves to myuberfiberconnection.blastthenet.com - then apache says “nope!”
Now that search engines can hit this DH forum topic (grin) I’m looking for a script, cron’able every 5 mins or so, that’s low resource. Would love to have a file with .htaccess locations, perhaps like
etc. that could be read. Am picturing the script reading locations, and replacing things from those specified files.
Maybe via section blocks such as
my allowed dynamic IP start
my allowed dynamic IP end
and it being fair game to replace anything between those.
I’m not sure how the script would store the state of the last lookup for myhomemachine.dyndns.org but I’m visioning a simple flat file in the root directory.
Ideally, the script would just run via cron, check if the nslookup is the same as it was 5 minutes ago. Since the very likely answer is “yes”, die there, and take no more cpu.
But if it has changed, go replace in the specified htaccess files the old ip of 188.8.131.52 with the new ip of 184.108.40.206, and write out the rest of the .htaccess file as it was.
I know that’s a lot to ask, which is why I’m asking if someone has already done something similar. My google fu was remarkably blank on this, other than seeing requests for something like this
TIA for any pointers . . .
responses to this thread will be emailed to me, thanks.