GeoIP Locking Module

Hello,

I succeed to compile tipetric’s geoip module and every thing works fine, thank you.

Is it possible to make it run with Cupertino live stream? I’m not a java specialist specialist but I can read some code.

Thank you in advance for your help.

Pierre

Thank you very much shamrock for you help.

I works fine for Cupertino now.

The redirection could be added for restrictive access.

Pierre

Below the code added to tipetric’one.

public void onHTTPCupertinoStreamingSessionCreate(HTTPStreamerSessionCupertino httpCupertinoStreamingSession)
{
	String ClientIP = httpCupertinoStreamingSession.getIpAddress();
	String streamName = httpCupertinoStreamingSession.getStreamName();
	
	String[] streamNameSplit = streamName.split(":");
	String realStreamName = streamNameSplit.length==1 ? streamNameSplit[0] : streamNameSplit[1];
	logDebug("Real stream name "+realStreamName);
	logDebug("IP source "+ClientIP);
	
	if (!allowPlayback(realStreamName, ClientIP)) {
		httpCupertinoStreamingSession.rejectSession();
		}
	
}

Hi Guys,

My Wowza version: Wowza Media Server 2 Perpetual 2.2.4.01 build27503

I wanted to use Geoip Module to allow access to limited countries i did this

1- Copy geoip to lib

2- Create new folders called go in both conf& Application folders

3- Configure Application.XML for live stream

4- Copy GeoIP.dat to C:\

5- Ceate locationinfo.xml

6 - Added the follwoing properties to Application.xml

Problem: Streaming Playbalk working only for DE while i make exception for 5 countries, it seems the module doesn’t read the locationinfo.xml file

What I am missing here?

[HTML]

geoip

GeoIP

com.monotek.wms.module.GeoIP

[/HTML]

[HTML]<!-- GeolocationDefaultRestrict: 0 = don’t restrict by default, 1 = restrict by default

–>

GeolocationDefaultRestrict

1

Integer

GeolocationDefaultRestrictCountry

DE

String

GeolocationPlaybackShutdown

True

Boolean

GeolocationConfigFile

>c:\locationinfo.xml

String

GeolocationDebug

true

Boolean

GeoIPDatabase

c:\GeoIP.dat

String

[/HTML]

LocationInfo.xml

[HTML] <?xml version="1.0" encoding="utf-8" ?>

US

SI

MA

CA

EG

[/HTML]

Thanks!

I’ve been testing this for some days, but I can’t get it to work.

I’ve downloaded the .jar from github and copied it into wowza/lib folder, added the following to conf/live/Application.xml

			<Module>
				<Name>geoip</Name>
				<Description>GeoIP</Description>
				<Class>com.monotek.wms.module.GeoIP</Class>
			</Module>
...
			<Property>
				<Name>GeolocationDefaultRestrict</Name>
				<Value>1</Value>
				<Type>Integer</Type>
			</Property>
			<Property>
				<Name>GeolocationDefaultRestrictCountry</Name>
				<Value>DK</Value>
				<Type>String</Type>
			</Property>
			<Property>
				<Name>GeolocationConfigFile</Name>
				<Value>>c:/locationinfo.xml</Value>
				<Type>String</Type>
			</Property>
			<Property>
				<Name>GeolocationPlaybackShutdown</Name>
				<Value>True</Value>
				<Type>Boolean</Type>
			</Property>
			<Property>
				<Name>GeoIPDatabase</Name>
				<Value>c:/GeoIP.dat</Value>
				<Type>String</Type>
			</Property>

and in the locationinfo.xml file

<?xml version="1.0" encoding="utf-8"?>
<LocationInfo>
	<Locatfion path="live/" restrict="all">
		<Except type="country">DK</Except>
	</Location>
	<Locatfion path="mobile/" restrict="all">
		<Except type="country">DK</Except>
	</Location>
	<Locatfion path="live" restrict="all">
		<Except type="country">DK</Except>
	</Location>
	<Locatfion path="mobile" restrict="all">
		<Except type="country">DK</Except>
	</Location>
