def authenticate(self, auth, stored_password): remote_addr = flask.request.remote_addr if pwhash(auth.username, self.realm, auth.password) == stored_password: self.printdebug("Basic Authentication challenge passed by " + remote_addr + " for " + auth.username) return True else: self.printdebug("Basic Authentication challenge *FAILED* by " + remote_addr + " for " + auth.username) return False
def authenticate(self, auth, stored_password): remote_addr = flask.request.remote_addr if auth.username is None or self.realm is None or auth.password is None: self.printdebug("Basic Authentication challenge *FAILED* for " + auth.username + " due to missing credentials") return False elif pwhash(auth.username, self.realm, auth.password) == stored_password: self.printdebug("Basic Authentication challenge passed by " + remote_addr + " for " + auth.username) return True else: self.printdebug("Basic Authentication challenge *FAILED* by " + remote_addr + " for " + auth.username) return False
#Optionally, you can force the full URL CLAM has to use, rather than rely on any autodetected measures: #FORCEURL = "http://myclamservice.com" #The location of where CLAM is installed (will be determined automatically if not set) #CLAMDIR = "/path/to/clam" # ======== AUTHENTICATION & SECURITY =========== #Users and passwords #set security realm, a required component for hashing passwords (will default to SYSTEM_ID if not set) #REALM = SYSTEM_ID #Users and passwords USERS = { 'proycon': pwhash('proycon', SYSTEM_ID, 'secret'), 'antal': pwhash('antal', SYSTEM_ID, 'secret') } ADMINS = None #List of usernames that are administrator and can access the administrative web-interface (on URL /admin/) #If you want to enable user-based security, you can define a dictionary #of users and (hashed) passwords here. The actual authentication will proceed #as HTTP Digest Authentication. Although being a convenient shortcut, #using pwhash and plaintext password in this code is not secure!! #USERS = { user1': '4f8dh8337e2a5a83734b','user2': pwhash('username', REALM, 'secret') } #Amount of free memory required prior to starting a new process (in MB!), Free Memory + Cached (without swap!). Set to 0 to disable this check (not recommended) REQUIREMEMORY = 10
'user': '******', 'password': D(open(os.environ['CLAMOPENER_KEYFILE']).read().strip()), 'database': 'clamopener', 'table': 'clamusers_clamusers' } DEBUG = False REALM = "WEBSERVICES-LST" DIGESTOPAQUE = open(os.environ['CLAM_DIGESTOPAQUEFILE']).read().strip() SECRET_KEY = open(os.environ['CLAM_SECRETKEYFILE']).read().strip() ADMINS = ['proycon','antalb','wstoop'] elif host == 'galactica' or host == 'roma': #proycon's laptop/server CLAMDIR = "/home/proycon/work/clam" ROOT = "/home/proycon/work/foliastats.clam/" PORT = 9001 BINDIR = "/usr/local/bin/" USERS = { 'proycon': pwhash('proycon', SYSTEM_ID, 'secret') } #URLPREFIX = 'frog' elif host == 'echo' or host == 'nomia' or host == 'echo.uvt.nl' or host == 'nomia.uvt.nl': #Tilburg #Assuming ILK server CLAMDIR = "/var/www/clam" ROOT = "/var/www/clamdata/foliastats/" HOST = 'webservices.ticc.uvt.nl' PORT = 80 URLPREFIX = 'foliastats' WEBSERVICEGHOST = 'ws' BINDIR = "/var/www/bin/" else: raise Exception("I don't know where I'm running from! Got " + host)
def authenticate(self, auth, stored_password): return pwhash(auth.username, self.realm, auth.password) == stored_password
#An informative description for this system: SYSTEM_DESCRIPTION = "This webservice computes several statistics for plaintext files. It is a demo for CLAM." # ======== LOCATION =========== #The root directory for CLAM, all project files, (input & output) and #pre-installed corpora will be stored here. Set to an absolute path: ROOT = "/tmp/clam.textstats/" #The URL of the system PORT= 8080 # ======== AUTHENTICATION & SECURITY =========== #Users and passwords USERS = {'proycon': pwhash('proycon',SYSTEM_ID,'secret'), 'antal': pwhash('antal',SYSTEM_ID,'secret')} #Amount of free memory required prior to starting a new process (in MB!), Free Memory + Cached (without swap!) REQUIREMEMORY = 10 #Maximum load average at which processes are still started (first number reported by 'uptime') MAXLOADAVG = 1.0 # ======== WEB-APPLICATION STYLING ============= #Choose a style (has to be defined as a CSS file in style/ ) STYLE = 'classic' # ======== ENABLED FORMATS ===========