From 8fc74212f6b100a13736886ef09f8b7723ac6eec Mon Sep 17 00:00:00 2001 From: The TorPSYC Team Date: Sat, 28 Sep 2013 16:34:57 +0200 Subject: [PATCH] you can torify psyced, but it probably wont work still --- bin/psyconf | 15 ++++++++++++--- world/net/library.i | 3 ++- world/net/psyc/library.i | 6 ++++++ world/net/socks/protocol.c | 14 +++++++++++--- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/bin/psyconf b/bin/psyconf index 1084f0e..5c7b8bc 100755 --- a/bin/psyconf +++ b/bin/psyconf @@ -349,6 +349,7 @@ X my $db = $c{_optional_level_debug} || '0'; my $psyced = "$execs/$driver -DDEBUG=$db"; + my $torify = ""; my $debugfile; if ( $c{_optional_use_file_debug} ) { @@ -370,6 +371,13 @@ X my $fqdn = "$c{_basic_host_name}.$c{_basic_host_domain}"; $psyced .= " --hostname $fqdn"; $hc = 0; # no problem + say "Your hostname will be assigned as $fqdn.\n"; + if ($c{_basic_host_domain} eq 'onion') { + $torify = "torsocks"; + say "Enabling PSYC federation over Tor: Using " + . "torsocks wrapper around psyced.\n"; + say "Warning: It will probably not function.\n" + } } ## ldmud bug number two #WARNING: Because of some funny bug the driver will probably not bind properly @@ -509,7 +517,7 @@ then fi # if your ldmud is too old, it may not understand --pidfile and --tls-* -commandline="$psyced -s 0 -s v0 --swap-file $base/psyced.swap --erq $execs/erq --pidfile $sandbox/data/$driver.pid -m $sandbox -u $portUDP $ports" +commandline="$torify $psyced -s 0 -s v0 --swap-file $base/psyced.swap --erq $execs/erq --pidfile $sandbox/data/$driver.pid -m $sandbox -u $portUDP $ports" # keep the pid of this wrapper process, too echo \$\$ >data/psyced.pid @@ -669,7 +677,7 @@ X $t = "$base/var/tor"; mkdir($t); $t = "$base/etc/tor/torrc"; - say "Generating control file $t ..\n"; + say "Generating Tor configuration $t ..\n"; rename $t, "$t~"; open O, '>', $t or die "Cannot write to $t"; @@ -803,7 +811,8 @@ X } # close IG; - print "\nModel creation completed successfully.\n"; + #print "\nModel creation completed successfully.\n"; + print "\n"; ## end of former archetype.pl diff --git a/world/net/library.i b/world/net/library.i index f5f6a5b..8ca706f 100644 --- a/world/net/library.i +++ b/world/net/library.i @@ -70,7 +70,8 @@ varargs int register_target(string uniform, vaobject handler, vaint shy) { if (shy) return 2; } unless (handler) handler = previous_object(); - P2(("register_target(%O) by %O\n", uniform, handler)) + P2(("register_target(%O, %O) by %O\n", uniform, handler, + previous_object())) targets[uniform] = handler; #if 0 // this shouldn't be necessary TODO uniform = lower_case(uniform); diff --git a/world/net/psyc/library.i b/world/net/psyc/library.i index 538ca4d..c0f1bd3 100644 --- a/world/net/psyc/library.i +++ b/world/net/psyc/library.i @@ -319,6 +319,12 @@ int psyc_sendmsg(mixed target, string mc, mixed data, mapping vars, string psychopo; string psycippo = "psyc://"+ $1 +"/"; +#if 0 + if (trail(".onion", hopo)) { + psycippo = hopo; // not a solution + raise_error("Unable to handle .onion correctly, snif.\n"); + } +#endif // if ($3 && $3 != PSYC_SERVICE) { if ($9) { hopo += ":"+$9; diff --git a/world/net/socks/protocol.c b/world/net/socks/protocol.c index 422b712..ba0a963 100644 --- a/world/net/socks/protocol.c +++ b/world/net/socks/protocol.c @@ -1,6 +1,13 @@ // vim:syntax=lpc:ts=8 -/* implementation of the socks5 protocl + +/* implementation of the socks5 protocol * http://tools.ietf.org/html/rfc1928 + * + * accepts SOCKS connections on a port and creates outgoing connection + * if requested to do so. when it enter STATE_READY it stops working. + * there is no interaction with the rest of the psyced code, so it's + * a bit odd to use psyced as a socks proxy. makes more sense if psyclpc + * was capable of connecting to hosts via SOCKS. */ #include #include @@ -196,13 +203,14 @@ void read_callback(string data) { return; } else { buffer += data; + // switch this! if (state == STATE_INITIAL) { parseNegotiation(); } - if (state == STATE_AUTH_USERPASS) { + else if (state == STATE_AUTH_USERPASS) { parseUserPass(); } - if (state == STATE_REQUEST) { + else if (state == STATE_REQUEST) { parseRequest(); } }