OpenALPR Webhook Processor for IP Cameras

mindboggle

n3wb
Joined
Oct 31, 2022
Messages
3
Reaction score
1
Location
Virginia
Quick follow-up to my previous post. Since I don't like the idea of port forwarding, I decided to work around it by using a secure tunnel via Cloudflare. This is a free service that opens a tunnel to your local machine via a specified port. The only downside is that you need a domain name in Cloudflare, so that's around $10 a year. I already have a domain, so it's no big deal to me.

Once I created the tunnel, I added a WAF rule for the subdomain serving the tunnel to block any traffic without the token in the URL. Then I gave cloud.openalpr.com the webhook URL with the verification token, effectively making that service the only one that can access the tunnel. All other attempts to access the subdomain without the token are blocked.

To access the webhook processor locally, I continue to use my internal IP address. And since I already run a VPN on my devices, I can access that IP address wherever I need to.

At some point I may see if I can get cloud.openalpr.com running locally (it doesn't seem to work in Docker), but until then, I think this is a good security option.

Here are the steps I took. Thought it might be helpful to someone else out there.
  • Setup a Cloudflare account and associate a domain with it.
  • Install cloudflared: Downloads · Cloudflare Zero Trust docs
  • Setup a tunnel using this command:
    • cloudflared tunnel create your-tunnel-name
    • cloudflared tunnel route dns your-tunnel-name yoursubdomain.yourdomain.com
    • cloudflared tunnel run --url http://localhost:YOURPORT your-tunnel-name
      • Make sure you put in the port for your webhook processor server.
  • Run in background:
  • Check to make sure everything is running with this command “cloudflared tunnel info your-tunnel-name” or in the Cloudflare dashboard.
  • Next, go to your domain in Cloudflare and setup a WAF rule with this expression:
    • (http.host eq "yoursubdomain.yourdomain.com" and http.request.uri.query ne "verify=put_a_long_token_here”)
    • Have the action set to “Block”
  • Go to Login - OpenALPR by Rekor and change your webhook link to:
  • Now get something like Tailscale (Tailscale · Best VPN Service for Secure Networks) running. This will allow you to continue going to your localhost (via your internal IP) on any device running Tailscale without getting blocked.
  • Final step is to remove the port forwarding on your router.
 

brianegge

Pulling my weight
Joined
Apr 27, 2020
Messages
196
Reaction score
249
Location
Ridgefield, CT
Thank you. I've updated my container to the latest and it's running fine after changing my port to 8080.

I'm very happy with the project! I have a few questions...

1) Others have commented it would be helpful to have the images stored separately. I would like to keep my plates database on NVME, but move the images to SMR. Again, eventually we may want separate retention of the images, though I guess we can run a sqlite command once a year. If I have 14TB SMR and 1TB NVME, I would hope I could keep both for a long time.
2) The text overlay is great! I wish we could see something other than 'processing time' though. If it could be replaced with 'visits this week', it would be more useful. This of course depends on being able to run that sql query fast.
3) At night it usually can't determine the make / model, but it would be possible to look up in the DB to see if it has a match from a daytime plate. I know this can be done manually later of course.
 

tomas21

Getting the hang of it
Joined
Aug 12, 2014
Messages
143
Reaction score
21
What is the latest openalpr agent everyone is using.... ?
 
Last edited:
Top