A simple script like so would work within shell:

=-=-=-=-=-=-=-=-=-=
#!/bin/bash

if [ ! $1 ]; then
        echo "usage: $0 <subdomain.domain.tld>";
        exit;
fi

printf "Enter the MySQL password to proceed: ";

stty -echo;
read PASS;
stty echo;

mysql -uroot -p$PASS -e"insert into whitelist_dnsname
values('$1','#auto-entered via script',1293857999);" policyd;

echo "";
echo "";
echo "Added $1 to whitelist_dnsname within policyd database.";
echo "";

exit;

=-=-=-=-=-=-=-=-=-=


The epoch I used expires the whitelist entry on Dec 31st, 2010, at
23:59:59. For security purposes, you have to enter in the SQL password
each time, especially since you're doing this as root.

Modifying this to suit your needs should be fairly easy; just change the
SQL query. Even further, it shouldn't be too hard to add the ability to
have different options so only one script is necessary (like your
suggestion of "policyd-add --dnswhitelist") rather than multiple scripts
(like "policyd-add-whitelist", "policyd-add-whitelist_dnsname", etc).

Hope this helps.

E.


> Hello,
> Has anyone taken the time to write a few quick scripts to insert and
> remove records from
> the database?
>
> Something along the lines of:
> policyd-add --dnswhitelist dns.name.com
>
> --
> Douglas F. Calvert              -/-                [EMAIL PROTECTED]
> 0xC9541FB2  /  0817 30D4 82B6 BB8D 5E66 06F6 B796 073D C954 1FB2
> Do not email => [EMAIL PROTECTED] <= It would be a bad idea(tm).
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> policyd-users mailing list
> policyd-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/policyd-users
>



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
policyd-users mailing list
policyd-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/policyd-users

Reply via email to