</LocationInfo>

Encoder

address: rtmp://10.100.1.5:1935/live

stream name: mobile

I’ve tried changing all settings, but i still don’t get blocked and even compiled it myself from source code.

I’ve also tried doing it as described in https://www.wowza.com/docs/how-to-enable-geographic-locking-modulegeoiplock, it compiles without error, but doesn’t run in wowza.

Logfile:

comment	server	INFO	200	-	geoip.onAppStart: live/_definst_	-	-	-	18.297
comment	server	INFO	200	-	geoip.onAppStart: Property GeolocationConfigFile: >c:/locationinfo.xml	-	-	-	18.313
comment	server	INFO	200	-	geoip.onAppStart: Property GeolocationConfigFile: >c:/locationinfo.xml	-	-	-	18.344

Logfile(running debug)

comment	server	DEBUG	200	-	load module: name:geoip class:com.monotek.wms.module.GeoIP	-	-	-	16.157
comment	server	DEBUG	200	-	  add method (event): onAppStart	-	-	-	16.188
comment	server	DEBUG	200	-	  skip method (InvalidParameterCount): allowPlayback	-	-	-	16.219
comment	server	DEBUG	200	-	  add method (method): play	-	-	-	16.235
comment	server	DEBUG	200	-	  method: OPTIONS	-	-	-	16.25
comment	server	DEBUG	200	-	  context: rtsp://10.100.1.5/live/mobile	-	-	-	16.282
comment	server	DEBUG	200	-	  protocol: RTSP/1.0	-	-	-	16.297
comment	server	DEBUG	200	-	  cseq: 468	-	-	-	16.313
comment	server	DEBUG	200	-	  user-agent: LibVLC/1.1.0 (LIVE555 Streaming Media v2010.03.16)	-	-	-	16.329

Those are the only things i can find in log, containing “geoip”.

Any suggestions?

Hi,

have configured all as suggested but still not working. if GeolocationDefaultRestrict is set to “0” then stream plays irrespective of locotioninfo.xml settings, if given “1” redirects to default Extremists.m4v

<Property>
				<Name>GeolocationDefaultRestrict</Name>
				<Value>0</Value>
				<Type>Integer</Type>
			</Property>
			<!-- If GeolocationDefaultRestrict = 1, and xml config is missing/invalid, restrict to this country -->
			<Property>
				<Name>GeolocationDefaultRestrictCountry</Name>
				<Value>IN</Value>
				<Type>String</Type>
			</Property>
			
			<Property>
				<Name>GeolocationConfigFile</Name>
				<Value>>${com.wowza.wms.context.VHostConfigHome}/conf/${com.wowza.wms.context.Application}/locationinfo.xml</Value>
				<Type>String</Type>
			</Property>
			
			<Property>
				<Name>GeolocationPlaybackShutdown</Name>
				<Value>False</Value>
				<Type>Boolean</Type>
			</Property>
			<Property>
				<Name>GeolocationPlaybackFile</Name>
				<Value>mp4:def/Extremists.m4v</Value>
				<Type>String</Type>
			</Property>
			
			<Property>
				<Name>GeolocationDebug</Name>
				<Value>true</Value>
				<Type>Boolean</Type>
			</Property>
			<Property>
				<Name>GeoIPDatabase</Name>
				<Value>/usr/share/GeoIP/GeoIP.dat</Value>
				<Type>String</Type>
			</Property>

Locationinfo xml file

<LocationInfo>
	<Location path="teststream" restrict="none">
		<Except type="country">US</Except>
	</Location>
</LocationInfo>

am using the jar file uploaded into the lib folder.

wowza media server 2 for amazon Ec2 2.2.4 build 27452

Hi jonny,

You’ll probably have to modify the code to add that feature. Note that user “titpetric” made a fork available in the second post in this thread. I see it was updated just 7 months ago.

