App-Bondage

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

  Rationale
    I wrote Bondage because no other IRC bouncer out there fit my needs.
    Either they were missing essential features, or they were implemented in
    an undesirable (if not buggy) way. I've tried to make Bondage stay out
    of your way and be as transparent as possible. It's supposed to be a
    proxy, after all.

FEATURES
  Easy setup
    Bondage is easy to get up and running. In the configuration file, you
    just have to specify the port it will listen on, the password, and some
    IRC server(s) you want Bondage to connect to. Everything else has
    sensible defaults, though you might want to use a custom nickname and
    pick some channels to join on connect.

  Logging
    Bondage can log both public and private messages for you. All log files
    are saved as UTF-8.

  Stays connected
    Bondage will reconnect to IRC when it gets disconnected or the IRC

README  view on Meta::CPAN

  Flood protection
    Bondage utilizes POE::Component::IRC's flood protection to ensure that
    you never flood yourself off the IRC server.

  NickServ support
    Bondage can identify with NickServ for you when needed.

  Rejoins channels if kicked
    Bondage can try to rejoin a channel if you get kicked from it.

  Encrypted passwords
    Bondage supports encrypted passwords in its configuration file for added
    security.

  SSL support
    You can connect to SSL-enabled IRC servers, and make Bondage require SSL
    for client connections.

  IPv6 support
    Bondage can connect to IPv6 IRC servers, and also listen for client
    connections via IPv6.

README  view on Meta::CPAN

    The port Bondage binds to.

   "listen_ssl"
    (optional, default: *false*)

    Set this to true if you want Bondage to require the use of SSL for
    client connections. You'll need to have ssl.crt and ssl.key files in
    Bondage's working directory. More information, see
    <http://www.akadia.com/services/ssh_test_certificate.html>

   "password"
    (required, no default)

    The password you use to connect to Bondage. If it is 32 characters, it
    is assumed to be encrypted (see "bondage -c");

   "networks"
    (required, no default)

    This should contain a list of network names, each pointing to a list of
    relevant options as described in the following section.

     networks:
       freenode:

README  view on Meta::CPAN

    The IRC server you want Bondage to connect to.

   "server_port"
    (optional, default: *6667*)

    The port on the IRC server you want to use.

   "server_pass"
    (optional, no default)

    The IRC server password, if there is one.

   "use_ssl"
    (optional, default: *false*)

    Set this to true if you want to use SSL to communicate with the IRC
    server.

   "nickserv_pass"
    (optional, no default)

    Your NickServ password on the IRC network, if you have one. Bondage will
    identify with NickServ with this password on connect, and whenever you
    switch to your original nickname.

   "nickname"
    (optional, default: your UNIX user name)

    Your IRC nick name.

   "username"
    (optional, default: your UNIX user name)

README  view on Meta::CPAN

    Your IRC real name, or email, or whatever.

   "flood"
    (optional, default: *false*)

    Set to a true value to allow flooding (disables flood protection).

   "channels"
    (optional, no default)

    A list of all your channels and their passwords.

     channels:
       "chan1" : ""
       "chan2" : "password"
       "chan3" : ""

   "recall_mode"
    (optional, default: *"missed"*)

    How many channel messages you want Bondage to remember, and then send to
    you when you attach.

    "missed": Bondage will only recall the channel messages you missed since
    the last time you detached from Bondage.

bin/bondage  view on Meta::CPAN

        $poe_kernel->has_forked();
    };
    chomp $@;
    die "Can't daemonize: $@\n" if $@;
}
$poe_kernel->run();

sub encrypt_pass {
    print "Password:";
    system('stty -echo');
    chomp (my $password = <>);
    system('stty echo');
    print "\nEncrypted password: " . md5_hex($password, $App::Bondage::CRYPT_SALT) . "\n";
    exit;
}

=encoding utf8

=head1 NAME

bondage - A featureful easy-to-use IRC bouncer

=head1 SYNOPSIS

B<bondage> [options]

 Options:
   -c, --crypt             Prompts you for a password and encrypts it
   -d, --debug             Skip daemonizing and print everything to STDOUT
   -h, --help              Display this help message
   -v, --version           Display version information
   -w DIR, --workdir=DIR   Working directory (default: ~/.bondage)

=head1 DESCRIPTION

This is the command-line program to use Bondage. See the
L<App::Bondage|App::Bondage> documentation for more details.

example/config.yml  view on Meta::CPAN

listen_port: 16667
password: "secret"

networks:
  freenode:
    server_host: "irc.freenode.net"
#    nickname: "ircnick"
#    username: "ircuser"
#    realname: "ircreal"

#    channels:
#      "#chan1" : ""
#      "#chan2" : "mypassword"
#      "#chan3" : ""

  ircnet:
    server_host: "us.ircnet.org"
#    nickname: "ircnick"
#    username: "ircuser"
#    realname: "ircreal"
    
#    channels:
#      "#chan1" : ""

