mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
various bugfixes and updates
redo all the config files for the new format (we'll redo them again soon) fix (another! yuck) segfault in log_fn when input is too large tor_tls_context_new() returns -1 for error, not NULL fix segfault in check_conn_marked() on conn's that die during tls handshake make ORs also initialize conn from router when we're the receiving node make non-dirserver ORs upload descriptor to every dirserver on startup add our local address to the descriptor add Content-Length field to POST command revert the Content-Length search in fetch_from_buf_http() to previous code fix segfault in memmove in fetch_from_buf_http() raise maximum allowed headers/body size in directory.c svn:r484
This commit is contained in:
parent
3d4ccb781a
commit
3b5191d36d
@ -54,17 +54,19 @@ static INLINE void format_msg(char *buf, size_t buf_len,
|
|||||||
".%.3ld [%s] ",
|
".%.3ld [%s] ",
|
||||||
(long)now.tv_usec / 1000, sev_to_string(severity));
|
(long)now.tv_usec / 1000, sev_to_string(severity));
|
||||||
if(n > buf_len)
|
if(n > buf_len)
|
||||||
n = buf_len; /* the *nprintf funcs return how many bytes they
|
n = buf_len-1; /* the *nprintf funcs return how many bytes they
|
||||||
* _would_ print, if the output is truncated */
|
* _would_ print, if the output is truncated.
|
||||||
|
* Subtract one because the count doesn't include the \0 */
|
||||||
|
|
||||||
if (funcname) {
|
if (funcname) {
|
||||||
n += snprintf(buf+n, buf_len-n, "%s(): ", funcname);
|
n += snprintf(buf+n, buf_len-n, "%s(): ", funcname);
|
||||||
if(n > buf_len)
|
if(n > buf_len)
|
||||||
n = buf_len;
|
n = buf_len-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
n += vsnprintf(buf+n,buf_len-n,format,ap);
|
n += vsnprintf(buf+n,buf_len-n,format,ap);
|
||||||
if(n > buf_len)
|
if(n > buf_len)
|
||||||
n = buf_len;
|
n = buf_len-1;
|
||||||
buf[n]='\n';
|
buf[n]='\n';
|
||||||
buf[n+1]='\0';
|
buf[n+1]='\0';
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ tor_tls_context_new(crypto_pk_env_t *rsa,
|
|||||||
cert = tor_tls_create_certificate(rsa, nickname);
|
cert = tor_tls_create_certificate(rsa, nickname);
|
||||||
if (!cert) {
|
if (!cert) {
|
||||||
log(LOG_ERR, "Error creating certificate");
|
log(LOG_ERR, "Error creating certificate");
|
||||||
return NULL;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,49 +1,81 @@
|
|||||||
# List of directory servers.
|
# This is no longer a manually-editable file. It's just a
|
||||||
# Line format : address ORPort OPPort APPort DirPort bandwidth(bytes/s)
|
# concatenation of a bunch of signed router descriptors.
|
||||||
# followed by the routers public key.
|
|
||||||
# ORport is where the router listens for routers/clients (speaking cells)
|
|
||||||
# APPort is where the router listens for applications (speaking socks)
|
|
||||||
# DirPort is where the router listens for directory download requests
|
|
||||||
|
|
||||||
# Router 1
|
router moria.mit.edu 9001 9021 9031 800000
|
||||||
router moria.mit.edu 9001 9021 9031 1000000
|
onion-key
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
MIGJAoGBAMBBuk1sYxEg5jLAJy86U3GGJ7EGMSV7yoA6mmcsEVU3pwTUrpbpCmwS
|
MIGJAoGBANoIvHieyHUTzIacbnWOnyTyzGrLOdXqbcjz2GGMxyHEd5K1bO1ZBNHP
|
||||||
7BvovoY3z4zk63NZVBErgKQUDkn3pp8n83xZgEf4GI27gdWIIwaBjEimuJlEY+7K
|
9i5qLQpN5viFk2K2rEGuG8tFgDEzSWZEtBqv3NVfUdiumdERWMBwlaQ0MVK4C+jf
|
||||||
nZ7kVMRoiXCbjL6VAtNa4Zy1Af/GOm0iCIDpholeujQ95xew7rQnAgMA//8=
|
y5gZ8KI3o9ZictgPS1AQF+Kk932/vIHTuRIUKb4ILTnQilNvID0NAgMBAAE=
|
||||||
|
-----END RSA PUBLIC KEY-----
|
||||||
|
link-key
|
||||||
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
|
MIGJAoGBAPt97bGDd9siVjPd7Xuq2s+amMEOLIj9961aSdP6/OT+BS1Q4TX2dNOX
|
||||||
|
ZNAl63Z2fQISsR81+nfoqRLYCKxhajsD7LRvRTaRwUrWemVqFevmZ4nJrHw6FoU3
|
||||||
|
xNUIHRMA8X2DZ+l5qgnWZb7JU50ohhX5OpMSyysXnik51J8hD5mBAgMBAAE=
|
||||||
-----END RSA PUBLIC KEY-----
|
-----END RSA PUBLIC KEY-----
|
||||||
signing-key
|
signing-key
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
MIGJAoGBAMBBuk1sYxEg5jLAJy86U3GGJ7EGMSV7yoA6mmcsEVU3pwTUrpbpCmwS
|
MIGJAoGBAMHa0ZC/jo2Q2DrwKYF/6ZbmZ27PFYG91u4gUzzmZ/VXLpZ8wNzEV3oW
|
||||||
7BvovoY3z4zk63NZVBErgKQUDkn3pp8n83xZgEf4GI27gdWIIwaBjEimuJlEY+7K
|
nt+I61048fBiC1frT1/DZ351n2bLSk9zJbB6jyGZJn0380FPRX3+cXyXS0Gq8Ril
|
||||||
nZ7kVMRoiXCbjL6VAtNa4Zy1Af/GOm0iCIDpholeujQ95xew7rQnAgMA//8=
|
xkhMQf5XuNFUb8UmYPSOH4WErjvYjKvU+gfjbK/82Jo9SuHpYz+BAgMBAAE=
|
||||||
-----END RSA PUBLIC KEY-----
|
-----END RSA PUBLIC KEY-----
|
||||||
|
router-signature
|
||||||
|
-----BEGIN SIGNATURE-----
|
||||||
|
fYcz+14lf2kilu0zGrkyAvfjNk2GfL5QClhdCiBuqy5fIkUS/969WZSWg9BXi7pK
|
||||||
|
5+EgR9hvY4nAtJ2SBoE+lyOx7miuT/uGfH68wNkC0Le2gULcprDYFKAEc5i1o/aS
|
||||||
|
Y/kuZIFDm2FXQPrYM88CIHAq8/3amUCskf2vC7l2eNE=
|
||||||
|
-----END SIGNATURE-----
|
||||||
|
|
||||||
|
router moria.mit.edu 9002 9022 9032 800000
|
||||||
# Router 2
|
onion-key
|
||||||
router moria.mit.edu 9002 9022 9032 1000000
|
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
MIGJAoGBANX/HHRuudz274MFSQ4manX8DhtsIuogNUyco9/0dr+XsfioTGd3RgMj
|
MIGJAoGBAM4Cc/npgYC54XrYLC+grVxJp7PDmNO2DRRJOxKttBBtvLpnR1UaueTi
|
||||||
aSWlD87arkZO4hHBPHe0q89Z3s1UtUsyQ/VmsxSv9g2OCnF/dU2Nz4h6+Al3iNJF
|
kyknT5kmlx+ihgZF/jmye//2dDUp2+kK/kSkpRV4xnDLXZmed+sNSQxqmm9TtZQ9
|
||||||
1UlWR4eiqBx3djxdIl/t+Nidw++YGc8QqRqkg0EhQCJ2fnOtHn9bAgMA//8=
|
/hjpxhp5J9HmUTYhntBs+4E4CUKokmrI6oRLoln4SA39AX9QLPcnAgMBAAE=
|
||||||
|
-----END RSA PUBLIC KEY-----
|
||||||
|
link-key
|
||||||
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
|
MIGJAoGBAN7JVeCIJ7+0ZJew5ScOU58rTUqjGt1Z1Rkursc7WabEb8jno45VZwIs
|
||||||
|
dkjnl31i36KHyyS7kQdHgkvG5EiyZiRipFAcoTaYv3Gvf1No9cXL6IhT3y/37dJ/
|
||||||
|
kFPEMb/G2wdkJCC+D8fMwHBwMuqAg0JGuhoBOz0ArCgK3fq0BLilAgMBAAE=
|
||||||
-----END RSA PUBLIC KEY-----
|
-----END RSA PUBLIC KEY-----
|
||||||
signing-key
|
signing-key
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
MIGJAoGBANX/HHRuudz274MFSQ4manX8DhtsIuogNUyco9/0dr+XsfioTGd3RgMj
|
MIGJAoGBAOcrht/y5rkaahfX7sMe2qnpqoPibsjTSJaDvsUtaNP/Bq0MgNDGOR48
|
||||||
aSWlD87arkZO4hHBPHe0q89Z3s1UtUsyQ/VmsxSv9g2OCnF/dU2Nz4h6+Al3iNJF
|
rtwfqTRff275Edkp/UYw3G3vSgKCJr76/bqOHCmkiZrnPV1zxNfrK18gNw2Cxre0
|
||||||
1UlWR4eiqBx3djxdIl/t+Nidw++YGc8QqRqkg0EhQCJ2fnOtHn9bAgMA//8=
|
nTA+fD8JQqpPtb8b0SnG9kwy75eS//sRu7TErie2PzGMxrf9LH0LAgMBAAE=
|
||||||
-----END RSA PUBLIC KEY-----
|
-----END RSA PUBLIC KEY-----
|
||||||
|
router-signature
|
||||||
|
-----BEGIN SIGNATURE-----
|
||||||
|
Hyx1fJFJaR9j7OpEg4qdxKo+AMXIZl6250AuiYmvdcwWD2VBJyhSbptB/vMLQGrU
|
||||||
|
/PGWLlZus90xD/mKesc4b0CkwKD6eWI90Wn34JwBUGHalN/qm42tMMoq3slOWae0
|
||||||
|
Da9JmxiYqApXwwaHWR9WwNHmkXkWfvTmZDSFkdEMgV0=
|
||||||
|
-----END SIGNATURE-----
|
||||||
|
|
||||||
# Router 3
|
router moria.mit.edu 9003 9023 9033 800000
|
||||||
router moria.mit.edu 9003 9023 9033 1000000
|
onion-key
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
MIGJAoGBAJfkNWCaNkYIRwfHT06KBU6dz8W1xDpW5ezGJwAOoxCX3/ZNoUicb/1V
|
MIGJAoGBANS6J/Er9fYo03fjUUVesc7We9Z6xIevyDJH39pYS4NUlcr5ExYgSVFJ
|
||||||
oB3OzW6VxWIiht3da/3K0ywiBOOCcf6BabKoMdiPpH7NIeu6XRmBYK2uqW13gBgh
|
95aLCNx1x8Rf5YtiBKYuT3plBO/+rfuX+0iAGNkz/y3SlJVGz6aeptU3wN8CkvCL
|
||||||
xJbQBb58Nx8Fr05XkvLG6i+vTDY3MZOW3E2/DwSe/jFzuHSD5b3nAgMA//8=
|
zATEcnl4QSPhHX0wFB9A3t7wZ+Bat1PTI029lax/BkoS9JG5onHPAgMBAAE=
|
||||||
|
-----END RSA PUBLIC KEY-----
|
||||||
|
link-key
|
||||||
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
|
MIGJAoGBAKUMY8p+7LBu7dEJnOR9HqbfcD6c4/f9GqJt3o29uu4XJPD8z2XGVBik
|
||||||
|
pZBLijhYS6U7GFg0NLR4zBlsLyB8TxHeaz5KJidJjy+BfC01jz1xwVTYDlmGVpc1
|
||||||
|
0mw0Ag0ND6aOQKKhelxhTI3Bf0R9olEXuSUKEWx3EMIz2qhLd9oDAgMBAAE=
|
||||||
-----END RSA PUBLIC KEY-----
|
-----END RSA PUBLIC KEY-----
|
||||||
signing-key
|
signing-key
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
MIGJAoGBAJfkNWCaNkYIRwfHT06KBU6dz8W1xDpW5ezGJwAOoxCX3/ZNoUicb/1V
|
MIGJAoGBAMqgq83cwzSid2LSvzsn2rvkD8U0tWvqF6PuQAsKP3QHFqtBO+66pnIm
|
||||||
oB3OzW6VxWIiht3da/3K0ywiBOOCcf6BabKoMdiPpH7NIeu6XRmBYK2uqW13gBgh
|
CbiY2e6o01tmR47t557LuUCodEc8Blggxjg3ZEzvP42hsGB9LwQbcrU7grPRk0G0
|
||||||
xJbQBb58Nx8Fr05XkvLG6i+vTDY3MZOW3E2/DwSe/jFzuHSD5b3nAgMA//8=
|
IltsOF9TZ+66gCeU7LxExLdAMqT2Tx6VT4IREPJMeNxSiceEjbABAgMBAAE=
|
||||||
-----END RSA PUBLIC KEY-----
|
-----END RSA PUBLIC KEY-----
|
||||||
|
router-signature
|
||||||
|
-----BEGIN SIGNATURE-----
|
||||||
|
xm7Nmk7EmtDIrXZ/Hh2LBbG3oTuwCjY3XrVHpIbg6ttuoYJx3Ai1MdOHHBbUDVdz
|
||||||
|
bRE6WV5fXuVgmgcWLP6p364Vymw6i2ff/lkEMqHV4NOAWZ1RbFwZQ5OjEAjXIhH/
|
||||||
|
VlVX83wBSM0EefJwwXM7H075MU1MB+f2yRlTZ0/Xp0U=
|
||||||
|
-----END SIGNATURE-----
|
||||||
|
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
# Sample configuration file for httpap.
|
|
||||||
|
|
||||||
# local port on which the onion proxy is running
|
|
||||||
OnionProxy 9021
|
|
||||||
|
|
||||||
# maximum number of incoming connections
|
|
||||||
MaxConn 500
|
|
||||||
|
|
||||||
# run in anonymizing mode (0=no/1=yes)
|
|
||||||
Anonimize 0
|
|
||||||
|
|
||||||
# timeout for incoming connections (seconds)
|
|
||||||
ConnTimeout 6000
|
|
@ -5,10 +5,7 @@ OnionRouter 1
|
|||||||
# List of routers
|
# List of routers
|
||||||
RouterFile ../config/routers.or
|
RouterFile ../config/routers.or
|
||||||
|
|
||||||
# Private key
|
DataDirectory moria1
|
||||||
PrivateKeyFile moria1-private
|
|
||||||
SigningPrivateKeyFile moria1-private
|
|
||||||
CertFile moria1-cert
|
|
||||||
Nickname moria1
|
Nickname moria1
|
||||||
|
|
||||||
CoinWeight 0.01
|
CoinWeight 0.01
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
-----BEGIN RSA PRIVATE KEY-----
|
|
||||||
MIICXQIBAAKBgQDAQbpNbGMRIOYywCcvOlNxhiexBjEle8qAOppnLBFVN6cE1K6W
|
|
||||||
6QpsEuwb6L6GN8+M5OtzWVQRK4CkFA5J96afJ/N8WYBH+BiNu4HViCMGgYxIpriZ
|
|
||||||
RGPuyp2e5FTEaIlwm4y+lQLTWuGctQH/xjptIgiA6YaJXro0PecXsO60JwIDAP//
|
|
||||||
AoGBAKr0nL8o2Ze6mqtHK57YOb6xisihTCCinYh2pHXV0xdbXaxXUb2d4VROf6So
|
|
||||||
ruJDTp6UxDkLbR3ZjnJ0D9CxOCY+HHC17k+svimV6+bu22uvVJuwPM2kvZxYdM5n
|
|
||||||
mNvGBikwB6Uk8ZtQ+SDwa/sRr/Q49a2hJF6VjYn/HnqXKWJ/AkEA6uYt3AYaNcZ+
|
|
||||||
cI+evYSOJ9TaVZ5h+i9IWlYl+Oo72dXr1DvcNYxibh1yHgCf72QctM57Qxd6U+N4
|
|
||||||
7hQmARP3IQJBANGG7f6v5eDVG/Rd4gupBMCdcuwefRY1tMqUmwYP9Ps3ZsHSmNhk
|
|
||||||
aRKpVXXTFiJSwgI5LzgsjzMeaBVHvWFh6kcCQGMCjeDl91wX2Qz8pe4ZWCBECJbV
|
|
||||||
C7MGNu5Cc93BYCFuGwecjqqkqXWBIMWkGw166NBiRDiIktkEntJAElDQoh8CQQC4
|
|
||||||
vUXXUYFpio6eNNyf0HcnInkTs71RME9E4+bKcSAaFmTJzK3bh/NEDVyMrNcyvlYY
|
|
||||||
N+9f4HlqNXtOLnyhtuw7AkAYHlK/fgem67SYl9Uu+1XnVX3Ktn/RbW1jeLRF8E8+
|
|
||||||
urDuSzz4nbbRxDRmsZqMzsZlo0aH0DMsn+mbyTkDSQWA
|
|
||||||
-----END RSA PRIVATE KEY-----
|
|
@ -1,5 +0,0 @@
|
|||||||
-----BEGIN RSA PUBLIC KEY-----
|
|
||||||
MIGJAoGBAMBBuk1sYxEg5jLAJy86U3GGJ7EGMSV7yoA6mmcsEVU3pwTUrpbpCmwS
|
|
||||||
7BvovoY3z4zk63NZVBErgKQUDkn3pp8n83xZgEf4GI27gdWIIwaBjEimuJlEY+7K
|
|
||||||
nZ7kVMRoiXCbjL6VAtNa4Zy1Af/GOm0iCIDpholeujQ95xew7rQnAgMA//8=
|
|
||||||
-----END RSA PUBLIC KEY-----
|
|
@ -5,10 +5,7 @@ OnionRouter 1
|
|||||||
# List of routers
|
# List of routers
|
||||||
RouterFile ../config/routers.or
|
RouterFile ../config/routers.or
|
||||||
|
|
||||||
# Private key
|
DataDirectory moria2
|
||||||
PrivateKeyFile moria2-private
|
|
||||||
SigningPrivateKeyFile moria2-private
|
|
||||||
CertFile moria2-cert
|
|
||||||
Nickname moria2
|
Nickname moria2
|
||||||
|
|
||||||
CoinWeight 0.01
|
CoinWeight 0.01
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
-----BEGIN RSA PRIVATE KEY-----
|
|
||||||
MIICXAIBAAKBgQDV/xx0brnc9u+DBUkOJmp1/A4bbCLqIDVMnKPf9Ha/l7H4qExn
|
|
||||||
d0YDI2klpQ/O2q5GTuIRwTx3tKvPWd7NVLVLMkP1ZrMUr/YNjgpxf3VNjc+IevgJ
|
|
||||||
d4jSRdVJVkeHoqgcd3Y8XSJf7fjYncPvmBnPEKkapINBIUAidn5zrR5/WwIDAP//
|
|
||||||
AoGAfSHuFF8HGySbR3bxo7DINw9+izVxS9nrJFxICu8sEsnVQZwicS5mZaItUMlq
|
|
||||||
HL1pXtPk8oixVSxBFrrCi1DQZdvMWpcmtlhfdFfp+DZlJ9nTDpECjhzRcFv6l9FA
|
|
||||||
xyRN7GHtherauc7ToNpkY08YOVl215lsS31moUJbNnLpkecCQQDxOh6/oc1WBTlM
|
|
||||||
XXKo9yUYcMQauUUHVdeiAxUShwnJ2NXRJpCZHBX9C0jOCxDUIHC73DlazYQocnJN
|
|
||||||
9NQn+euvAkEA4xoUd8GKQFBfX34wxWXkSX+hN58mz+8VGqaTUo5UQgHu2VeIq9sq
|
|
||||||
xr4M7i5mMVipr0bIg1m8MIfP3Ysqahz2FQJAXv8SOukilZKEMua/nelxNSEdWuNw
|
|
||||||
YmPgXl01GZDnG7PPZzxnDbJtGyMcvsB6UQNXaFIRqCO2vuRQh6OBb3+KnwJABOnz
|
|
||||||
X1K1Wn2Xrd6e2MQ/Jr5DsUHIzsSRD3auIrVrFCCy1bK0jbx5t2qQHi9rMXiGlGty
|
|
||||||
fhoNJnH2t1fcMMv1NwJBAM7e/cUAcKhaVWg+iuTL36xmHec99Tnw04yHOwGxw0l8
|
|
||||||
BwO/vtDIX+gx6MIKYe+i4uNSVIt6Ww049eki5a56Xp8=
|
|
||||||
-----END RSA PRIVATE KEY-----
|
|
@ -1,5 +0,0 @@
|
|||||||
-----BEGIN RSA PUBLIC KEY-----
|
|
||||||
MIGJAoGBANX/HHRuudz274MFSQ4manX8DhtsIuogNUyco9/0dr+XsfioTGd3RgMj
|
|
||||||
aSWlD87arkZO4hHBPHe0q89Z3s1UtUsyQ/VmsxSv9g2OCnF/dU2Nz4h6+Al3iNJF
|
|
||||||
1UlWR4eiqBx3djxdIl/t+Nidw++YGc8QqRqkg0EhQCJ2fnOtHn9bAgMA//8=
|
|
||||||
-----END RSA PUBLIC KEY-----
|
|
@ -5,10 +5,7 @@ OnionRouter 1
|
|||||||
# List of routers
|
# List of routers
|
||||||
RouterFile ../config/routers.or
|
RouterFile ../config/routers.or
|
||||||
|
|
||||||
# Private key
|
DataDirectory moria3
|
||||||
PrivateKeyFile moria3-private
|
|
||||||
SigningPrivateKeyFile moria3-private
|
|
||||||
CertFile moria3-cert
|
|
||||||
Nickname moria3
|
Nickname moria3
|
||||||
|
|
||||||
CoinWeight 0.01
|
CoinWeight 0.01
|
||||||
|
@ -1,15 +0,0 @@
|
|||||||
-----BEGIN RSA PRIVATE KEY-----
|
|
||||||
MIICWwIBAAKBgQCX5DVgmjZGCEcHx09OigVOnc/FtcQ6VuXsxicADqMQl9/2TaFI
|
|
||||||
nG/9VaAdzs1ulcViIobd3Wv9ytMsIgTjgnH+gWmyqDHYj6R+zSHrul0ZgWCtrqlt
|
|
||||||
d4AYIcSW0AW+fDcfBa9OV5Lyxuovr0w2NzGTltxNvw8Env4xc7h0g+W95wIDAP//
|
|
||||||
AoGAcUkHEFlT/8NALQ9VN1qrm/PS37mWWVEUwJHxvD6m4JEF/AqV6muG+aoMGwdN
|
|
||||||
wl26GhD2QwLdA59+6pMx1Jgod+D9aM1F8zE3h0GnoncsJhtZn1aks0tmE7UNZLou
|
|
||||||
Nsb+hnZD/lDN8WbZoLoKHJV1TXIaQ79VlIzt46gILyN7Ol8CQQDFeZEOnXmddgnY
|
|
||||||
hXmfUujZbNs9Fa2M2GfnCxZuwn/lU7NebYcpkCoXp1ro+O1slOSYymdbAC8Di6H6
|
|
||||||
I8YsYiPPAkEAxOg5O3yPviEPHcav+UfEntd3U4Rebpry+KunuFriMf5wQNWSBmgY
|
|
||||||
d+jfOgaNOntfeNqywPDxU9/3+S9prneSaQJAdeBRTUme1HM8vcIR5gL0TlS/hkrJ
|
|
||||||
3b8+bHDTubrE8FkRhyvp/OIxckXwksbBBzQ7U8sM0qeDt6J9tvw3k8+8bQJAXSMM
|
|
||||||
JRUhulmxVhDOUMCo2qJYjRNLFa/T2D5ZROYRnyMuD3iT2CeYqmAJ5aX69sJNfKE9
|
|
||||||
6cxgkcKjNroJwJVDDwJAbXjnN3MUSKITvlcVpBTlGozwOVjiPJ+1sbgBy4HzcffG
|
|
||||||
UMHFK4hprBdtnV/kePtErGM3zlk+qh4VkUrp3MshEQ==
|
|
||||||
-----END RSA PRIVATE KEY-----
|
|
@ -1,5 +0,0 @@
|
|||||||
-----BEGIN RSA PUBLIC KEY-----
|
|
||||||
MIGJAoGBAJfkNWCaNkYIRwfHT06KBU6dz8W1xDpW5ezGJwAOoxCX3/ZNoUicb/1V
|
|
||||||
oB3OzW6VxWIiht3da/3K0ywiBOOCcf6BabKoMdiPpH7NIeu6XRmBYK2uqW13gBgh
|
|
||||||
xJbQBb58Nx8Fr05XkvLG6i+vTDY3MZOW3E2/DwSe/jFzuHSD5b3nAgMA//8=
|
|
||||||
-----END RSA PUBLIC KEY-----
|
|
@ -1,71 +1,78 @@
|
|||||||
# List of core onion routers in the network.
|
router moria.mit.edu 9001 9021 9031 800000
|
||||||
# Line format : address ORPort OPPort APPort DirPort bandwidth(bytes/s)
|
onion-key
|
||||||
# followed by the routers public key.
|
|
||||||
# ORport is where the router listens for routers/clients (speaking cells)
|
|
||||||
# APPort is where the router listens for applications (speaking socks)
|
|
||||||
# DirPort is where the router listens for directory download requests
|
|
||||||
|
|
||||||
# Router 1
|
|
||||||
router moria.mit.edu 9001 9021 9031 1000000
|
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
MIGJAoGBAMBBuk1sYxEg5jLAJy86U3GGJ7EGMSV7yoA6mmcsEVU3pwTUrpbpCmwS
|
MIGJAoGBANoIvHieyHUTzIacbnWOnyTyzGrLOdXqbcjz2GGMxyHEd5K1bO1ZBNHP
|
||||||
7BvovoY3z4zk63NZVBErgKQUDkn3pp8n83xZgEf4GI27gdWIIwaBjEimuJlEY+7K
|
9i5qLQpN5viFk2K2rEGuG8tFgDEzSWZEtBqv3NVfUdiumdERWMBwlaQ0MVK4C+jf
|
||||||
nZ7kVMRoiXCbjL6VAtNa4Zy1Af/GOm0iCIDpholeujQ95xew7rQnAgMA//8=
|
y5gZ8KI3o9ZictgPS1AQF+Kk932/vIHTuRIUKb4ILTnQilNvID0NAgMBAAE=
|
||||||
|
-----END RSA PUBLIC KEY-----
|
||||||
|
link-key
|
||||||
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
|
MIGJAoGBAPt97bGDd9siVjPd7Xuq2s+amMEOLIj9961aSdP6/OT+BS1Q4TX2dNOX
|
||||||
|
ZNAl63Z2fQISsR81+nfoqRLYCKxhajsD7LRvRTaRwUrWemVqFevmZ4nJrHw6FoU3
|
||||||
|
xNUIHRMA8X2DZ+l5qgnWZb7JU50ohhX5OpMSyysXnik51J8hD5mBAgMBAAE=
|
||||||
-----END RSA PUBLIC KEY-----
|
-----END RSA PUBLIC KEY-----
|
||||||
signing-key
|
signing-key
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
MIGJAoGBAMBBuk1sYxEg5jLAJy86U3GGJ7EGMSV7yoA6mmcsEVU3pwTUrpbpCmwS
|
MIGJAoGBAMHa0ZC/jo2Q2DrwKYF/6ZbmZ27PFYG91u4gUzzmZ/VXLpZ8wNzEV3oW
|
||||||
7BvovoY3z4zk63NZVBErgKQUDkn3pp8n83xZgEf4GI27gdWIIwaBjEimuJlEY+7K
|
nt+I61048fBiC1frT1/DZ351n2bLSk9zJbB6jyGZJn0380FPRX3+cXyXS0Gq8Ril
|
||||||
nZ7kVMRoiXCbjL6VAtNa4Zy1Af/GOm0iCIDpholeujQ95xew7rQnAgMA//8=
|
xkhMQf5XuNFUb8UmYPSOH4WErjvYjKvU+gfjbK/82Jo9SuHpYz+BAgMBAAE=
|
||||||
-----END RSA PUBLIC KEY-----
|
-----END RSA PUBLIC KEY-----
|
||||||
accept *:*
|
router-signature
|
||||||
|
-----BEGIN SIGNATURE-----
|
||||||
|
fYcz+14lf2kilu0zGrkyAvfjNk2GfL5QClhdCiBuqy5fIkUS/969WZSWg9BXi7pK
|
||||||
|
5+EgR9hvY4nAtJ2SBoE+lyOx7miuT/uGfH68wNkC0Le2gULcprDYFKAEc5i1o/aS
|
||||||
|
Y/kuZIFDm2FXQPrYM88CIHAq8/3amUCskf2vC7l2eNE=
|
||||||
|
-----END SIGNATURE-----
|
||||||
|
|
||||||
# Router 2
|
router moria.mit.edu 9002 9022 9032 800000
|
||||||
router moria.mit.edu 9002 9022 9032 1000000
|
onion-key
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
MIGJAoGBANX/HHRuudz274MFSQ4manX8DhtsIuogNUyco9/0dr+XsfioTGd3RgMj
|
MIGJAoGBAM4Cc/npgYC54XrYLC+grVxJp7PDmNO2DRRJOxKttBBtvLpnR1UaueTi
|
||||||
aSWlD87arkZO4hHBPHe0q89Z3s1UtUsyQ/VmsxSv9g2OCnF/dU2Nz4h6+Al3iNJF
|
kyknT5kmlx+ihgZF/jmye//2dDUp2+kK/kSkpRV4xnDLXZmed+sNSQxqmm9TtZQ9
|
||||||
1UlWR4eiqBx3djxdIl/t+Nidw++YGc8QqRqkg0EhQCJ2fnOtHn9bAgMA//8=
|
/hjpxhp5J9HmUTYhntBs+4E4CUKokmrI6oRLoln4SA39AX9QLPcnAgMBAAE=
|
||||||
|
-----END RSA PUBLIC KEY-----
|
||||||
|
link-key
|
||||||
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
|
MIGJAoGBAN7JVeCIJ7+0ZJew5ScOU58rTUqjGt1Z1Rkursc7WabEb8jno45VZwIs
|
||||||
|
dkjnl31i36KHyyS7kQdHgkvG5EiyZiRipFAcoTaYv3Gvf1No9cXL6IhT3y/37dJ/
|
||||||
|
kFPEMb/G2wdkJCC+D8fMwHBwMuqAg0JGuhoBOz0ArCgK3fq0BLilAgMBAAE=
|
||||||
-----END RSA PUBLIC KEY-----
|
-----END RSA PUBLIC KEY-----
|
||||||
signing-key
|
signing-key
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
MIGJAoGBANX/HHRuudz274MFSQ4manX8DhtsIuogNUyco9/0dr+XsfioTGd3RgMj
|
MIGJAoGBAOcrht/y5rkaahfX7sMe2qnpqoPibsjTSJaDvsUtaNP/Bq0MgNDGOR48
|
||||||
aSWlD87arkZO4hHBPHe0q89Z3s1UtUsyQ/VmsxSv9g2OCnF/dU2Nz4h6+Al3iNJF
|
rtwfqTRff275Edkp/UYw3G3vSgKCJr76/bqOHCmkiZrnPV1zxNfrK18gNw2Cxre0
|
||||||
1UlWR4eiqBx3djxdIl/t+Nidw++YGc8QqRqkg0EhQCJ2fnOtHn9bAgMA//8=
|
nTA+fD8JQqpPtb8b0SnG9kwy75eS//sRu7TErie2PzGMxrf9LH0LAgMBAAE=
|
||||||
-----END RSA PUBLIC KEY-----
|
-----END RSA PUBLIC KEY-----
|
||||||
|
router-signature
|
||||||
|
-----BEGIN SIGNATURE-----
|
||||||
|
Hyx1fJFJaR9j7OpEg4qdxKo+AMXIZl6250AuiYmvdcwWD2VBJyhSbptB/vMLQGrU
|
||||||
|
/PGWLlZus90xD/mKesc4b0CkwKD6eWI90Wn34JwBUGHalN/qm42tMMoq3slOWae0
|
||||||
|
Da9JmxiYqApXwwaHWR9WwNHmkXkWfvTmZDSFkdEMgV0=
|
||||||
|
-----END SIGNATURE-----
|
||||||
|
|
||||||
# Router 3
|
router moria.mit.edu 9003 9023 9033 800000
|
||||||
router moria.mit.edu 9003 9023 9033 1000000
|
onion-key
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
MIGJAoGBAJfkNWCaNkYIRwfHT06KBU6dz8W1xDpW5ezGJwAOoxCX3/ZNoUicb/1V
|
MIGJAoGBANS6J/Er9fYo03fjUUVesc7We9Z6xIevyDJH39pYS4NUlcr5ExYgSVFJ
|
||||||
oB3OzW6VxWIiht3da/3K0ywiBOOCcf6BabKoMdiPpH7NIeu6XRmBYK2uqW13gBgh
|
95aLCNx1x8Rf5YtiBKYuT3plBO/+rfuX+0iAGNkz/y3SlJVGz6aeptU3wN8CkvCL
|
||||||
xJbQBb58Nx8Fr05XkvLG6i+vTDY3MZOW3E2/DwSe/jFzuHSD5b3nAgMA//8=
|
zATEcnl4QSPhHX0wFB9A3t7wZ+Bat1PTI029lax/BkoS9JG5onHPAgMBAAE=
|
||||||
|
-----END RSA PUBLIC KEY-----
|
||||||
|
link-key
|
||||||
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
|
MIGJAoGBAKUMY8p+7LBu7dEJnOR9HqbfcD6c4/f9GqJt3o29uu4XJPD8z2XGVBik
|
||||||
|
pZBLijhYS6U7GFg0NLR4zBlsLyB8TxHeaz5KJidJjy+BfC01jz1xwVTYDlmGVpc1
|
||||||
|
0mw0Ag0ND6aOQKKhelxhTI3Bf0R9olEXuSUKEWx3EMIz2qhLd9oDAgMBAAE=
|
||||||
-----END RSA PUBLIC KEY-----
|
-----END RSA PUBLIC KEY-----
|
||||||
signing-key
|
signing-key
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
-----BEGIN RSA PUBLIC KEY-----
|
||||||
MIGJAoGBAJfkNWCaNkYIRwfHT06KBU6dz8W1xDpW5ezGJwAOoxCX3/ZNoUicb/1V
|
MIGJAoGBAMqgq83cwzSid2LSvzsn2rvkD8U0tWvqF6PuQAsKP3QHFqtBO+66pnIm
|
||||||
oB3OzW6VxWIiht3da/3K0ywiBOOCcf6BabKoMdiPpH7NIeu6XRmBYK2uqW13gBgh
|
CbiY2e6o01tmR47t557LuUCodEc8Blggxjg3ZEzvP42hsGB9LwQbcrU7grPRk0G0
|
||||||
xJbQBb58Nx8Fr05XkvLG6i+vTDY3MZOW3E2/DwSe/jFzuHSD5b3nAgMA//8=
|
IltsOF9TZ+66gCeU7LxExLdAMqT2Tx6VT4IREPJMeNxSiceEjbABAgMBAAE=
|
||||||
-----END RSA PUBLIC KEY-----
|
|
||||||
|
|
||||||
router moria.mit.edu 9004 9024 0 1000000
|
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
|
||||||
MIGJAoGBAKD2BDZQpGq/aAbZ7t+/7qktZVEbhUGe097gIjWH9gXcIOIm0CJMe3rN
|
|
||||||
MsBJsQMi5Uwqrz+Invb5n6bswrNlJp/bCKBhGTvUCfxg7c8xZy71PPSIPnTg1qXl
|
|
||||||
p5fyAkgCYkZNgEEZzQDHv1GRvLCs92kURjSJE5y8QU0dXfbzms8PAgMA//8=
|
|
||||||
-----END RSA PUBLIC KEY-----
|
|
||||||
|
|
||||||
router mosg.cl.cam.ac.uk 9005 9025 0 1000000
|
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
|
||||||
MIGJAoGBAMMHEjhhawM6S14ETFVcvByU7D/baN2JMcCweKKJ7zcSurDnpgRH/Uo7
|
|
||||||
05+bZE3BCy4OkAqQbGlKd/ejBOuXjEtS0mJo5xwDX9StKguhgFRk60hhrF2OFJm4
|
|
||||||
VLItXA6U2NLOrc+FBCv/9laLpBrxOb8Wuct0l/lyZ2/OfE9yYhC3AgMA//8=
|
|
||||||
-----END RSA PUBLIC KEY-----
|
|
||||||
|
|
||||||
router 66.17.17.207 9006 9026 0 1000000
|
|
||||||
-----BEGIN RSA PUBLIC KEY-----
|
|
||||||
MIGJAoGBAL5cpmH34kVfmHd+A00vMton3pLGHAVf7BYkSMif8e/O5zXTUXRi4w78
|
|
||||||
jDcGNo2yFM3htTpT5/tWs/Z2+B/mx8Kz+AhHzZ9z0PdQreDSqxXjF+jmfCyx9Teq
|
|
||||||
jU9QA3GZiguLYV2pcs6Oll20svPSt0WRAR4YUmDeQmEYIZdBGnrVAgMBAAE=
|
|
||||||
-----END RSA PUBLIC KEY-----
|
-----END RSA PUBLIC KEY-----
|
||||||
|
router-signature
|
||||||
|
-----BEGIN SIGNATURE-----
|
||||||
|
xm7Nmk7EmtDIrXZ/Hh2LBbG3oTuwCjY3XrVHpIbg6ttuoYJx3Ai1MdOHHBbUDVdz
|
||||||
|
bRE6WV5fXuVgmgcWLP6p364Vymw6i2ff/lkEMqHV4NOAWZ1RbFwZQ5OjEAjXIhH/
|
||||||
|
VlVX83wBSM0EefJwwXM7H075MU1MB+f2yRlTZ0/Xp0U=
|
||||||
|
-----END SIGNATURE-----
|
||||||
|
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
# Sample configuration file for smtpap.
|
|
||||||
|
|
||||||
# Local port on which the onion proxy is running.
|
|
||||||
OnionProxy 3000
|
|
||||||
|
|
||||||
# Maximum number of incoming connections.
|
|
||||||
MaxConn 100
|
|
||||||
|
|
||||||
# Run in anonymizing mode.
|
|
||||||
Anonimize 0
|
|
||||||
|
|
||||||
# Timeout for incoming connections.
|
|
||||||
ConnTimeout 6000
|
|
@ -1,17 +0,0 @@
|
|||||||
# Configuration file for or
|
|
||||||
|
|
||||||
# List of routers
|
|
||||||
RouterFile ../config/routers.or
|
|
||||||
|
|
||||||
# Private key
|
|
||||||
PrivateKeyFile ts4-private
|
|
||||||
|
|
||||||
CoinWeight 0.0001
|
|
||||||
|
|
||||||
ORPort 9004
|
|
||||||
OPPort 9014
|
|
||||||
APPort 9024
|
|
||||||
|
|
||||||
# Maximum number of connections.
|
|
||||||
MaxConn 900
|
|
||||||
|
|
@ -1,15 +0,0 @@
|
|||||||
-----BEGIN RSA PRIVATE KEY-----
|
|
||||||
MIICWwIBAAKBgQCg9gQ2UKRqv2gG2e7fv+6pLWVRG4VBntPe4CI1h/YF3CDiJtAi
|
|
||||||
THt6zTLASbEDIuVMKq8/iJ72+Z+m7MKzZSaf2wigYRk71An8YO3PMWcu9Tz0iD50
|
|
||||||
4Nal5aeX8gJIAmJGTYBBGc0Ax79RkbywrPdpFEY0iROcvEFNHV3285rPDwIDAP//
|
|
||||||
AoGATT1a0ssVMK55wYNlO5N9QXuiEcWef1OOTokr84vpgklbsOEA0PY0Vum+PDOY
|
|
||||||
vHIDKcfFT+oG8dpKjow7GgCrwK4sDb5m9unWyWVPBlTntCUsjg8IKOr0a5/g1s/M
|
|
||||||
vb8BVcTeTEbh/VpUzHNQVb3rq+iaWj2bi/8NVUNqfP05n78CQQDOXsIOjgaI3jdc
|
|
||||||
Agp/g7nKQpqQbmBEnyKCo7tQHMLpn8XCJuua6xfuXssqKGKEp+tKsYE421P7aSYh
|
|
||||||
TQu939m9AkEAx6uhWQvSm7rIvkgKMuMCDOM5tjdqfDZ3PuTv2i4VhZ3psJhg0oT9
|
|
||||||
r5KFw/Uwam126Mmh5h+M6LBgX7o6DVDquwJAfGUsX9BNkqd8h+sm3Rl0g3X+/pP2
|
|
||||||
jPN00bGg5p/swJz14cg1hhvBDYijALFOa4Je3umzbMfo/BDSc58Tdeu2+wJACgFv
|
|
||||||
szn+47Sby8S/55Svqvz93VNcNV2gD1LgJ7r+5xT0zsIxfD4ORF6H+n2/ztUTDnVJ
|
|
||||||
BiUS4KvXQCNBE/Pl9wJAMnYAfMOolyh96NWCH9ZN3OJmWojpgXjMlw5H02kkRKpZ
|
|
||||||
HWnksj3ErNlCo5juXaaOwESBZBB/5+ngsIMPwWT0lg==
|
|
||||||
-----END RSA PRIVATE KEY-----
|
|
@ -38,6 +38,10 @@ static int find_str_in_str(const char *str, int str_len,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int find_on_inbuf(char *string, int string_len, buf_t *buf) {
|
||||||
|
return find_str_in_str(string, string_len, buf->buf, buf->datalen);
|
||||||
|
}
|
||||||
|
|
||||||
/* Create and return a new buf of size 'size'
|
/* Create and return a new buf of size 'size'
|
||||||
*/
|
*/
|
||||||
buf_t *buf_new_with_capacity(size_t size) {
|
buf_t *buf_new_with_capacity(size_t size) {
|
||||||
@ -206,7 +210,7 @@ int flush_buf_tls(tor_tls *tls, buf_t *buf, int *buf_flushlen)
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
int write_to_buf(char *string, int string_len, buf_t *buf) {
|
int write_to_buf(const char *string, int string_len, buf_t *buf) {
|
||||||
|
|
||||||
/* append string to buf (growing as needed, return -1 if "too big")
|
/* append string to buf (growing as needed, return -1 if "too big")
|
||||||
* return total number of bytes on the buf
|
* return total number of bytes on the buf
|
||||||
@ -285,11 +289,12 @@ int fetch_from_buf_http(buf_t *buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define CONTENT_LENGTH "\r\nContent-Length: "
|
#define CONTENT_LENGTH "\r\nContent-Length: "
|
||||||
i = find_str_in_str(CONTENT_LENGTH, sizeof(CONTENT_LENGTH),
|
i = find_str_in_str(CONTENT_LENGTH, strlen(CONTENT_LENGTH),
|
||||||
headers, headerlen);
|
headers, headerlen);
|
||||||
if(i > 0) {
|
if(i > 0) {
|
||||||
contentlen = atoi(headers+i);
|
contentlen = atoi(headers+i);
|
||||||
/* XXX What if content-length is malformed? */
|
/* XXX What if content-length is malformed? */
|
||||||
|
log_fn(LOG_DEBUG,"Got a contentlen of %d.",contentlen);
|
||||||
if(bodylen < contentlen) {
|
if(bodylen < contentlen) {
|
||||||
log_fn(LOG_DEBUG,"body not all here yet.");
|
log_fn(LOG_DEBUG,"body not all here yet.");
|
||||||
return 0; /* not all there yet */
|
return 0; /* not all there yet */
|
||||||
@ -307,7 +312,7 @@ int fetch_from_buf_http(buf_t *buf,
|
|||||||
body_out[bodylen] = 0; /* null terminate it */
|
body_out[bodylen] = 0; /* null terminate it */
|
||||||
}
|
}
|
||||||
buf->datalen -= (headerlen+bodylen);
|
buf->datalen -= (headerlen+bodylen);
|
||||||
memmove(buf, buf->buf+headerlen+bodylen, buf->datalen);
|
memmove(buf->buf, buf->buf+headerlen+bodylen, buf->datalen);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -401,15 +406,6 @@ int fetch_from_buf_socks(buf_t *buf,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int find_on_inbuf(char *string, int string_len, buf_t *buf) {
|
|
||||||
/* find first instance of needle 'string' on haystack 'buf'. return how
|
|
||||||
* many bytes from the beginning of buf to the end of string.
|
|
||||||
* If it's not there, return -1.
|
|
||||||
*/
|
|
||||||
|
|
||||||
return find_str_in_str(string, string_len, buf->buf, buf->datalen);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Local Variables:
|
Local Variables:
|
||||||
mode:c
|
mode:c
|
||||||
|
@ -304,19 +304,14 @@ static int connection_tls_finish_handshake(connection_t *conn) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
log_fn(LOG_DEBUG,"The router's pk matches the one we meant to connect to. Good.");
|
log_fn(LOG_DEBUG,"The router's pk matches the one we meant to connect to. Good.");
|
||||||
crypto_free_pk_env(pk);
|
|
||||||
} else {
|
} else {
|
||||||
if(connection_exact_get_by_addr_port(router->addr,router->or_port)) {
|
if(connection_exact_get_by_addr_port(router->addr,router->or_port)) {
|
||||||
log_fn(LOG_INFO,"That router is already connected. Dropping.");
|
log_fn(LOG_INFO,"That router is already connected. Dropping.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
conn->link_pkey = pk;
|
connection_or_init_conn_from_router(conn, router);
|
||||||
conn->bandwidth = router->bandwidth;
|
|
||||||
conn->addr = router->addr, conn->port = router->or_port;
|
|
||||||
if(conn->address)
|
|
||||||
free(conn->address);
|
|
||||||
conn->address = strdup(router->address);
|
|
||||||
}
|
}
|
||||||
|
crypto_free_pk_env(pk);
|
||||||
} else { /* it's an OP */
|
} else { /* it's an OP */
|
||||||
conn->bandwidth = DEFAULT_BANDWIDTH_OP;
|
conn->bandwidth = DEFAULT_BANDWIDTH_OP;
|
||||||
}
|
}
|
||||||
@ -615,7 +610,7 @@ int connection_handle_write(connection_t *conn) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int connection_write_to_buf(char *string, int len, connection_t *conn) {
|
int connection_write_to_buf(const char *string, int len, connection_t *conn) {
|
||||||
|
|
||||||
if(!len)
|
if(!len)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -73,6 +73,18 @@ int connection_or_finished_flushing(connection_t *conn) {
|
|||||||
|
|
||||||
/*********************/
|
/*********************/
|
||||||
|
|
||||||
|
void connection_or_init_conn_from_router(connection_t *conn, routerinfo_t *router) {
|
||||||
|
conn->addr = router->addr;
|
||||||
|
conn->port = router->or_port;
|
||||||
|
conn->bandwidth = router->bandwidth;
|
||||||
|
conn->onion_pkey = crypto_pk_dup_key(router->onion_pkey);
|
||||||
|
conn->link_pkey = crypto_pk_dup_key(router->link_pkey);
|
||||||
|
conn->identity_pkey = crypto_pk_dup_key(router->identity_pkey);
|
||||||
|
if(conn->address)
|
||||||
|
free(conn->address);
|
||||||
|
conn->address = strdup(router->address);
|
||||||
|
}
|
||||||
|
|
||||||
connection_t *connection_or_connect(routerinfo_t *router) {
|
connection_t *connection_or_connect(routerinfo_t *router) {
|
||||||
connection_t *conn;
|
connection_t *conn;
|
||||||
|
|
||||||
@ -96,12 +108,7 @@ connection_t *connection_or_connect(routerinfo_t *router) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* set up conn so it's got all the data we need to remember */
|
/* set up conn so it's got all the data we need to remember */
|
||||||
conn->addr = router->addr;
|
connection_or_init_conn_from_router(conn, router);
|
||||||
conn->port = router->or_port;
|
|
||||||
conn->bandwidth = router->bandwidth;
|
|
||||||
conn->onion_pkey = crypto_pk_dup_key(router->onion_pkey);
|
|
||||||
conn->link_pkey = crypto_pk_dup_key(router->link_pkey);
|
|
||||||
conn->address = strdup(router->address);
|
|
||||||
|
|
||||||
if(connection_add(conn) < 0) { /* no space, forget it */
|
if(connection_add(conn) < 0) { /* no space, forget it */
|
||||||
connection_free(conn);
|
connection_free(conn);
|
||||||
|
@ -19,7 +19,6 @@ static int directorylen=0;
|
|||||||
static int directory_dirty=1;
|
static int directory_dirty=1;
|
||||||
|
|
||||||
static char fetchstring[] = "GET / HTTP/1.0\r\n\r\n";
|
static char fetchstring[] = "GET / HTTP/1.0\r\n\r\n";
|
||||||
static char uploadstring[] = "POST / HTTP/1.0\r\n\r\n";
|
|
||||||
static char answerstring[] = "HTTP/1.0 200 OK\r\n\r\n";
|
static char answerstring[] = "HTTP/1.0 200 OK\r\n\r\n";
|
||||||
|
|
||||||
/********* END VARIABLES ************/
|
/********* END VARIABLES ************/
|
||||||
@ -88,7 +87,8 @@ void directory_initiate_command(routerinfo_t *router, int command) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int directory_send_command(connection_t *conn, int command) {
|
static int directory_send_command(connection_t *conn, int command) {
|
||||||
char *s;
|
const char *s;
|
||||||
|
char tmp[8192];
|
||||||
|
|
||||||
assert(conn && conn->type == CONN_TYPE_DIR);
|
assert(conn && conn->type == CONN_TYPE_DIR);
|
||||||
|
|
||||||
@ -106,8 +106,9 @@ static int directory_send_command(connection_t *conn, int command) {
|
|||||||
log_fn(LOG_DEBUG,"Failed to get my descriptor.");
|
log_fn(LOG_DEBUG,"Failed to get my descriptor.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if(connection_write_to_buf(uploadstring, strlen(uploadstring), conn) < 0 ||
|
snprintf(tmp, sizeof(tmp), "POST / HTTP/1.0\r\nContent-Length: %d\r\n\r\n%s",
|
||||||
connection_write_to_buf(s, strlen(s), conn) < 0) {
|
strlen(s), s);
|
||||||
|
if(connection_write_to_buf(tmp, strlen(tmp), conn) < 0) {
|
||||||
log_fn(LOG_DEBUG,"Couldn't write post/descriptor to buffer.");
|
log_fn(LOG_DEBUG,"Couldn't write post/descriptor to buffer.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -192,7 +193,7 @@ int connection_dir_process_inbuf(connection_t *conn) {
|
|||||||
|
|
||||||
static int directory_handle_command(connection_t *conn) {
|
static int directory_handle_command(connection_t *conn) {
|
||||||
char headers[1024];
|
char headers[1024];
|
||||||
char body[1024];
|
char body[50000]; /* XXX */
|
||||||
|
|
||||||
assert(conn && conn->type == CONN_TYPE_DIR);
|
assert(conn && conn->type == CONN_TYPE_DIR);
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ static int init_descriptor(void);
|
|||||||
/********* START VARIABLES **********/
|
/********* START VARIABLES **********/
|
||||||
|
|
||||||
extern char *conn_type_to_string[];
|
extern char *conn_type_to_string[];
|
||||||
extern char *conn_state_to_string[][15];
|
extern char *conn_state_to_string[][_CONN_TYPE_MAX+1];
|
||||||
|
|
||||||
or_options_t options; /* command-line and config-file options */
|
or_options_t options; /* command-line and config-file options */
|
||||||
int global_read_bucket; /* max number of bytes I can read this second */
|
int global_read_bucket; /* max number of bytes I can read this second */
|
||||||
@ -320,10 +320,12 @@ static void check_conn_marked(int i) {
|
|||||||
log_fn(LOG_DEBUG,"Cleaning up connection.");
|
log_fn(LOG_DEBUG,"Cleaning up connection.");
|
||||||
if(conn->s >= 0) { /* might be an incomplete edge connection */
|
if(conn->s >= 0) { /* might be an incomplete edge connection */
|
||||||
/* FIXME there's got to be a better way to check for this -- and make other checks? */
|
/* FIXME there's got to be a better way to check for this -- and make other checks? */
|
||||||
if(connection_speaks_cells(conn) && conn->state != OR_CONN_STATE_CONNECTING)
|
if(connection_speaks_cells(conn)) {
|
||||||
flush_buf_tls(conn->tls, conn->outbuf, &conn->outbuf_flushlen);
|
if(conn->state == OR_CONN_STATE_OPEN)
|
||||||
else
|
flush_buf_tls(conn->tls, conn->outbuf, &conn->outbuf_flushlen);
|
||||||
|
} else {
|
||||||
flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen);
|
flush_buf(conn->s, conn->outbuf, &conn->outbuf_flushlen);
|
||||||
|
}
|
||||||
if(connection_wants_to_flush(conn)) /* not done flushing */
|
if(connection_wants_to_flush(conn)) /* not done flushing */
|
||||||
log_fn(LOG_WARNING,"Conn (socket %d) still wants to flush. Losing %d bytes!",conn->s, (int)buf_datalen(conn->inbuf));
|
log_fn(LOG_WARNING,"Conn (socket %d) still wants to flush. Losing %d bytes!",conn->s, (int)buf_datalen(conn->inbuf));
|
||||||
}
|
}
|
||||||
@ -642,7 +644,9 @@ static int do_main_loop(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(options.OnionRouter) {
|
if(options.OnionRouter) {
|
||||||
cpu_init(); /* launch cpuworkers. Need to do this *after* we've read the private key. */
|
cpu_init(); /* launch cpuworkers. Need to do this *after* we've read the onion key. */
|
||||||
|
if(options.DirPort == 0) /* not a dirserver; XXX eventually do this for dirservers too */
|
||||||
|
router_upload_desc_to_dirservers(); /* upload our descriptor to all dirservers */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* start up the necessary connections based on which ports are
|
/* start up the necessary connections based on which ports are
|
||||||
@ -981,13 +985,20 @@ static char descriptor[8192];
|
|||||||
/* XXX should this replace my_routerinfo? */
|
/* XXX should this replace my_routerinfo? */
|
||||||
static routerinfo_t *desc_routerinfo;
|
static routerinfo_t *desc_routerinfo;
|
||||||
const char *router_get_my_descriptor(void) {
|
const char *router_get_my_descriptor(void) {
|
||||||
|
log_fn(LOG_DEBUG,"my desc is '%s'",descriptor);
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int init_descriptor(void) {
|
static int init_descriptor(void) {
|
||||||
routerinfo_t *ri;
|
routerinfo_t *ri;
|
||||||
|
char localhostname[256];
|
||||||
|
|
||||||
|
if(gethostname(localhostname,sizeof(localhostname)) < 0) {
|
||||||
|
log_fn(LOG_ERR,"Error obtaining local hostname");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
ri = tor_malloc(sizeof(routerinfo_t));
|
ri = tor_malloc(sizeof(routerinfo_t));
|
||||||
ri->address = strdup("XXXXXXX"); /*XXX*/
|
ri->address = strdup(localhostname);
|
||||||
ri->nickname = strdup(options.Nickname);
|
ri->nickname = strdup(options.Nickname);
|
||||||
/* No need to set addr. ???? */
|
/* No need to set addr. ???? */
|
||||||
ri->or_port = options.ORPort;
|
ri->or_port = options.ORPort;
|
||||||
|
@ -434,6 +434,8 @@ typedef struct {
|
|||||||
|
|
||||||
/********************************* buffers.c ***************************/
|
/********************************* buffers.c ***************************/
|
||||||
|
|
||||||
|
int find_on_inbuf(char *string, int string_len, buf_t *buf);
|
||||||
|
|
||||||
buf_t *buf_new();
|
buf_t *buf_new();
|
||||||
buf_t *buf_new_with_capacity(size_t size);
|
buf_t *buf_new_with_capacity(size_t size);
|
||||||
void buf_free(buf_t *buf);
|
void buf_free(buf_t *buf);
|
||||||
@ -448,7 +450,7 @@ int read_to_buf_tls(tor_tls *tls, int at_most, buf_t *buf);
|
|||||||
int flush_buf(int s, buf_t *buf, int *buf_flushlen);
|
int flush_buf(int s, buf_t *buf, int *buf_flushlen);
|
||||||
int flush_buf_tls(tor_tls *tls, buf_t *buf, int *buf_flushlen);
|
int flush_buf_tls(tor_tls *tls, buf_t *buf, int *buf_flushlen);
|
||||||
|
|
||||||
int write_to_buf(char *string, int string_len, buf_t *buf);
|
int write_to_buf(const char *string, int string_len, buf_t *buf);
|
||||||
int fetch_from_buf(char *string, int string_len, buf_t *buf);
|
int fetch_from_buf(char *string, int string_len, buf_t *buf);
|
||||||
int fetch_from_buf_http(buf_t *buf,
|
int fetch_from_buf_http(buf_t *buf,
|
||||||
char *headers_out, int max_headerlen,
|
char *headers_out, int max_headerlen,
|
||||||
@ -456,7 +458,6 @@ int fetch_from_buf_http(buf_t *buf,
|
|||||||
int fetch_from_buf_socks(buf_t *buf,
|
int fetch_from_buf_socks(buf_t *buf,
|
||||||
char *addr_out, int max_addrlen,
|
char *addr_out, int max_addrlen,
|
||||||
uint16_t *port_out);
|
uint16_t *port_out);
|
||||||
int find_on_inbuf(char *string, int string_len, buf_t *buf);
|
|
||||||
|
|
||||||
/********************************* circuit.c ***************************/
|
/********************************* circuit.c ***************************/
|
||||||
|
|
||||||
@ -529,7 +530,7 @@ int connection_wants_to_flush(connection_t *conn);
|
|||||||
int connection_outbuf_too_full(connection_t *conn);
|
int connection_outbuf_too_full(connection_t *conn);
|
||||||
int connection_flush_buf(connection_t *conn);
|
int connection_flush_buf(connection_t *conn);
|
||||||
int connection_handle_write(connection_t *conn);
|
int connection_handle_write(connection_t *conn);
|
||||||
int connection_write_to_buf(char *string, int len, connection_t *conn);
|
int connection_write_to_buf(const char *string, int len, connection_t *conn);
|
||||||
|
|
||||||
int connection_receiver_bucket_should_increase(connection_t *conn);
|
int connection_receiver_bucket_should_increase(connection_t *conn);
|
||||||
|
|
||||||
@ -562,6 +563,7 @@ int connection_exit_connect(connection_t *conn);
|
|||||||
int connection_or_process_inbuf(connection_t *conn);
|
int connection_or_process_inbuf(connection_t *conn);
|
||||||
int connection_or_finished_flushing(connection_t *conn);
|
int connection_or_finished_flushing(connection_t *conn);
|
||||||
|
|
||||||
|
void connection_or_init_conn_from_router(connection_t *conn, routerinfo_t *router);
|
||||||
connection_t *connection_or_connect(routerinfo_t *router);
|
connection_t *connection_or_connect(routerinfo_t *router);
|
||||||
|
|
||||||
int connection_write_cell_to_buf(const cell_t *cellp, connection_t *conn);
|
int connection_write_cell_to_buf(const cell_t *cellp, connection_t *conn);
|
||||||
@ -658,6 +660,7 @@ int onion_skin_client_handshake(crypto_dh_env_t *handshake_state,
|
|||||||
int learn_my_address(struct sockaddr_in *me);
|
int learn_my_address(struct sockaddr_in *me);
|
||||||
void router_retry_connections(void);
|
void router_retry_connections(void);
|
||||||
routerinfo_t *router_pick_directory_server(void);
|
routerinfo_t *router_pick_directory_server(void);
|
||||||
|
void router_upload_desc_to_dirservers(void);
|
||||||
routerinfo_t *router_get_by_addr_port(uint32_t addr, uint16_t port);
|
routerinfo_t *router_get_by_addr_port(uint32_t addr, uint16_t port);
|
||||||
routerinfo_t *router_get_by_link_pk(crypto_pk_env_t *pk);
|
routerinfo_t *router_get_by_link_pk(crypto_pk_env_t *pk);
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -37,14 +37,14 @@ router_resolve_directory(directory_t *dir);
|
|||||||
|
|
||||||
int learn_my_address(struct sockaddr_in *me) {
|
int learn_my_address(struct sockaddr_in *me) {
|
||||||
/* local host information */
|
/* local host information */
|
||||||
char localhostname[512];
|
char localhostname[256];
|
||||||
struct hostent *localhost;
|
struct hostent *localhost;
|
||||||
static struct sockaddr_in answer;
|
static struct sockaddr_in answer;
|
||||||
static int already_learned=0;
|
static int already_learned=0;
|
||||||
|
|
||||||
if(!already_learned) {
|
if(!already_learned) {
|
||||||
/* obtain local host information */
|
/* obtain local host information */
|
||||||
if(gethostname(localhostname,512) < 0) {
|
if(gethostname(localhostname,sizeof(localhostname)) < 0) {
|
||||||
log_fn(LOG_ERR,"Error obtaining local hostname");
|
log_fn(LOG_ERR,"Error obtaining local hostname");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -100,6 +100,20 @@ routerinfo_t *router_pick_directory_server(void) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void router_upload_desc_to_dirservers(void) {
|
||||||
|
int i;
|
||||||
|
routerinfo_t *router;
|
||||||
|
|
||||||
|
if(!directory)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(i=0;i<directory->n_routers;i++) {
|
||||||
|
router = directory->routers[i];
|
||||||
|
if(router->dir_port > 0)
|
||||||
|
directory_initiate_command(router, DIR_CONN_STATE_CONNECTING_UPLOAD);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
routerinfo_t *router_get_by_addr_port(uint32_t addr, uint16_t port) {
|
routerinfo_t *router_get_by_addr_port(uint32_t addr, uint16_t port) {
|
||||||
int i;
|
int i;
|
||||||
routerinfo_t *router;
|
routerinfo_t *router;
|
||||||
|
Loading…
Reference in New Issue
Block a user