Friday, November 28, 2008

avi2ipod.pl - Convert any supported video to an IPOD playable mp4


Requirements
perl
ffmpeg
libfaac (for audio)


Usage: ./avi2ipod.pl -i <input>
Output file will be written to the same directory as the original,
unless specified with the --output option.
Command Flags:
--input|-i <input> - Specify input file.
--output|-o <output> - Specify output file.
--force - Force a possibly unsafe operation.
--help|-h - Print's this help.
--version|-v - Print this script's version information.



Then just copy to your ipod with something like gtkpod

Download: avi2ipod.pl

Enjoy!

-dan

Howto: BOPM via SSL


This short HOWTO will explain how to setup Blitzed Open Proxy Monitor to connect to an IRC Server via SSL. I expect that you have basic knowledge of Linux/Unix, and already know how to configure/compile, and setup the BOPM as normal.



tools you will need:



• stunnel
• Blitzed Open Proxy Monitor
• An SSL-Capable ircd such as ircd-ratbox



I will assume you already have your SSL-Capable IRCD up and running correctly. I will also assume you have your BOPM up and running correctly. All we are going to do is SSLify it.

Stunnel Setup


• Create a certificate for yourself. You can do this with the following command:
openssl req -new -newkey rsa:1024 -days 365 \
-nodes -x509 -keyout `uname -n`.pem \
-out `uname -n`.pem


• Move or copy the created file, which will be named YOUR_MACHINE_NAME.pem to ~/.YOUR_MACHINE_NAME.pem.
(obviously, YOUR_MACHINE_NAME will be the actual name of your server, such as "leetbox" or something).

• Copy the following text into ~/.stunnel.conf and edit the ip addresses and ports to suit your needs.
cert = /home/YOUR_USERNAME/.YOUR_MACHINE_NAME.pem

[bopm]
; adjust the port number if necessary
accept = 127.0.0.1:8500

; local is the "vhost" stunnel will use to connect to your irc server.
; If you don't use a vhost, leave it commented out.
;local = 0.0.0.0

; connect is the irc server's ip address and port that we are connecting to
connect = 0.0.0.0:6697
client = yes


• Save and close ~/.stunnel.conf. then run:
stunnel ~/.stunnel.conf


• You can test that stunnel is working correctly by connecting to it with telnet.
telnet 127.0.0.1 8500


• If you see the server connect notices, you are in business, otherwise you made a mistake somewhere.

BOPM Setup


• Edit bopm.conf and adjust it's settings as follows:
server = 127.0.0.1
port = 8500



• Save and restart your bopm.
• Your BOPM should now be connected to IRC via SSL.

Friday, October 10, 2008

Howto: Remote logging with syslog-ng


As anyone who uses any flavor of GNU/Linux should know, system logs are stored in /var/log. If you are like me, you may have more than one machine at home. Maybe you have a file server, or a gateway box, or maybe a workstation that you allow your kids to use so they don't mess up your own. Being able to review system logs is an important task. It allows you to debug problems, as well as track things that could alert you to potential problems. If you have more than one PC, this can be a pain in the rear. I found numerous HOWTO's on the internet on how to setup remote logging... some were a little out dated, and others gave too many options that made it all a bit confusing. This little howto is how I setup my remote system logging to make life a little simpler.



My GNU/Linux distro of choice is Gentoo, but this should work on any flavor of linux that uses the logging daemon syslog-ng. Check your package manager to see if that is what you are using. If you're using something else, like SYSKLOGD, you will need to replace it.



First you will need a remote-logging server. This could very well be your desktop computer, or some other dedicated machine. This will be the machine that stores the logs from all your other computers. I will refer to this machine as the log server. Remote machines that you wish to keep track of (file servers, gateways, proxy server, whatever) will be refered to as remote. So lets get started.