lib/App/Bondage.pm  view on Meta::CPAN

        $info->{lc $1} = $input->{params}[0];
    }
    elsif ($input->{command} =~ /(NICK|USER)/) {
        $info->{lc $1} = $input->{params}[0];
        $info->{registered}++;
    }
    
    if ($info->{registered} == 2) {
        AUTH: {
            last AUTH if !defined $info->{pass};
            $info->{pass} = md5_hex($info->{pass}, $CRYPT_SALT) if length $self->{config}{password} == 32;
            last AUTH unless $info->{pass} eq $self->{config}{password};
            last AUTH unless my $irc = $self->{ircs}{ $info->{nick} };
            $info->{wheel}->put("$info->{nick} NICK :$irc->nick_name");
            $irc->plugin_add("Client_$id" => App::Bondage::Client->new( Socket => $info->{socket} ));
            $irc->_send_event(irc_proxy_authed => $id);
            delete $self->{wheels}{$id};
            return;
        }
        
        # wrong password or nick (network), dump the client
        $info->{wheel}->put('ERROR :Closing Link: * [' . ( $info->{user} || 'unknown' ) . '@' . $info->{ip} . '] (Unauthorised connection)' );
        delete $self->{wheels}{$id};
    }
    
    return;
}

sub _listener_accept {
    my ($self, $socket, $peer_addr) = @_[OBJECT, ARG0, ARG1];
    my $wheel = POE::Wheel::ReadWrite->new(

lib/App/Bondage.pm  view on Meta::CPAN

}

sub _load_config {
    my ($self) = @_;

    $self->{config} = LoadFile(catfile($self->{Work_dir}, 'config.yml'));


    # some sanity checks

    for my $opt (qw(listen_port password)) {
        if (!defined $self->{config}{$opt}) {
            die "Config option '$opt' must be defined; aborted\n";
        }
    }

    if (ref $self->{config}{networks} ne 'HASH'
            || !keys %{ $self->{config}{networks} }) {
        die "No networks defined; aborted\n";
    }

lib/App/Bondage.pm  view on Meta::CPAN

I wrote Bondage because no other IRC bouncer out there fit my needs. Either
they were missing essential features, or they were implemented in an
undesirable (if not buggy) way. I've tried to make Bondage stay out of your
way and be as transparent as possible. It's supposed to be a proxy, after all.

=head1 FEATURES

=head2 Easy setup

Bondage is easy to get up and running. In the configuration file, you just
have to specify the port it will listen on, the password, and some IRC
server(s) you want Bondage to connect to. Everything else has sensible
defaults, though you might want to use a custom nickname and pick some
channels to join on connect.

=head2 Logging

Bondage can log both public and private messages for you. All log files
are saved as UTF-8.

=head2 Stays connected

lib/App/Bondage.pm  view on Meta::CPAN

never flood yourself off the IRC server.

=head2 NickServ support

Bondage can identify with NickServ for you when needed.

=head2 Rejoins channels if kicked

Bondage can try to rejoin a channel if you get kicked from it.

=head2 Encrypted passwords

Bondage supports encrypted passwords in its configuration file for added
security.

=head2 SSL support

You can connect to SSL-enabled IRC servers, and make Bondage require SSL for
client connections.

=head2 IPv6 support

Bondage can connect to IPv6 IRC servers, and also listen for client

lib/App/Bondage.pm  view on Meta::CPAN


=head3 C<listen_ssl>

(optional, default: I<false>)

Set this to true if you want Bondage to require the use of SSL for client
connections. You'll need to have F<ssl.crt> and F<ssl.key> files in Bondage's
working directory. More information, see
L<http://www.akadia.com/services/ssh_test_certificate.html>

=head3 C<password>

(required, no default)

The password you use to connect to Bondage. If it is 32 characters, it is
assumed to be encrypted (see L<C<bondage -c>|bondage/"SYNOPSIS">);

=head3 C<networks>

(required, no default)

This should contain a list of network names, each pointing to a list of
relevant options as described in the following section.

 networks:

lib/App/Bondage.pm  view on Meta::CPAN

=head3 C<server_port>

(optional, default: I<6667>)

The port on the IRC server you want to use.

=head3 C<server_pass>

(optional, no default)

The IRC server password, if there is one.

=head3 C<use_ssl>

(optional, default: I<false>)

Set this to true if you want to use SSL to communicate with the IRC server.

=head3 C<nickserv_pass>

(optional, no default)

Your NickServ password on the IRC network, if you have one. Bondage will
identify with NickServ with this password on connect, and whenever you switch
to your original nickname.

=head3 C<nickname>

(optional, default: your UNIX user name)

Your IRC nick name.

=head3 C<username>

lib/App/Bondage.pm  view on Meta::CPAN

=head3 C<flood>

(optional, default: I<false>)

Set to a true value to allow flooding (disables flood protection).

=head3 C<channels>

(optional, no default)

A list of all your channels and their passwords.

 channels:
   "chan1" : ""
   "chan2" : "password"
   "chan3" : ""

=head3 C<recall_mode>

(optional, default: I<"missed">)

How many channel messages you want Bondage to remember, and then send to you
when you attach.

B<"missed">: Bondage will only recall the channel messages you missed since



( run in 0.693 second using v1.01-cache-2.11-cpan-49f99fa48dc )