This file is indexed.

/usr/share/doc/pyro/examples/NS_sec_plugins/NSSecEx.py is in pyro-examples 1:3.14-1.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python

# 
#  Example of Name Server security plugins.
#
#  This shows possible implementations of a NS BC request validator
#  and a NS new connection validator.
#
#  See the Readme.txt for more information.
#


ACCEPTED_ID = 'p4ssphr4se'

#----- required global funcs that return validator objects ------
def BCGuard():
	return BCReqValidator()

def NSGuard():
	v=NSnewConnValidator()
	v.setAllowedIdentifications([ACCEPTED_ID])
	return v


#----- validator object implementation --------

import Pyro.naming
import Pyro.protocol

# NS Broadcast Request Validator
# Must inherit from the base class as shown,
# because dispatcher code is in there.
class BCReqValidator(Pyro.naming.BCReqValidator):
	# we have:
	# self.addr = address of client (ip, port)
	# self.sock = reply socket (used by self.reply method)
	def acceptLocationCmd(self):
		print self.addr[0],'WANTS TO KNOW OUR LOCATION. Ok...'
		return 1
	def acceptShutdownCmd(self):
		print self.addr[0],'WANTS US TO SHUT DOWN, Pfff!'
		self.reply('denied!')  # send this back to client
		return 0

		
# NS Pyro Daemon newConnValidator
class NSnewConnValidator(Pyro.protocol.DefaultConnValidator):
	def acceptHost(self, tcpserver, conn):
		print conn.addr[0],'WANTS CONNECTION...'
		return Pyro.protocol.DefaultConnValidator.acceptHost(self, tcpserver, conn)
	def acceptIdentification(self, tcpserver, conn, token, challenge):
		print conn.addr[0],'SENDS IDENTIFICATION...'
		(ok,reason)=Pyro.protocol.DefaultConnValidator.acceptIdentification(self, tcpserver, conn, token, challenge)
		if not ok:
			print 'Connection denied!  Make sure the identification is "'+ACCEPTED_ID+'"'
		return (ok,reason)