Log Server Setup

  1. If you are using Gentoo, switch on the hardened use flag for syslog-ng. It makes syslog-ng logs a little more organized. Why this is not done by default is beyond me.
  2. The syslog-ng config file should be located at /etc/syslog-ng/syslog-ng.conf. Open it up with your favorite text editor. You should see several lines that look like this example:

    source src { unix-stream("/dev/log"); internal(); };
    source kernsrc { file("/proc/kmsg"); };
    destination authlog { file("/var/log/auth.log"); };
    filter f_auth { facility(auth); };
    filter f_authpriv { facility(auth, authpriv); };
    log { source(src); filter(f_authpriv); destination(authlog); };
    log { source(src); filter(f_syslog); destination(syslog); };

    It's ok if you have more, or slightly different information. this is just an example.
  3. At the bottom of the file, you are going to add the following:

    source remote_log {
    udp( port(1999) );
    };

    This tells syslog-ng that we are going to listen on udp port 1999 for incoming log information.
    Next we are going to add destination files for the logs we receive over the network.

    #define destinations.
    destination remote_authlog { file("/var/log/remote.d/$HOST/auth.log"); };
    destination remote_syslog { file("/var/log/remote.d/$HOST/syslog"); };
    destination remote_cron { file("/var/log/remote.d/$HOST/cron.log"); };
    destination remote_daemon { file("/var/log/remote.d/$HOST/daemon.log");};
    destination remote_kern { file("/var/log/remote.d/$HOST/kern.log"); };
    destination remote_lpr { file("/var/log/remote.d/$HOST/lpr.log"); };
    destination remote_user { file("/var/log/remote.d/$HOST/user.log"); };
    # Should be remote_maillog (Without dot) as it was the default on logwatch
    destination remote_mail { file("/var/log/remote.d/$HOST/maillog"); };
    destination remote_mailinfo { file("/var/log/remote.d/$HOST/mail.info");};
    destination remote_mailwarn { file("/var/log/remote.d/$HOST/mail.warn");};
    destination remote_mailerr { file("/var/log/remote.d/$HOST/mail.err");};
    destination remote_newscrit { file("/var/log/remote.d/$HOST/news/news.crit");};
    destination remote_newserr { file("/var/log/remote.d/$HOST/news/news.err");};
    destination remote_newsnotice { file("/var/log/remote.d/$HOST/news/news.notice");};
    destination remote_debug { file("/var/log/remote.d/$HOST/debug");};
    destination remote_messages { file("/var/log/remote.d/$HOST/messages"); };
    destination remote_grsec { file("/var/log/remote.d/$HOST/grsec.log"); };
    destination remote_pax { file("/var/log/remote.d/$HOST/pax.log"); };

    Next we want to setup log filters, which tell syslog what data goes to what file.


    #connect filter and destination
    log { source(remote_log); filter(f_authpriv); destination(remote_authlog); };
    log { source(remote_log); filter(f_syslog); destination(remote_syslog); };
    log { source(remote_log); filter(f_cron); destination(remote_cron); };
    log { source(remote_log); filter(f_daemon); destination(remote_daemon); };
    log { source(remote_log); filter(f_kern); destination(remote_kern); };
    log { source(remote_log); filter(f_lpr); destination(remote_lpr); };
    log { source(remote_log); filter(f_mail); destination(remote_mail); };
    log { source(remote_log); filter(f_user); destination(remote_user); };
    log { source(remote_log); filter(f_mail); filter(f_info); destination(remote_mailinfo); };
    log { source(remote_log); filter(f_mail); filter(f_warn); destination(remote_mailwarn); };
    log { source(remote_log); filter(f_mail); filter(f_err); destination(remote_mailerr); };
    log { source(remote_log); filter(f_debug); destination(remote_debug); };
    log { source(remote_log); filter(f_messages); destination(remote_messages);};
    log { source(remote_log); filter(f_pax); destination(remote_pax);};
    log { source(remote_log); filter(f_grsec); destination(remote_grsec);};
  4. Save your file. you're done with it.
  5. Make the log directory for remote machines. with the command:
    mkdir /var/log/remote.d
  6. restart syslog-ng: /etc/init.d/syslog-ng restart


Remote Setup


  1. Setting up the remote machines is way easier. Again, you will need syslog-ng on these machines too. Open up /etc/syslog-ng/syslog-ng.conf with your favorite editor.
  2. Add the following lines at the bottom of the config:

    destination remote {
    udp("10.1.1.2" port(1999));
    };
    log {source(src);destination(remote);};

    You will need to change the IP address '10.1.1.2' to the real address of your log server.
  3. Save the file, you're done with it.
  4. Restart syslog-ng: /etc/init.d/syslog-ng restart
  5. Repeat these steps on all machines you want to report back to your log server.


It might take a few minutes, but you should soon see logs appearing in /var/log/remote.d/hostname from your remote machines.

Optional Steps

Keep syslog-ng.conf from being accidently (or intentionally) overwritten:
chattr +i /etc/syslog-ng/syslog-ng.conf

Install a GUI log parser to make reading your logs easier. A program such as ksystemlog if you're a KDE fan.

Additional Notes
there is a plethora of other options, including encryption if you plan on remote-logging over the internet. I intentionally left this information out, because this howto is geared more to home-networks. If you want to setup remote-logging over the internet, I highly recommend you find a howto that includes SSL options :)

This howto was adapted from articles listed at:
http://www.campin.net/syslog-ng/faq.html
http://gentoo-wiki.com/HOWTO_create_a_logserver_with_syslog-ng

Sunday, October 5, 2008

Kblogger for KDE 4.2

So, I just signed up for a blogspot account, and installed Kblogger-1.0. It's got support for a pleathora of different blogging protcols, such as Wordpress, LiveJournal, and of course blogspot, among others. So far it seems pretty solid, but since this is my very first post, im sure any bugs that exist have yet to rear their ugly head. Anyway, if you're *nix user who blogs, I recommend this tool.

Kblogger Screenshot


kblogger-1.0 screenshot