2

I have a honeypot running on AP so if anyone connects and try's to browse it will redirect to the root page. I am using dnsmasq to do this with the following entry

log-facility=/var/log/dnsmasq.log
address=/#/10.0.0.1
interface=wlan0
dhcp-range=10.0.0.10,10.0.0.250,12h
no-resolv
log-queries

This works fine if someone were to go to http://example.com but if they try http://example.com/somerandompage.html I get a 404 error or if they try https://example.com it just times out.

What would be the best method to redirect everything to http://serverip/index.html while still allowing http://serverip/someOtherPage?with=options.html with a preference for .htaccess solution.

3
  • "AP" == Apache?
    – MrWhite
    Commented May 26, 2016 at 9:00
  • 1
    Sorry, Access point
    – maxum
    Commented May 26, 2016 at 9:56
  • Any particular reason why you want to use .htaccess? You presumably have full control of your server? So, a server config solution would be preferable. What does dnsmasq do exactly? (Where does it sit in the network layer?) Just a bit surprised that if it's handling DNS then why it doesn't handle http://example.com/somerandompage.html at the same time as http://example.com?
    – MrWhite
    Commented May 26, 2016 at 10:12

1 Answer 1

1

if they try http://example.com/somerandompage.html I get a 404 error

To redirect all requests to example.com (non-HTTPS) back to the serverip/index.html in .htaccess (or perferably in your server config):

RewriteEngine On
RewriteCond %{HTTP_HOST} =example.com [NC]
RewriteRule ^ http://serverip/index.html [R=301,L]

This assumes your site is only accessible over example.com. If you also have the www subdomain then you would need to modify the condition to read:

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC]

This will also redirect http://example.com or does dnsmasq kick in before this?

if they try https://example.com it just times out.

You will only be able to resolve this by making your site accessible over HTTPS. ie. by installing a security certificate.

I have a honeypot...

If by "honeypot" you mean you are logging and blocking IPs/users that access the domain, then redirecting in .htaccess might skip this out (depending on when dnsmasq runs?). You could perhaps redirect to http://example.com instead?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.