Documentation

Plugins

Client libraries

Publishing

FAQs


Publishing with Karma-Publish

Karma-publish is a command-line feed uploader that lets you push your reputation data into Karmasphere into your Karmasphere account without having to use a web browser.

Why It Is Useful

When you create a feed for the first time, you populate it by uploading data over the the web interface, which offers a simple form with a file upload button.

Karma-Publish lets you perform that file upload from your command line instead of your web browser. It is a small Perl script that uses LWP to do the POST.

You can run it every time your data changes. Or you can run it from cron.

You can upload data as often as you like; new data overwrites old.

You may already have lots of data in RBLDNSd format, or XML, or MySQL, or whatever. But the Karmasphere web interface requires you to upload data in the score format. Karma-publish takes care of converting your data into score format before doing the upload. If it doesn't already grok your format, just write a simple script that converts your format to score.

How Uploading Works

First, Karma-Publish parses your input data and converts it to the score format. Then it uploads the parsed data to the Karmasphere webserver.

Shortly thereafter, the Java backend grabs the data off the webserver, parses it again, and shoves it into the Query Servers where it becomes available for query.

Where do I find Karma-Publish?

It is bundled with the Mail::Karmasphere::Client Perl library.

How to run it

Karma-Publish requires the following parameters:

--username
your Karmasphere username, eg. bobjones@example.com
--password
your Karmasphere password
--feed
the name of your feed, eg. bobjones.myfirstfeed
--file
path to feed filename
--format
file format identifier, eg. score.ip or rbl.simpleip
Karma-Publish --username=bobjones --password=password --feed=bobjones.myfeed --file=/var/tmp/opinions.txt --format=score.ip

What format does my input file need to be in?

See Data Formats for more detail. We recommend the comma-separated score.* formats if possible, but we support rbl.* formats for backward compatibility.

Karma-Publish converts input formats into the "score" format before uploading.

An Important Rule: One Identity Type, One Feed

I have opinions about IP addresses and domain names both. What do I do?

You have to split out the IP addresses into one file, and the domain names into another. Create a feed for each. Run Karma-Publish on one file, and then the other.

Karma-Publish --feed=bobjones.myipfeed --file=opinions-ip.txt ...
Karma-Publish --feed=bobjones.mydomainfeed --file=opinions-domain.txt ...

A feed can only have one identity type. If you have information about more than one identity type, you will need to create more than one feed, and run Karma-Publish more than once.

Can I say, in a single file, that I like some IP addresses and dislike others?

Yes. You have to use one of the score.* format types. Those formats let you assign a score value to each identity. Generally, 1000 is "whitelist", and -1000 is "blacklist".

Then why are there some feeds which just say "if match"?

Karmasphere went out and syndicated lots and lots of traditional DNSBLs and DNSWLs. Those feeds are exclusively whitelist-only or blacklist-only; they're pretty primitive, and everything in the feed has the same value, either -1000 or +1000.

But, when it comes to the stuff that you upload, in the words of the greatest pop star of the 20th century, it doesn't matter if you're black or white. You can set the score to be anything you want, and that score will be the final word. The "whitelist" vs "blacklist" setting that you have on your feed just tells Karmasphere what the default should be if you leave out the score entirely.

Do I have to upload the whole file each time?

For now, yes. Many people have pointed out that repeated uploads of data that stays mostly the same is inefficient. It's true: that's why they invented rsync. We are well aware of this. In the future you will be able to run a pusher node that will do the diffing locally and push only the deltas to Karmasphere.