[Looking for Charlie's main web site?]

Programmatically accessing allowed IP Addresses in Developer Edition (and understanding the limits)

Have you ever needed to know programmatically what IP addresses, besides localhost, ARE allowed to access your Developer Edition of ColdFusion? I'll show you how here.

The message above does show the allowed IP addresses, but what if you need that list programmatically for any reason? Since I couldn't find it discussed anywhere, and I discovered the feature today, I just figured I'd share it in case it helps anyone searching in the future.

Along the way, I also explain for any who need to know, both what the "allowed IPs" limits are and how they've changed in 5, 6, and 7, as well as how to reset the allowed IP addresses.

Background

Most folks know that the Developer Edition of ColdFusion is intended for just local (as opposed to production) development. But to be specific, it's limited not JUST to requests from your localhost but both localhost and 1 other IP address (in CFMX 6 or 6.1), or localhost and 2 other IP addresses in CFMX 7.

Once that limit is reached, if you or anyone else tries to access a CF page from an IP address other than localhost or that 1 (in 6/6.1, or 2 in 7) permitted to that point, the user will get a message:

A License Exception has been thrown.

You tried to access the developer edition from a disallowed IP (nnn.nnn.nnn.nnn). The developer edition can only be accessed from 127.0.0.1 and two additional IP addresses. The additional IP addresses are: yyy.yyy.yyy.yyy,zzz.zzz.zzz.zzz

Of course, in a real message the nnn, yyy, and zzz would be real numbers, and in CFMX 6/6.1 it would list only "one additional IP address".

But the key point for the purpose of this blog entry is that the end of the message lists the IP address(es) that have "gotten in", such that any requests from other IP addresses will fail to run and will get the error message.

So it's sometimes useful to know the list of allowed IP addresses, but what if you need to access it programmatically? And how do you reset it to allow other IP addresses to get in?

Accessing that List of Allowed IP Addresses Programmatically

If you have need to know the list of allowed IP address(es) programmatically for any reason, the following code using the undocumented and unsupported ServiceFactory will show it:

<cfobject action="CREATE" type="JAVA" class="coldfusion.server.ServiceFactory" name="ServiceFactory">

<cfoutput>#ServiceFactory.LicenseService.getAllowedIp()#</cfoutput>

Unfortunately, there is no equaivalent to this in CF Admin API (in CF 7 or 8).

Resetting the Allowed IP Address(es)

Finally, some have wondered how they can reset the list of permitted IP addresses. Just as in CF5 (where you could access the developer edition from any 1 IP address, either localhost or another), in CFMX 6.1 and 7 you just need to restart the server. That will clear the list of allowed addresses.

In CFMX 6.0, however, you needed to actually edit a license.properties file while the server was stopped (as I blogged about back in 2002. Thankfully, that was fixed in 6.1.

For more information on that, as well as for a documented reference of the localhost/localhost+1 licensing in CF 4.5/5/6.0/6.1, see http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_17832.

For documented reference to the localhost+2 support in CF 7, see the bottom of the table at http://www.adobe.com/products/coldfusion/productinfo/product_editions/#s2.

Of course, the error message itself also clearly explains it in CFMX 6 and 7.

Comments
Thanks for posting this. I did not know the CF 7 allowed 2 ip addresses and how to reset the allowed IP addresses. Since the Developer Edition on my localhost is also my testing/preview box that is helpful. I often need my boss or others to look at something before I post it to our public webserver.

I do wish there was a way to reset the allowed IP addresses in CF 7 without having to restart the server. But since the Developer Edition is free, I can't complain too much.
# Posted By Bruce | 12/14/06 3:10 PM
Thanks. As for your hope, well, indeed the very reason they require a restart is that otherwise it would be too easy for one to abuse the "free license". It is a "developer" edition, not a "testing" edition. We really should be grateful (as I can tell you are) that they upped it to localhost+2.

Some may know that there was a "devnet" edition that one could subscribe to in the CFMX 6.1 timeframe. That program is no more, which may explain why they bumped up the +1 to +2. Still, this free edition is NOT that testing edition. Sure, many will complain that this is CF's achilles heel, that there ought to be an edition better suited to central testing (at a cost, if not free), and others will argue that there should be an entirely free edition for production use.

Let me just head that off here, should anyone feel motivated to respond, by saying that I DO NOT want this entry to become a place where that subject is debated. It's been covered (and surely will continue to be covered) in plenty of other places. Discussing it here will serve no value, so I'd ask it be refrained from. This is not directed at you, Bruce, but rather at those who might read your and my comments and feel motivated to press the subject. :-)
# Posted By Charlie Arehart | 12/14/06 3:31 PM
Ths worked perfectly. Thank you for posting this.
# Posted By John Cabrera | 1/3/10 9:47 AM
Happy to help. Always glad to hear when something may have, so thanks for sharing.
# Posted By Charlie Arehart | 1/4/10 6:16 PM
Is there any way to change the "allowed" ip addresses in CF8?
Thank you so much for your help.
# Posted By Jacques Guichard | 1/7/10 10:56 AM
Jacques, do you mean programmatically or in the Admin? In the Admin, there's a "debugging ip addresses" page to do it. And programmatically, at least since CF7 you can do it with the Admin API. Check out the CF docs (not the reference but the user guide or the Admin/config guide) for more on how to use the Admin API.
# Posted By charlie arehart | 1/7/10 4:49 PM
Can you use a dyndns.org domain name instead of an IP address?
in other words, how do you inform CF that the 2 IP addresses you wish to use for the 2 remote developers are Dynamic and ever-changing without constantly having to restart the service when they change. i want to use my dns name instead, is this possible?
# Posted By scott conklin | 1/25/10 11:32 AM
@Scott, the interface allows only IP addresses. You raise an interesting problem, and I would suggest you raise it as a feature request:

http://www.carehart....
# Posted By Charlie Arehart | 1/25/10 3:22 PM
Thanks
# Posted By Deep | 12/7/10 10:41 AM
BlogCFC was created by Raymond Camden. This blog is running version 5.005.

Managed Hosting Services provided by
Managed Dedicated Hosting