… | |
… | |
29 | You should of course also make sure that L<AnyEvent> and L<AnyEvent::MP> |
29 | You should of course also make sure that L<AnyEvent> and L<AnyEvent::MP> |
30 | are installed. But how to do that is out of scope of this tutorial. |
30 | are installed. But how to do that is out of scope of this tutorial. |
31 | |
31 | |
32 | Then we have to setup a I<shared secret>. For two L<AnyEvent::MP> nodes to |
32 | Then we have to setup a I<shared secret>. For two L<AnyEvent::MP> nodes to |
33 | be able to communicate with each other and authenticate each other it is |
33 | be able to communicate with each other and authenticate each other it is |
34 | necessary to setup the same I<shared secret> for both of them. For testing |
34 | necessary to setup the same I<shared secret> for both of them. |
35 | you can write a random string into the file C<.aemp-secret> in your home |
|
|
36 | directory: |
|
|
37 | |
35 | |
38 | mcookie > ~/.aemp-secret |
36 | The easiest way is to use the F<aemp> utility: |
39 | |
37 | |
40 | # or something more predictable |
38 | aemp gensecret |
41 | echo "secret123#4blabla_please_pick_your_own" > ~/.aemp-secret |
|
|
42 | |
39 | |
|
|
40 | This creates the F<$HOME/.perl-anyevent-mp> config file and generates a |
|
|
41 | random shared secret. You can copy this file to any other system and then |
|
|
42 | communicate with it. You cna also select your own shared secret (F<aemp |
|
|
43 | setsecret>) and for increased security requirements you can even create a |
|
|
44 | TLS certificate (F<aemp gencert>). |
|
|
45 | |
43 | Connections will only be successful when the nodes that want to connect |
46 | Connections will only be successful when the nodes that want to connect to |
44 | to each other have the same I<shared secret>. For more security, you can |
47 | each other have the same I<shared secret> (or successfully verify the TLS |
45 | put a self-signed SSL/TLS key/certificate pair into the file (or a normal |
48 | certificate). |
46 | key/certificate and it's CA certificate). |
|
|
47 | |
49 | |
48 | B<If something does not work as expected, and for example tcpdump shows |
50 | B<If something does not work as expected, and for example tcpdump shows |
49 | that the connections are closed almost immediatly, you should make sure |
51 | that the connections are closed almost immediatly, you should make sure |
50 | that F<~/.aemp-secret> is the same on all hosts/user accounts that you try |
52 | that F<~/.perl-anyevent-mp> is the same on all hosts/user accounts that |
51 | to connect with each other!> |
53 | you try to connect with each other!> |
52 | |
54 | |
53 | =head1 The Chat Client |
55 | =head1 The Chat Client |
54 | |
56 | |
55 | OK, lets start by implementing the "frontend" of the client. We will |
57 | OK, lets start by implementing the "frontend" of the client. We will |
56 | develop the client first and postpone the server for later, as the most |
58 | develop the client first and postpone the server for later, as the most |