AdobeStock_455007340

Manage Debugging IP Address Without CF Admin Access

Pre CFMX days, I wrote a CFX tag for adding and deleting debugging IP addresses without needing ColdFusion Administrator access. That tag simply manipulated the registry, and obviously it will not work with CFMX (which thankfully no longer uses the registry to store those settings). So, after some frustration yesterday and not being able to get to a ColdFusion Administrator when I needed to, I wrote a ColdFusion Component that allows you to list, add, and delete IP addresses from the debugging IP address list, without needing any access to the ColdFusion Administrator. Here is the code for debugip.cfc:


































































Usage is simple, to add your current IP address you could do the following:

Or use the CFC as an object:















Enjoy!

10 responses to “Manage Debugging IP Address Without CF Admin Access”

  1. Dave Carabetta Avatar
    Dave Carabetta

    You could replace your listGetAt chunk of IP validation code with the following RegEx to clean it up a bit:
    (([0-1]?[0-9]{1,2}.)|(2[0-4][0-9].)|(25[0-5].)){3}(([0-1]?[0-9]{1,2})|(2[0-4][0-9])|(25[0-5]))
    Validate against the above pattern and you should be good to go.

  2. Ben Forta Avatar
    Ben Forta

    Dave, not so simple. CF has no REMatch() function, REFind() will return a match if the IP address is in the middle of the string, and so even using that RE you’d need to do additional processing. And so, in the interest of not having to explain what the funky processing is and why, I did it this way.

  3. Ben Forta Avatar
    Ben Forta

    Ok, you convinced me, I changed it. 🙂

  4. Paul Kenney Avatar
    Paul Kenney

    Do you think that you could submit this to CFCZone? It would be a nice addition.

  5. seancorfield Avatar
    seancorfield

    Why not anchor the RE with ^ at the beginning and $ at the end so it matches the entire string? Or am I missing something?

  6. Ben Forta Avatar
    Ben Forta

    Paul, I’ve already sent it to Rob to include on CFCZone.
    Sean, yep, that’s a duh! one, changed it. Honestly, I was not paying much attention that part of the code, that validation was an afterthought and just thrown in, the key was the core functionality. And I am working on another one, this time working with datasources.

  7. john b Avatar
    john b

    how do you do the cool colour coding? surely not manually?

  8. Tom Forrest Avatar
    Tom Forrest

    Could this be expanded to manage the list on a multipule instance CFMX setup? So that it would update/change/modify all instances at the same time?

  9. Jeff Avatar
    Jeff

    What code would do this for CF 4.5?

  10. Jeff Avatar
    Jeff

    By "this," I meant manage debug IP addresses.

Leave a Reply