I’m using windows with wowza copied wowza-geoip files to c:…\lib directory.

When using this module I can see in logs “geoip.debug: GEO2 NOT Restricting playback.” and nothing is blocked.

Why? Can someone help to solve problem? What is correct way to install this module on windows server?

Finally got plugin working and blocking access to stream. One thing only left there is option to rewrite stream with video clip, but something is wrong and flowplayer is showing error " 200…stream not found". Why wowza is not rewriting stream or problem is in different part?

application.xml

<!--
				GeolocationPlaybackFile
				The parameter should provide a clip or stream which tells the user
				via video, why he can't access some of the sites content.
				Only used if GeolocationPlaybackShutdown is set to false.
			-->
			<Property>
				<Name>GeolocationPlaybackFile</Name>
				<Value>labaca.flv</Value>
				<Type>String</Type>
			</Property>

wowza access log

create	stream	INFO	200	-	-	_defaultVHost_	live	_definst_	0.0	[any]	1935	rtmp://178.16.16.214/live	67.21.3.53	rtmp	http://i2.veritweet.com/video/flowplayer/flowplayer.commercial-3.2.7.swf	WIN 10,3,181,26	75239959	3496	3413	1	0	0	0	-	-	-	-	-	-	rtmp://178.16.16.214/live	rtmp://178.16.16.214/live	-	rtmp://178.16.16.214/live	-
2011-08-10	10:48:06	EEST	comment	server	INFO	200	-	geoip.debug: Checking stream: stream / IP: 67.21.3.53	-	-	-	85.831	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2011-08-10	10:48:06	EEST	comment	server	INFO	200	-	geoip.debug: GEO2 RESTRICTING playback.	-	-	-	85.831	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2011-08-10	10:48:06	EEST	comment	server	INFO	200	-	geoip.debug: play - rewriting stream to labaca.flv	-	-	-	85.831	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2011-08-10	10:48:10	EEST	destroy	stream	INFO	200	labaca.flv	-	_defaultVHost_	live	_definst_	4.134	[any]	1935	rtmp://178.16.16.214/live	67.21.3.53	rtmp	http://i2.veritweet.com/video/flowplayer/flowplayer.commercial-3.2.7.swf	WIN 10,3,181,26	75239959	3616	3646	1	-	0	0	labaca.flv	-	-	-	-	-	rtmp://178.16.16.214/live/labaca.flv	rtmp://178.16.16.214/live/labaca.flv	-	rtmp://178.16.16.214/live	-
2011-08-10	10:48:10	EEST	disconnect	session	INFO	200	75239959	-	_defaultVHost_	live	_definst_	4.82	[any]	1935	rtmp://178.16.16.214/live	67.21.3.53	rtmp	http://i2.veritweet.com/video/flowplayer/flowplayer.commercial-3.2.7.swf	WIN 10,3,181,26	75239959	3616	3646	-	-	-	-	-	-	-	-	-	-	-	-	-	rtmp://178.16.16.214/live	-
2011-08-10	10:48:14	EEST	comment	server	INFO	200	-	LiveStreamPacketizerSanJose.endChunkTS[live/_definst_/stream]: Add chunk: id:9 a/v/k:394/258/2 duration:10279	-	-	-	93.647	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-	-
2011-08-10	10:48:14	EEST	comment	server	INFO	200	-

Thank you :slight_smile: That’s works perfect!

Hi,

since i have a large number of files that i have to block and i don’t want wowza to parse a large xml, i was wondering is there an option to have a single xml file for each video located in same dir as video?

Thank you in advance for your help.

jonny

Hi again!

Now that i have got over initial problems with module, i have spent some time to analyse it, and came up with a problem.

So the question is can i get stream name for vod onAppStart?

If yes, due to my juniority in wowza, i wouldn’t mind some guiding :).

Tanks again for your help.

Best regards.

jonny