Advertisement
Uisgdlyast

Hidden Service Setup Guide (by Ringo) a little outdated

Jun 24th, 2013
975
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 70.06 KB | None | 0 0
  1. Note some formatting has been messed up. To get the original pdf and script click the links below:
  2. PDF: https://docs.google.com/file/d/0Bw8hxGGZbI5dR2xmY1VuZmQ3ZFk/edit?usp=sharing
  3. script: https://docs.google.com/file/d/0Bw8hxGGZbI5dS3dNdmJrb3BzOEk/edit?usp=sharing
  4.  
  5. There is also a git repository with a lot of automated scripts to use, I would suggest reading both, finding the methods that work for you.
  6. https://github.com/whackashoe/tor-hidden-service-setup/
  7.  
  8. Hidden Service Setup Guide for Newbies
  9. Version .2
  10. So, you've decided to set up a hidden service and join the information underground? That's fantastic,
  11. but be aware of what you're getting into. If you're setting up a hidden service, you're probably doing so
  12. because whatever you're publishing could put you at risk. Maybe it's legal risk, maybe you might lose
  13. your job, maybe your friends might disown you, or maybe you might end up in prison for the rest of
  14. your life or worse. It could also be that you're a Tor fanatic and that you're setting up a hidden service
  15. to help those who are taking the risk.
  16. Tor is an amazing technology and there's lots of technology that when combined with it can make your
  17. hidden service almost bulletproof, but that doesn't mean you can remove risk from the equation.
  18. Whatever it is you're doing, you need to accept the risk and the potential consequences. If you aren't
  19. prepared to take the fall, you might want to reconsider what you're doing or how you're doing it.
  20. Nobody has ever been caught for running a hidden service and those who will be will most likely do so
  21. through their own stupid mistakes - Tor won't be at fault. Tor is beautiful and so is the resistance to the
  22. current system that is inherently built into it. If you're ready to join the revolution and fall in love, be
  23. my guest. All good things in life, all struggles must be won. There is no easy way, this is a conflict.
  24. Since you've taken it up to learn how to arm yourself, I'll show you how to use your weapons.
  25. Just as a clarification, I am not a lawyer. I'm not qualified to give legal advice. You should learn about
  26. what you're doing before you do it. This guide is not the be-all end-all. You're going to have to use
  27. your brain and some common sense if you're going to survive out here. This guide is written for
  28. laypersons, but that isn't an excuse for you not to do your research. I didn't write this myself, it comes
  29. from decades of research and work by individuals too numerous to name. People have gotten hurt,
  30. people have been thrown in jail, and some people have been killed simply for taking the red pill.
  31. I didn't write this guide to help people break laws. If you do something stupid with this, it's your fault.
  32. This, like the Tor software, is a tool and how you use it is up to you.
  33. There is no warranty of fitness or accuracy on this guide whatsoever. You are using it at your own risk
  34. and if you mess something up, it's not my fault. By using this guide, you agree to hold its author(s)
  35. harmless for any damage that may arise as a result.
  36. This guide is anti-copyright. You are free to mercilessly update it, edit it, share it, etc. If you give me
  37. attribution, that's great but absolutely not required or expected. If you have any questions/clafifications/
  38. edits to the guide, you can reach me at ringo{at}hackbloc.org. My PGP key is below:
  39. -----BEGIN PGP PUBLIC KEY BLOCK-----
  40. Version: GnuPG v1.4.9 (GNU/Linux)
  41. mQGiBEniUKIRBADfn8kULsRd3si+zPnVbeVp4C/cjxfOxvPURPjRMDPRZPuDuEI5
  42. QIiMP+lZs0Y1BS/zubrwJ/R+knZW0dfkCbd0IBqhtcci4ZiDXRCNxxYow0MysweG
  43. sbZE0QY4T2u40ffOLs9m/ENiDebUxknTyAg8/Jim9aBdEDgurCc7HCX+iwCghfLh
  44. 1POMWQRkXB4zUmXQfp+u+0MD/j5SUN6ct6fH4ex3L/WeIHRA+PZXBEpQv5HCwcYO
  45. 9VAtS0KYTtrBePXuhabjmiyhWIVsPHa8A+5RW3ONkK4gQ71E7sh2nu44p0rOSVkz
  46. 9/ZQiHVCjxZJNhvCsabIFT2/G8OFo2XPnJ0+8Gfluueb5a/HKArUWHIvkws82kQ5
  47. 75RJBACJp436/Bvk/CpKDkIG8v/4dQkyNKhv5AEAbx3jNjdOAxNSK0tBaQAulgCk
  48. GFNkk+wpv6OWaawgQzFh71KvmEswSLObXk+S6WZgC+Epy4XmfzzDG/gIHD0VuBQ+
  49. 2D8JzFT/TiDMu6wdYu4kgDg5sO4a5Yzn7xoYMF5YWzXnPKhXi7QacmluZ28gPHJp
  50. bmdvQGhhY2tibG9jLm9yZz6IZgQTEQIAJgUCSeJQogIbIwUJAeEzgAYLCQgHAwIE
  51. FQIIAwQWAgMBAh4BAheAAAoJEFUc7QiIWsvrdtkAn3KtPdxxC/qWmmIFZ4Nc4cFE
  52. as42AJoDwdk/N9I3sPvc91wTTlbsKhoHLrkEDQRJ4lCiEBAAs2JYGr1k1Dgi3DMyh0ziX+22tIWWyIJoGKWKFspA7nGeniOBodLBvR+POtqqGCh+bkm9I0X/YMF9oVcP
  53. xXBql7H6E4JSgtCk7xtohDpLlfcCpsddVxcJdXYLynTUMcmJtCER0bCNIkTmYoV7
  54. uNXAqmUNAp4zaI70yWsidpAVHme0+sBUYNinfBdlcaMddzslbDtRV7yGKgvW3E5e
  55. hPNTJ0pWF6WJg4VsEOFoP7pldtQ4YWScskvuCk957K4t4Of3QZs13Nn9sQZleFJU
  56. E2L1bxEHuSqY/f1F/pbKmc7in8qkoBBAyhUbzCNxxELdof3uJpBy0pw0468GvSyb
  57. Z4jyh2XFvxFFAcelzc453y9GOylIC0OQczkrzOa6QrIWQSmeCzn/byjLoi+TRFve
  58. usRmJn5H9MJg+k+mG5LJM2mcyQJU2UOPDvSurKmk50vByBED6Qn5CvhXJp18H6Uk
  59. 2r+PICG4h8aN9KZpSrMAqYggyKgAxHTlCaQzGCwvJGiX6lx6iIm2GLoqeHdRHZZX
  60. 9XognVcbTwUWJkL0LR9nhm5U0GhFGM9eRdLw89C/Z/s1/Q/QLjoDh60qXcYo+vFS
  61. 5bJtiT52HnlA002opyi+Zn5mk9aXQiksOJruIdNw1rvJSe+uAIYQeBv+rinxzAyL
  62. 4f/p/+vvgnfgkEc2G1hLuGTvWMsAAwYP+gIhIgQ6UwQ0Bu1gyRN88Gs9H0fnQ74Z
  63. RmFXDgUtpn1YrFzFfTNegQh8vvgo1pXV4ZDPc0w9Cs8QHrspnkYrvSymAEmwYtGd
  64. nvnAVVROIJfN5d140Z1FJXCgFp/3m2SAX1omYyN3/5WX9ef1uaYWub48kSdqfHlr
  65. xe8Z15nXQ9E6WMgDtP5jXpfCkAnweW6/WSGRrHlRyBUevCTyRSZ4dwtim0GHsls9
  66. VbfDYWJVxiKWdgjtjg+PfsXrdQG2KICEHXprS9/tYCheWaHP4couXVHDPUNMGK/w
  67. HSYXbr0/xA0i0JHpRzVCDweKZ32hgbYkTXp0U7ArBYLtbfpWlB8uWHFFAIS5yJQL
  68. YMwc8/qFCgl5fUGMk4ZLTgbftQo/sfcOAIPQl2nVjhnvzucj8PgBBaJgH9ORTpW6
  69. 89zIzOtfXfju0dq4LC6Xj4h6SA/duh8dEiBzewNJ1FwnlrywvaQjsVdx5+5RolAk
  70. gZKcT4hHCj+s2vCAyF5R70rfKkZkKhMuUzEWc4R4AzbkmI1eTtEl/FJVCzBsJRan
  71. HC+YMgCdf2ujTxvBltytpWrs0nvzFVY6+RyihQsqlV6KeOtDBTv38a8Q5gdARK0j
  72. 5og+X3SWHW0p29PSKk6a3NeSB08J0wlXsrNOJ/JXlYw/yIifZdgl6fO8V7rPBoQt
  73. xIQB5UKSXj8YiE8EGBECAA8FAkniUKICGwwFCQHhM4AACgkQVRztCIhay+vXkQCf
  74. beWbtPmJOWbXn+9LEaJTqcN73REAn2MmtesdDs24QjWfZeTfc8dyEZ2n
  75. =O0oE
  76. -----END PGP PUBLIC KEY BLOCK-----
  77. Because this guide is written for newbies, it's not the best way to do it. It's meant to be as easy and
  78. secure as possible. If you learn more and work on this knowledge-base for a few years, you'll look back
  79. on this guide as ridiculous. You'll realize that it could have been done easier, better, faster, and without
  80. such a nice computer. Since you are probably a newbie, let's define some important terms we'll be
  81. using.
  82. Administrator - An administrator controls the computer. They can do system updates, install software,
  83. and mess with all kinds of internal system things. In the wrong hands (or in the case of a mis-typed
  84. command), the administrator account can wreak all sorts of havoc.
  85. Anonymity - Anonymity is the ability to operate without anybody knowing who you are. It is not an
  86. absolute, you are simply more anonymous than the average person. Any adversary, given sufficient
  87. resources and time, can break your anonymity. If somebody can buy and control every internet router
  88. in the world (or even a fair portion of them), tracking somebody through Tor would be fairly easy.
  89. Fortunately, few people/organizations have this power and even fewer use it for this purpose. In terms
  90. of using Tor or running a hidden service, the goal is to obscure your browsing profile which includes
  91. things like your browser configuration and your IP address.
  92. Adversary - The adversary is the enemy, the person or entity you use Tor to defend against. Maybe it
  93. is your government, the police, your boss, or your significant other.
  94. Algorithm - A method for encrypting data. It describes how data should be encrypted and decrypted,
  95. kind of like a recipe.
  96. Boot - To turn on a computer or operating system
  97. Command - A command is something you tell a computer to do. We'll be issuing them through the
  98. terminal aka the shell or command line. After you type enter, the command is executed. For instance,
  99. typing “ls” and then the enter key causes the computer to list all the files/folder in the current directory.
  100. Encryption - Encryption takes regular data (emails, files, etc.) and turns it into unreadable data. Onlythose who know the secret (a password, private key, etc.) can theoretically access that data in a format
  101. that is readable. Encryption is strong these days.
  102. Flag - A flag (also called an option) is something that's added onto a command to change the way it
  103. operates. For instance, the cp command (copy) when invoked (used) by typing 'cp oldfilelocation
  104. newfilelocation' will copy a file from one location to another. If you want to copy an entire folder, you
  105. would type 'cp -r oldfolder newfolder'. The -r is the recursive flag and it tells the copy command to go
  106. inside directories. Flags can also have values in this format (usually, but there are a few exceptions)
  107. 'command -flag anumberorsometext'
  108. Identity – Somebody or something that an entity claims to be. This could be your name, a pseudonym
  109. you use, or the name of a corporation. Identity is important and when you're hosting a hidden service,
  110. and should probably be kept secret. Identity is authenticated by some form of credential, like an ID
  111. card, a passphrase, or the address of your hidden service. Your real world identity and the identity you
  112. use on your hidden service should never come in contact unless that's your goal.
  113. Keyspace - A set of keys that could potentially be private keys (ie keys that could unlock encryption).
  114. The more keyspace you have, the more keys must be tried to crack your encryption.
  115. Linux - Linux is an operating system. It's actually just the kernel of the operating system, but we'll call
  116. it an operating system for simplicity's sake. Most servers in the world run it (as opposed to Windows)
  117. for the simple reason that it works better, is cheaper, is faster, and is more secure. Linux (or at least the
  118. variants we'll be using) is free (as in freedom) software. You have the right to use it, copy it, give it to
  119. friends, modify it for your own purposes, and distribute those modifications. Being free (as in money)
  120. is a byproduct of this. It's designed for communities and built by communities. It's not built by a big
  121. corporation or monitored by a government. There isn't one person or entity who can backdoor it. It's
  122. ours.
  123. Noob/Newb/Newbie - Somebody who is new at something and lacking or devoid of skill. This is who
  124. this guide is written for.
  125. Operating System - An operating system is what your computer runs. The programs you run
  126. communicate to the operating system and it handles all of the hard stuff like writing to the hard drive,
  127. managing memory, etc. Windows, OS X, and Linux are all examples of operating systems.
  128. Password - A password is used to protect unauthorized access to whatever you're protecting. You use a
  129. password on your email account, to enter a secret location, etc.
  130. Passphrase - This is like a password, but longer, harder to guess, and much more secure.
  131. Privacy - Privacy is the idea that a person has things or information that should be kept inaccessible to
  132. the rest of the world if the person so desires. Normally these include things like medical records,
  133. personal thoughts, and corporate records. Tor extends your privacy by giving you control over what
  134. you share and with whom. You get to decide if you want to be identified and if you want to reveal your
  135. true IP address. If you decide to post your personal information online, you're giving up a lot of your
  136. privacy. Like anonymity, privacy is not an absolute.
  137. Private Key - In encryption, the private key is the secret that is needed (usually in combination with a
  138. passphrase) to decrypt information. You don't give this to other people as it's private. If an adversaryobtains this key and your password, they will be able to decrypt your data. If they only have the private
  139. key, cracking the password is still a fairly easy process. Divulging your private key will result in your
  140. encrypted data being unsafe.
  141. Protocol - A standard procedure that is understood by more than on party. A protocol insures that two
  142. different entities can interact and produce a pre-designated result, kind of like a recipe. For instance,
  143. when you buy a hot dog, the protocol is that you pay for the food before you get it. This insures that the
  144. seller is not ripped off by you running away before paying. If the seller decides to take the money and
  145. run, you can always take the hot dog cart. Computers use protocols to communicate information.
  146. Random – Unpredictable or difficult to predict. All modern encryption relies on obtaining random data
  147. to make private and public keys which in turn are used to encrypt data. An adversary would have a hard
  148. time guessing something random right? Random is also not a binary as some data are more random
  149. than others. The 'randomness' of a set of data is called its entropy.
  150. Security - Security is the degree of protection from forces external from or internal to an entity. This
  151. could be a fence around a building, laws that protect data, or a firewall on your computer.
  152. Sudo - A command that when used by allowed users executes a given command as if the user were the
  153. administrator.
  154. Traffic - Stuff that goes over the network. This could be web browsing, Tor connections, hidden
  155. service downloads, or whatever.
  156. Virtual Machine (VM) - A virtual machine is an operating system that runs inside another operating
  157. system. It is (often) completely separated from the other operating system. It can't see files in the host
  158. operating system, access the internal communications bus for the host operating system, or see the IP
  159. address of the host operating system. This is useful for testing programs, sandboxing users, or
  160. protecting information about your computer.
  161. Ubuntu - Ubuntu is a distribution of Linux, think of it as a 'flavor'. A group of people took previous
  162. Linux flavors and packaged it together with the goals of it being newbie-friendly, compatible with as
  163. much hardware as possible, and being flexible.
  164. User - An account usually associated with a single person on a machine. This user can log in and out of
  165. the machine and is granted specific abilities
  166. Great, you're this far and about a day or so away from running a hidden service using this guide! This is
  167. going to take a while and it's going to take even longer if you have an older machine. I strongly suggest
  168. that you grab some snacks and coffee before you start this. As a note, this guide was designed for the
  169. Ubuntu 9.04 release. If you're using a different version, you'll have to adapt these instructions. The
  170. computer you're running this on should be recent, something made around 2005 or later. If your
  171. machine came with XP installed, it may struggle a little. Dual-core processors and processors with
  172. hyperthreading will handle the load much better. 64bit machines will as well, but many of the programs
  173. I'm expecting you to use do not have 64-bit versions available in the Ubuntu software repositories so
  174. you may spend quite some time finding them manually or even compiling them from scratch. You can
  175. run a secure hidden service on a machine that came with Windows 98, but it is much more complicated
  176. and requires more knowledge than I can fit in a guide that is already turning into a textbook. You'll also
  177. need a way to burn CDs.In order to write this guide, a lot of things had to be assumed. We are assuming there is no all-knowing
  178. entity watching the internet. This not true. If you do some research about ECHELON, the UKUSA
  179. agreement, or the history of the intelligence trade you'll find this out. Rather, we're assuming that
  180. entities capable of being all-knowing are also not concerned with with whatever you're doing. Usually
  181. divulging what they know would compromise their purpose and therefore you have little to worry
  182. about. We are assuming that encryption will protect you. Again, intelligence agencies like the NSA can
  183. probably break encryption but they won't for the reasons stated above. In our model, we're also
  184. assuming that the Tor software will never have vulnerabilities that could result in an attacker running
  185. remote code on your machine and that, if put at gunpoint, the Tor developers would refuse to put in
  186. backdoors or that in such a case somebody would notice. We're also assuming that the Ubuntu
  187. operating system doesn't have any major backdoors or that if it did whoever used them wouldn't be
  188. interested in you. Assuming all of this is a risk but we're going to do it to keep both of us sane and
  189. within the realm of possibilities that reality offers as opposed to the possibilities that tin foil hat land
  190. offers.
  191. When you use a machine for a hidden service, it's absolutely critical that you only use it for that
  192. purpose. NEVER use it for anything else, especially activities that have connection to you personally. It
  193. might be obnoxious to have a computer you can never use, but given the possible consequences it's
  194. probably worth it. The same goes for your virtual machine which we'll talk more about later. The more
  195. programs you install on your hidden service machine, the more avenues of attack you will create for
  196. your adversary.
  197. While this guide seeks to protect you from all reasonable risks, you should realize that there are some
  198. attacks this guide doesn't cover.
  199. 1. Cold Boot Attacks
  200. One of the problems with encryption is that in order for it to work, your computer has to know the
  201. private key and any other information needed for decryption. This information is stored in memory and
  202. while memory isn't a good place to store things long term, it does store data for an amount of time from
  203. seconds to minutes after your machine has been turned off. An adversary, knowing that they are facing
  204. a locked down machine with lots of encryption, may perform a cold boot attack. This involves turning
  205. off your computer, spraying your memory with liquid nitrogen (or something to keep it cold), and then
  206. recovering your encryption key from memory. Once frozen, data in memory can be retained (and then
  207. further reconstructed) for hours. If you feel this is a risk, you need to implement physical security
  208. measures that deal with the possible threat. This could be as simple as a laser tripwire on a door that
  209. triggers a shutdown.
  210. 2. Radio Leakage, TEMPEST, etc.
  211. All electronics create radio interference as a consequence of their operation. While this radio
  212. interference is often useless it can also provide valuable information for your adversary. For instance,
  213. the radio interference generated by keyboards can divulge your passwords to an adversary sitting across
  214. the street from your house. RF shielding is the only solution for this problem and involves surrounding
  215. your machine in some type of metal. This isn't all though, as the power pull generated when you use thekeyboard, etc. can also be monitored through your wall socket. I don't know of any solutions to this.
  216. One idea would be to lock your machine in a box with a UPS to filter the electricity and a security
  217. scheme similar to the one used to prevent cold boot attacks but I'm not sure how effective this would
  218. be.
  219. 3. Physical Security
  220. An adversary may put a camera, microphone, or some other recording device in the room with your
  221. hidden service machine. If they capture your encryption passphrase, your data will be compromised.
  222. Recently the FBI and Secret Service used this technique against a bust of the ShadowCrew carding
  223. board and it's been used for a long time by both law enforcement and intelligence. While using a
  224. blanket will deter a camera, the audio generated by your keyboard may not be sufficiently muffled to
  225. stop a microphone from knowing what's going on.
  226. 4. Traffic Correlation
  227. If your adversary suspects you run a hidden service, they can watch your internet connection and try to
  228. use traffic analysis to determine if the hidden service is run on your network. If your adversary
  229. downloads a few 50 megabyte files from your server and every time around 50MB of encrypted traffic
  230. goes across your network, it's pretty good evidence. Combine that with shutting off the power to your
  231. machine and watching the hidden service go down and you've got somebody who knows what's going
  232. on. There are creative ways of dealing with this such as cover traffic, UPSs, redundant servers, and
  233. physical security.
  234. Installing Ubuntu
  235. The first thing we need to do is download the version of Ubuntu this guide was written for. In the event
  236. that you're doing this in a time so far away that Ubuntu 9.04 is an outdated version, you can use the
  237. newest version but realize that you might have to change some of what this guide tells you to do to get
  238. it to work. The fastest way to get the most recent release is via BitTorrent. Not only is this usually
  239. faster than downloading the file directly from Ubuntu, but it also reduces load on their servers. You'll
  240. need a BitTorrent program to do this. If you're doing this on Windows, I suggest Vuze (vuze.com) but a
  241. lot of people like uTorrent (utorrent.com). It doesn't really matter what program you use.
  242. You can grab the Ubuntu 9.04 Alternate Install CD at:
  243. http://releases.ubuntu.com/9.04/ubuntu-9.04-alternate-i386.iso.torrent
  244. While you're waiting for it to download, it might help to look at some basic Linux commands. There's a
  245. good tutorial at http://www.reallylinux.com/docs/basic.shtml
  246. Once you've downloaded the file (hopefully on a different computer to make your life easier), I
  247. encourage you to leave your BitTorrent program open (let it seed) so that you upload the file to other
  248. people. If there was nobody to help you get this file, you wouldn't have it so please do your part and
  249. seed for a day or two.You'll need to burn the ISO image to a disk. Most commercial CD burning programs, such as Roxio or
  250. Nero will do the trick. If you don't have one, you can get a free ISO burner from
  251. http://www.magiciso.com or go to http://download.com and just search for ISO Burner.
  252. Meanwhile, on the machine you're installing your hidden service on...
  253. 1. Put the CD into your computer and then restart. On most computers, this will cause it to boot off the
  254. CD. If it doesn't (ie goes into Windows, etc.), you'll need to change the 'boot order' in your BIOS. You
  255. can Google on how to do this. Basically, right when you turn your computer on (and before windows,
  256. etc. loads), just quickly cycle through keys F1-F12, esc, and del. If the computer starts beeping at you,
  257. you usually have to wait a bit more. Make sure the CD-ROM boots before the hard drive/hdd.
  258. 2. If you booted off the CD, choose the language you want (using the up/down keys and enter) and then
  259. select "Install Ubuntu"
  260. 3. You'll be asked to choose a language again at the next screen. Keep in mind that (without additional
  261. precautions), your webserver and any documents/emails/etc. you produce on this machine will indicate
  262. which language you chose to a trained eye.
  263. 4. Next you'll be choosing your time zone. Again, this is something to think about wisely as people will
  264. be able to tell what time zone you choose through your web server, other services, etc. Think about
  265. where you want your adversary to think you are ; )
  266. 5. You'll be asked if you want your keyboard layout detected. I suggest you choose no unless you've
  267. got a very weird keyboard. Then choose your keyboard's most likely origin and you're set.
  268. 6. If you get an error saying that "network autoconfiguration failed", it's probably because it doesn't
  269. recognize your wireless card or that you're not plugged into the internet. Just go to 'continue' and then
  270. 'do not configure network at this time'. This will get sorted out later.
  271. 7. This is where you choose your computer's name. Usually people name their computers after
  272. themselves, but this wouldn't be a good idea here. I suggest something generic like "computer" "laptop"
  273. "desktop" etc. You can also choose something deliberately deceptive to throw off an adversary who
  274. may obtain this through leaks such as “windows machine”.
  275. 8. The time zone seems like an obvious choice but again consider what an adversary could gain from
  276. knowing it.
  277. 9. CAUTION: THIS IS THE POINT IN THE SETUP PROCESS WHERE EVERYTHING GETS
  278. DELETED FROM YOUR HARD DRIVE. Before installing, you might benefit from "wiping" your
  279. hard drive as opposed to "deleting" the stuff on it, which is analogous with removing all the highway
  280. signs to New York City and hoping nobody will find it. The city is still there. A good wiping program
  281. called Darik's Boot and Nuke (dban.sourceforge.net) is available for those who are interested.
  282. This is where it can get tricky. If you don't know what you're doing, it's best to just go with "guided -
  283. use entire disk and set up encrypted LVM". You can also make your own custom encrypted LVM but
  284. this can always be changed later.
  285. After you select this, it will ask you which hard drive to partition. If you have multiples, you'll need toknow how big each of them is and which you want to install Ubuntu on. If you only have one (most
  286. people), just select the only one that's available.
  287. To finish this step, just select yes at the next screen.
  288. 10. Encrypting Your Hard Drive
  289. This is where you choose the passphrase to encrypt your hard drive. Under current US law, you cannot
  290. be forced to give up your encryption passphrase in a criminal proceeding (but that won't stop the judge
  291. from jailing you for contempt or using other illegal tactics to entice you) however in a civil proceeding
  292. if encrypted data is subject to discovery you may have to. Under UK law, you are required to give up
  293. your password in certain circumstances but there's nothing that can be done if you forget. In some
  294. countries, you could go to jail for life or worse for not giving up your passphrase.
  295. If you're serious about this, you'll choose a good one and only type it in under a blanket. Authorities
  296. have been known to put cameras in vents, etc. to catch passwords.
  297. DO NOT USE:
  298. Words found in the dictionary (or combinations thereof)
  299. Words or phrases that could easily be associated with you (your birthday, personal mantra, etc.)
  300. Short passphrases
  301. DO USE:
  302. Letters, numbers, symbols, spaces, uppercase, and lowercase
  303. A long passphrase
  304. DO NOT:
  305. Write down this password (unless to temporarily remember it and make sure you keep a damn good
  306. eye on it)
  307. Share the password with anybody else unless they “need to know” it to administrate the server
  308. For more information about passphrases and how to choose a good one (which is really important if
  309. you want your data to stay private) see these links:
  310. http://www.queen.clara.net/pgp/pass.html
  311. http://www.iusmentis.com/security/passphrasefaq/
  312. http://www.unix-ag.uni-kl.de/~conrad/krypto/passphrase-faq.html
  313. 11. Next it may ask you the "amount of volume group to use for guided partitioning". Just use what it
  314. suggests as the default.
  315. 12. Tell it to write the changes to disk and it will start re-partitioning your hard drive. This basically
  316. means it's setting it up so you can put data onto it, dividing it up into the proper chunks and installing
  317. the file system (which keeps track of where files physically are on the hard drive, among other things).
  318. It will also start installing Ubuntu. This may take a long time, especially on computers with slow
  319. drives, big drives, or a slow cd reader. Be patient.
  320. 13. Choosing a Username
  321. Once your system is installed, you'll need to configure it. The first thing you'll have to do is choose a
  322. username. It's best if this can't be guessed, so choose something random but also consider what your
  323. adversary might know about you if they saw it. When you choose your password, try and make it assecure as your passphrase but don't make it the same. Also consider what somebody might know if they
  324. cracked your password. Under our model, the adversary will never be able to find out this account
  325. information but it never hurts to be safe.
  326. 14. Encrypting Your Home Directory
  327. This doesn't really offer any additional protection and will just slow your computer down. Your entire
  328. disk is encrypted anyways.
  329. 15. Install Software
  330. Now that you've answered a few questions, it's back to watching the loading bar.
  331. 16. Set the Clocks
  332. Once you're done installing software, it's going to ask you about your system clock. In most cases,
  333. choosing Yes is the best option here. After this the CD will eject. You should remove it and then select
  334. continue.
  335. Configuring Ubuntu
  336. Once you've logged into your system, the first thing you'll want to do is select your software sources
  337. and update your computer. Go to System> Administration> Software Sources. You're presented with a
  338. list of software sources from which you can update your programs and install new ones. You should
  339. make sure that "Canonical Supported" software is enabled. If you have odd hardware (mainly laptops),
  340. Ubuntu will need special drivers which aren't open source. In this case, make sure you also enable
  341. "Proprietary drivers".
  342. One of the things that makes Ubuntu so powerful is its community repositories. These contain
  343. programs and updates that are contributed by community members (other Ubuntu users). This is nice
  344. because it allows you access to lots of software but it's a security risk because you don't know who is
  345. delivering it to you or making sure security updates are available. Anybody can add any program to this
  346. list (for instance, there was an insecure outdated version of Tor in there for years), meaning that
  347. theoretically somebody could put a trojan, backdoor, etc. in there and you might accidentally install it. I
  348. suggest turning off these repositories and manually enabling them when you need specific programs.
  349. Everything that's installed on your system right now will update through Canonical (which we're
  350. assuming for the sake of simplicity is 100% trustable although this obviously isn't true).
  351. Next go to the Updates tab and select "Install Security Updates without Confirmation". Unless you plan
  352. on sitting by your computer waiting for updates, this is the best thing to do. It will insure that your
  353. software is as secure and up-to-date as possible.
  354. Now, go to Applications > Accessories > Terminal and type the following commands (followed by
  355. enter)
  356. sudo gedit /etc/apt/sources.list
  357. This will allow you to edit your software sources manually. Because Ubuntu's software repositories
  358. don't contain an up-to-date version of Tor, we'll be using the noreply.org repositories which are updated
  359. on a regular basis. Now, add the following two lines:
  360. deb http://mirror.noreply.org/pub/tor jaunty maindeb-src http://mirror.noreply.org/pub/tor jaunty main
  361. Now exit and save the file. Back to the terminal. Type this command:
  362. gpg --keyserver keys.gnupg.net --recv 94C09C7F
  363. gpg --fingerprint 94C09C7F
  364. This should show you some text, mainly this:
  365. pub 1024D/94C09C7F 1999-11-10
  366. Key fingerprint = 5B00 C96D 5D54 AEE1 206B AF84 DE7A AF6E 94C0 9C7F
  367. uid
  368. [ultimate] Peter Palfrader
  369. If it looks vastly different, something has probably gone wrong. Now, enter this command:
  370. gpg --export 94C09C7F | sudo apt-key add -
  371. This insures that when we download Tor, we're actually getting Tor and not a program that somebody
  372. has injected between us and the server we're downloading it from. This somebody could be your
  373. internet provider, somebody who has hacked into the software repository, etc.
  374. 18. Update Your Software
  375. Go to System> Administration> Update Manager and click "check". You should have lots of updates
  376. available, so click "install updates". Depending on your internet connection and your computer's speed,
  377. this could take a long time. You may have to restart afterwards depending on what updates are
  378. available.
  379. 19. Install Tor
  380. Now it's time to install Tor. Go to Applications> Accessories> Terminal and type the following
  381. command:
  382. sudo aptitude install tor
  383. Say yes to whatever it asks you. Great! Tor should be installed now.
  384. 20. Install Privoxy
  385. Unfortunately, there is no good version of Privoxy in the Ubuntu 9.04 repositories so we have to add it
  386. manually. Go to privoxy.org, click on 'download recent releases', click on 'Debian' and download the
  387. i386/x86 version. Run this file once you've saved it and click install.
  388. Preparing The Virtual Machine
  389. A virtual machine is a complete operating system that runs inside another operating system. We will
  390. use this to protect your identity. This way, even if somebody hacks into your hidden service, they won't
  391. be able to find out your IP address, what's on your hard drive, or any other sensitive information.
  392. Instead, they'll just land in an empty sandbox that has ONLY hidden service things. It's important that
  393. you only use your virtual machine for your hidden service and NOTHING ELSE. Tor will run on the
  394. host machine. Tor needs to access the internet, but your hidden service only needs to access Tor. In this
  395. way, Tor can access the internet, connect to tor servers, etc. but the machine with your actual hiddenservice can only communicate through Tor. This removes the risk that an attacker can force your server
  396. to divulge its IP address and therefore it's location/operator by requesting external files.
  397. Open up the terminal (you should know where it is by now) and type the following command: (If you
  398. haven't enabled community repositories, you'll want to do so before issuing this command.)
  399. sudo aptitude install qemu
  400. Now it's time to restart!
  401. You'll also need to grab a copy of Ubuntu 9.04 Server. I suggest you download this through the torrent
  402. they provide at:
  403. http://releases.ubuntu.com/9.04/ubuntu-9.04-server-i386.iso.torrent
  404. Please don't just be a leech and download. I suggest downloading these files and then uploading to
  405. other users so they can get it as well. A good general rule of thumb is to "seed" (share) until your share
  406. ratio is 1.5 or you've been seeding for 48 hours, whichever comes first. You can always run
  407. transmission, Ubuntu's Bittorrent program, later and it will remember what's up.
  408. Once you've installed the software that's needed to install the virtual machine, you'll need to restart. I'll
  409. be here when you come back.
  410. In order to keep the virtual machine safe, we're going to install Truecrypt. Ubuntu's encryption (which
  411. we used to encrypt your hard drive) is fairly weak in terms of the grand scheme of encryption options.
  412. It's also not deniable. Anybody looking at your hard drive can conclusively prove it's encrypted.
  413. Depending on where you live, you may be legally compelled to give up the password or a rubber-hose
  414. attack (imagine what somebody could do to you with a rubber hose) may cause you to give it up. It
  415. uses AES by default, which is approved for classified data in the United States if I remember correctly.
  416. Encryption isn't foolproof, it's a deterrent -- something that will make your adversary work harder.
  417. Every encryption scheme people have devised has eventually been broken, and AES will be no
  418. exception. Right now, AES is still very secure. I believe Ubuntu uses 128-bit encryption. According to
  419. the National Institute for Standards in Technology (nist.gov), if you assume that every person on the
  420. planet owned ten computers, and that there are seven billion people on the planet, and that each of these
  421. computers can test 1 billion possible keys per second, and that on average you only need to test 50% of
  422. the possible keys to crack a 128-bit encrypted file, then it would take the entire world
  423. 77,000,000,000,000,000,000,000,000 years to crack a 128-bit key. This example is taken from
  424. http://www.seagate.com/staticfiles/docs/pdf/whitepaper/tp596_128-bit_versus_256_bit.pdf
  425. That's assuming you chose a truly random passphrase and that the adversary guesses your key in a
  426. random order. There's always a chance they could guess the key the first time around, it's all a game of
  427. chance. Additionally, there have been some attacks published about AES that reduce the keyspace (the
  428. amount of keys that need to be guessed in order for somebody to crack the correct one), so AES is
  429. probably on its way out.
  430. TrueCrypt is an open-source encryption program. It works by creating 'volumes', which show up on
  431. your computer as separate drives. You can read/write to them like any other hard drive. It has a few
  432. very important features that Ubuntu's default options don't have. For one, it's deniable. There's no way
  433. (that anybody has figured out) to prove a Truecrypt file is actually a Truecrypt file. It could be just a
  434. bunch of random data. Another important feature is 'hidden partitions'. These enable you to create anencrypted file that actually has two separate volumes with separate passphrases. In one, you can put
  435. sensitive-looking information should you ever be forced to divulge your passphrase. In the other one,
  436. you can put the actual sensitive information and there's no way to prove that a hidden section exists.
  437. Additionally, Truecrypt features 'super encryption', also known as cascading encryption. This means
  438. that your data is encrypted two or three times, not just once. This means that even if an adversary
  439. guessed a private key that worked, they'd have to guess more and they wouldn't know if that key was
  440. correct or just mathematically correct. The final important feature is that it has no default encryption
  441. algorithm. With Ubuntu's full-disk encryption, an adversary knows the algorithm the drive is encrypted
  442. with and what the keysize is. In Truecrypt, there's over a dozen combinations, forcing your adversary to
  443. spend much more time cracking it.
  444. It's worth discussing quantum computing here. All modern encryption systems rely on the fact that
  445. factoring prime numbers for large numbers (that have 128 digits, for instance) is extremely difficult. It
  446. would take an average computer billions of years to factor a 128 bit key. With a quantum computer,
  447. you ask it to factor a 128 bit key and it gets you the answers within seconds. Traditionally, intelligence
  448. agencies have been at least a decade ahead of academics. Right now academics are starting to build
  449. very basic quantum computers (they aren't computers yet, they're just the basis for doing math using
  450. quantum computing) and I would put money on the idea that the NSA already has quantum computing.
  451. Needless to say, if you're fighting the NSA you've got bigger concerns than your computer's encryption
  452. software.
  453. So, after much discussion, let's finally download Truecrypt. Go to truecrypt.org, click on download,
  454. and get the Ubuntu x86 version. One unfortunate part of the Truecrypt website is that it doesn't support
  455. SSL. This means that you can't verify that the truecrypt.org server is the actual truecrypt.org server. It
  456. could be your ISP, the Chinese firewall, etc. The site provides a PGP signature for verifying the
  457. downloaded file, but if you're getting that PGP signature in an unauthenticated manner, it won't do
  458. much good. One way to verify the files is to get an "md5 sum". This is way of making a unique
  459. 'signature' of a file. I downloaded Truecrypt (version 6.2a) through two different Tor servers and got
  460. this md5 sum:
  461. 7f16f069416b10b4455a7457a625771b
  462. You can check the md5sum by opening the terminal and going to the directory where you saved the file
  463. using the following command:
  464. cd /directory
  465. It is probably in /home/user or /home/user/Desktop. Then type "md5sum filename" and it will print out
  466. the file's signature. Also realize that you probably got this guide in an un-authenticated manner.
  467. Now, open up that file, extract its contents, and open the file you've extracted. Install it by clicking
  468. install (duh). Once this is done, open Truecrypt. It should be under your programs. If not, you can go to
  469. the terminal and type truecrypt. I suggest you use the 'hidden volume' feature, but I'm not going to
  470. explain to you how to do it. You have to do some of the work yourself. Truecrypt has some wonderful
  471. documentation available at http://www.truecrypt.org/docs/. The hidden service has to go in its own
  472. encrypted volume because we don't want the main (host) system knowing about it and vice versa. Tor
  473. is in a Truecrypt partition because we don't want an attacker with the main hard drive encryption key to
  474. be able to find out the address of your hidden service.
  475. Once you've got Truecrypt open, follow these steps:1. Choose "create volume"
  476. 2. Choose "create an encrypted file container" and go to the next screen
  477. 3. Choose "standard Truecrypt volume" and go to the next screen
  478. 4. Click "select file"
  479. 5. Navigate to the directory where you want the encrypted volume to live
  480. 6. Type in the file name you want. If you choose something like 'truecrypt.file', it's going to be obvious
  481. that it's a Truecrypt encrypted container. Something like "encrypted.test" or "hard_drive_image.raw"
  482. might be a little more deniable. If you want to have fun, create a few of these so your adversary won't
  483. know which (if any) to try cracking.
  484. 7. Click next
  485. 8. This is where you choose an encryption algorithm. I would suggest using multiple ones, but it's up to
  486. you and it doesn't really matter which one you pick. If you care about speed, hit "test" to see which
  487. ones will run best on your machine.
  488. 9. Click next
  489. 10. This is where we choose the size of the encrypted volume. For your hidden service machine,
  490. consider how many files you'll be storing and how big they'll be. I suggest at least 10GB. You can
  491. always change this later.
  492. 11. This is where you choose your passphrase. Make it as complicated, long, and random as possible
  493. while still being able to remember it later.
  494. 12. At this stage, you can also add a keyfile. This is a good idea if you think your adversary will never
  495. find your keyfiles. You can store them on your hard drive or on an external device (flash drive, etc.) in
  496. a secure or hard-to-find location. While it doesn't actually work like this, this example will explain it's
  497. effectiveness -- Using a keyfile is basically like using an entire file as your password in addition to your
  498. actual password, making it much more difficult to crack. It takes a while to guess a 20 character
  499. password, but even longer for a 5000 character password. Random files are the best, but you can use
  500. any file, including a huge zip file or the Ubuntu install CDs (not recommended, since they might expect
  501. this of hidden service operators who used this guide).
  502. 13. Click next
  503. 14. Choose "I will store files larger than 4gb on this volume". While you may never actually do this, it's
  504. important to keep it open as an option. This isn't something you'll want to have to change in the future.
  505. 15. Click next
  506. 16. Now you have to choose your file system. A file system is how the operating system finds out
  507. where files are physically located on a hard drive. FAT32 was used on Windows 98-era machines (and
  508. is still used on most flash drives). The problem with FAT32 is you can't store files larger than 4gb and
  509. if your system crashes without notice (power failure, etc.) there's a good chance it might not recover.
  510. Ext2 and 3 are better options for recovering from this kind of a disaster and you can store files larger
  511. than 4gb. Also, you can play more around with the permissions (only allowing certain users/programs
  512. to access certain files). I'm assuming you don't choose fat32 here because it's usually a bad choice.
  513. 17. Click next
  514. 18. Choose "I will use this file on other platforms". Again this is one of those things you'd rather have
  515. the option to do because if you don't, changing it will be a big pain.
  516. 19. Click next
  517. 20. Un-check "show" and move your mouse around a lot, for a while. It may also help to surf the web,
  518. open big files, type random stuff, etc. I'm not sure though. Once your hand gets tired or your patience
  519. runs out, click on format. This will take seconds to hours. It took half an hour on my test machine.
  520. Now it's time to set up Tor for use with our hidden service. Normally Tor stores everything in /var/tor,
  521. but we'll be storing everything in our encrypted Truecrypt volume. Unfortunately, if we just edit Tor'sconfiguration file to store things where we mount the encrypted volume (where it shows up when we
  522. open it), it will provide pretty strong proof additional encryption is used on your machine. It wouldn't
  523. be much of a stretch to blame the Truecrypt volumes. The way to get around this is to make a script
  524. inside the encrypted volume that changes Tor's settings when it's opened. First though, we've got to
  525. open the encrypted volume.
  526. Open up truecrypt and click "select file". Pick your encrypted volume you'll be using and hit "mount".
  527. Enter your passphrase, key files, and whatever else you need to. Normally Truecrypt mounts things to /
  528. media/truecrypt1, meaning you can access the volume at that directory.
  529. Go back to the terminal and type these commands:
  530. sudo cp /etc/tor/torrc /media/truecrypt1
  531. sudo chmod 777 /media/truecrypt1/torrc
  532. gedit /media/truecrypt1/torrc
  533. Awesome, now we're editing the Tor configuration file. Add the below:
  534. ## disable logging
  535. log notice file /dev/null
  536. ## use encrypted data directory
  537. DataDirectory /media/truecrypt1/tor
  538. ## set up the hidden service, 5022 can be anything you want but make sure you specify it right in the
  539. Qemu setup
  540. HiddenServiceDir /media/truecrypt1/tor/hidden_service
  541. HiddenServicePort 80 127.0.0.1:5022
  542. This sets up a hidden service and redirect all traffic to it to 127.0.0.1:5022. On port 5022, Qemu is
  543. listening and will forward all of that traffic to your virtual machine (hidden service). Go to your
  544. Truecrypt volume and create a folder called Tor, which is where all of Tor's data will be stored
  545. including your hidden service's key and address. As a final measure, let's make sure Tor can write to
  546. the folder by typing sudo chown debian-tor /media/truecrypt1/tor.
  547. The way we'll be making sure that your hidden service can only send traffic through Tor is by making a
  548. user that has all of their connections forwarded to localhost. This means that you can run programs over
  549. Tor from the hidden service if you set the proxy correctly and that if you don't, the connection will just
  550. get dropped. This means that if you're running any other software on your host machine that is listening
  551. on any other port, it will be accessible to your hidden service. You may need to block connections to it
  552. via iptables or completely disable it. In the example commands, I created a user called torify. If you
  553. give it a different name, be sure to change the commands accordingly. To create a new user, go to
  554. System> Administration> Users and Groups and select new user. You'll need to give them their own
  555. password. Go over to advanced and remember what it says in “user ID”. Once this is done, go to the
  556. terminal and run these two commands replacing id with the user id you found. This will allow the torify
  557. user to run the kvm modules which may speed up your virtual machine.
  558. sudo adduser `id -un` libvirtd
  559. sudo adduser `id -un` kvm
  560. Once we've got your new user set up, let's install the software that will run your virtual machine.
  561. In Linux, iptables is the best and most popular firewall (technically it actually isn't a firewall, but we'llcall it one for the sake of simplicity). We'll be using it to make sure your hidden service only uses Tor
  562. and can't communicate to the outside world any other way. If you're plugging your computer into the
  563. internet, your network interface is eth0. If you're using wireless, it's probably wlan0. Modify
  564. accordingly for the below. Anything starting with # is a comment to explain what's going on and
  565. everything else is a command which you should run! This is based off of some discussion on the or-talk
  566. mailing list. If you're looking for more explanations on how this works or other sample commands, see
  567. http://archives.seul.org/or/talk/May-2009/msg00067.html
  568. #redirect all of torify's traffic to localhost
  569. sudo iptables -t nat -A OUTPUT -m owner --uid-owner torify -j DNAT --to-destination 127.0.0.1
  570. #allow vm to access privoxy, tor
  571. sudo iptables -A OUTPUT -o lo -m owner --uid-owner torify -p tcp --dport 8118 -j ACCEPT
  572. sudo iptables -A OUTPUT -o lo -m owner --uid-owner torify -p tcp --dport 9050 -j ACCEPT
  573. #allow tor to access vm
  574. sudo iptables -A OUTPUT -o lo -m owner --uid-owner debian-tor -p tcp --dport 5022 -j ACCEPT
  575. #if we allow it outgoing, allow it incoming and don't interfere with prior connections
  576. sudo iptables -A INPUT -p tcp -m state --state ESTABLISHED -j ACCEPT
  577. sudo iptables -A INPUT -p tcp -m state --state RELATED -j ACCEPT
  578. sudo iptables -A OUTPUT -m state --state ESTABLISHED -j ACCEPT
  579. sudo iptables -A OUTPUT -m state --state RELATED -j ACCEPT
  580. #don't let anything access vm on localhost
  581. sudo iptables -A OUTPUT -o lo -p tcp --dport 5022 -j DROP
  582. #don't let torify snoop around on listening localhost ports
  583. sudo iptables -A OUTPUT -o lo -m owner --uid-owner torify -j DROP
  584. #don't allow external machines to access vm
  585. sudo iptables -A INPUT ! -i lo -p tcp --dport 5022 -j DROP
  586. #drop all torify traffic failsafe and protocol agnostic
  587. sudo iptables -A OUTPUT -o lo -m owner --uid-owner torify -j DROP
  588. To make sure the rules stay after reboot, type the following command:
  589. sudo iptables-save
  590. Next we'll need to make sure Privoxy works with Tor. Type this command:
  591. sudo gedit /etc/privoxy/config
  592. Delete everything in the file and replace it with this:
  593. # Generally, this file goes in /etc/privoxy/config
  594. #
  595. # Tor listens as a SOCKS4a proxy here:
  596. forward-socks4a / 127.0.0.1:9050 .
  597. confdir /etc/privoxy
  598. log /etc/privoxy
  599. #actionsfile standard # Internal purpose, recommended
  600. #actionsfile default # Main actions file
  601. #actionsfile user
  602. # User customizations
  603. #filterfile default.filter
  604. # Don't log interesting things, only startup messages, warnings and errors#logfile logfile
  605. #jarfile jarfile
  606. #debug 0 # show each GET/POST/CONNECT request
  607. #debug 4096 # Startup banner and warnings
  608. #debug 8192 # Errors - *we highly recommended enabling this*
  609. user-manual /usr/share/doc/privoxy/user-manual
  610. listen-address 127.0.0.1:8118
  611. toggle 1
  612. enable-remote-toggle 0
  613. enable-edit-actions 0
  614. enable-remote-http-toggle 0
  615. Now, type this command:
  616. sudo /etc/init.d/privoxy restart
  617. You'll also probably want to lock your screen while you're not at your computer. This will stop your
  618. adversary from accessing your computer while it's on but won't stop cold boot attacks. To do this, run
  619. the following command:
  620. sudo aptitude install xscreensaver
  621. This installs the xscreensaver. Unless you want to manually start the xscreensaver program every time
  622. you turn on your computer, you'll probably want to add it to your startup list/fluxbox init file which
  623. we'll discuss later. The command to start xscreensaver is just xscreensaver and to lock it use the
  624. command xscreensaver-command -lock.
  625. Speeding Up Your Machine
  626. Running a virtual machine takes a lot of memory, processing power, and disk space. Before we install
  627. the virtual machine, it would be beneficial to slim down Ubuntu a bit so we've got more power to spare
  628. for the virtual machine. I'll be asking you to restart a lot while we make these changes. The reason for
  629. this is that if a change breaks your system, you'll have a much easier time figuring out which change it
  630. was and putting it back to the way it was before you made it. If you absolutely *have* to restart, I'll be
  631. sure to notify you otherwise it's probably safe to not restart if you want to save time. Most of these
  632. changes are small, but some are larger. Just as a reference, the system I used was a Dell with a Pentium
  633. 4 Processor and 244 megabytes of ram (actually 256 but Ubuntu doesn't seem to realise this). When I
  634. logged in and ran the System Monitor (with nothing else running), I was at 18-19% CPU Usage and
  635. 109MB of memory usage. If you installed a full desktop in your virtual machine, you can make these
  636. changes there as well. If you're doing these changes logged in as your 'torified' user, you'll have to run
  637. this command first:
  638. export http_proxy=http://127.0.0.1:8118
  639. This tells your user's account to use Tor to access the internet. If you don't do this, you won't be able to
  640. access the internet.1. Disable Startup Applications and Services
  641. Go to System>Administration>Startup Applications
  642. Disable Bluetooth (you'll probably never want this, especially considering how insecure it is and you
  643. most likely don't have a computer with bluetooth anyways)
  644. Evolution Alarm Notifier (unless you'll be checking your mail with evolution and using it as an alarm,
  645. you can safely disable this)
  646. Print Queue Applet (We want to disable printing because quite frankly you won't be needing it)
  647. Remote Desktop (You'll also probably never need to administer this computer from a remote location.
  648. If you do, there are better and safer ways to do so such as ssh)
  649. Visual Assistance (Unless you have a disability which requires this, you can safely disable this)
  650. System>Admin>Power Management
  651. Select NEVER put the computer to sleep (You don't want your hidden service going offline because
  652. your computer went into sleep mode)
  653. System>Pref>Display
  654. If possible, choose a lower resolution. This requires less memory and CPU to manage. As a rule of
  655. thumb, go as low as you can go without making it unusable. After all, this is a server and you won't
  656. have to be on it that much.
  657. Go to System>Pref>Appearance>Visual effects and disable any which are enabled.
  658. In System>admin>services, make the following changes:
  659. Automated crash reports off (You absolutely want this off. Crash reports (data sent to a program's
  660. developer when it malfunctions) often contain sensitive information such as log information, system
  661. configuration information, and occasionally even memory dumps (a copy of what is stored in your
  662. RAM) which are extremely dangerous as they can contain passwords and even the private key used to
  663. decrypt your data!
  664. Bluetooth device management off
  665. Printer service off (Again, you won't be using the printer. Additionally, this should disable CUPS.
  666. CUPS has a web interface which is accessible from localhost, including your hidden service VM. It's
  667. better that nobody is able to access information about your system)
  668. Remote backup server off (You shouldn't need this)
  669. Now, open a terminal and type "sudo gedit /boot/grub/menu.lst". Find where is says "splash" and take it
  670. out. This will cut down on the time it takes to boot your computer. The downside is that this means
  671. your computer will print all sorts of messages to the screen that the splash screen (Ubuntu logo)
  672. normally hides. If somebody watches your screen during the boot process, they could gain a significant
  673. amount of information. While passwords won't be printed, information about system internals and logs
  674. may be.
  675. It's probably about time to restart, let's see how fast we can get it.
  676. Now that we've changed some basic preferences, let's dig a little deeper into the system.
  677. Most programs on your system don't run all on their own, they use external programs and information
  678. called 'libraries'. Normally, each time the program runs, it has to figure out where these libraries arestored. We can speed up the system by removing the need to do this. This also has security advantages
  679. as we can tell the 'prelinker' to load these libraries into the memory at random locations. This is useful
  680. because an adversary looking to mess with your memory and inject their own commands will have a
  681. harder time finding places to do so. So, let's start by running this command
  682. sudo apt-get -y install prelink (you'll need community repositories enabled to do this)
  683. Now type the command 'sudo gedit /etc/default/prelink'. Change PRELINKING=unknown to
  684. PRELINKING=yes.
  685. Now type the command 'sudo /etc/cron.daily/prelink' (this might take a while)
  686. This would be a really good time to restart your system.
  687. Systems manage things called 'locales'. Locales define what language to use when talking to the user.
  688. Usually you only need one language, but all of those extra languages could be taking up your memory
  689. and disk space. Run 'sudo apt-get -y install localepurge' to change the locales you'd like to use. When it
  690. asks, read the instructions and follow them. If you're using English, you should keep EN, EN_US, and
  691. EN_US_UTF8. I strongly suggest you restart after this.
  692. You may also decrease CPU usage by putting your Truecrypt containers on external storage devices.
  693. When you load them from the hard drive they actually have to be decrypted twice (the first layer of
  694. encryption is the full-disk encryption and the second layer is Truecrypt), wasting additional CPU
  695. resources. The downside of this is that it will significantly decrease the speed at which you can transfer
  696. data to and from your Truecrypt volume, which will likely slow down your virtual machine
  697. significantly. As an added benefit, you can quickly hide or destroy the data in the event that you need
  698. to whereas breaking into your computer to remove the hard drive and then destroying it would take
  699. significantly longer.
  700. You can also speed up your machine by using alternative applications to the ones installed by default.
  701. You can switch gedit (your text editor) for mousepad and nautilus (file manager) for thunar just for an
  702. example. If you installed Ubuntu (not Xubuntu), you're using a lot more memory than you need. Even
  703. Xubuntu can be a little heavy compared to a system with a more lightweight window manager like
  704. Fluxbox. Since this is a server, you don't need all the pretty functionality that Ubuntu or Xubuntu
  705. provide by default. To install Fluxbox (with community repositories enabled) type 'sudo aptitude install
  706. fluxbox thunar'. Then log out and before you log back in again, click on 'sessions' and choose Fluxbox.
  707. To access the menu, right click anywhere on the desktop. To start up the terminal, go to
  708. applications>terminal emulators>xterm. To start up a file manager (to move files, copy them, look
  709. around, etc.) type thunar at the command line. As an added bonus, Fluxbox comes with all sorts of cool
  710. themes that barely take any memory. If you are using wireless internet (or even if you're not), it's very
  711. helpful to have the network manager enabled. In order to make it work when you start Fluxbox, open
  712. up the terminal type "gedit ./fluxbox/startup". Look for the line 'exec fluxbox' and in the line above it
  713. add 'sudo nm-applet&'. You also should also add the line 'update-manager&' so that you get updates.
  714. After these changes, my CPU usage is the same but my memory usage has dropped down to 76MB,
  715. which will be very useful when running the virtual machineInstall Your Virtual Machine
  716. Now it's finally time to install your virtual machine! Restart your computer, log in as the torify user,
  717. and mount your Truecrypt volume. Run the following commands
  718. sudo tor -f /media/truecrypt1/torrc
  719. Next we have to make a hard drive for Qemu to use. You'll want to open a terminal and change into
  720. your Truecrypt volume's directory. You can change 5M to whatever you want as this will be the size of
  721. your hard drive (10M, 100G, 30G, etc.). This should be big enough to hold everything you're going to
  722. put on your server and should probably be a minimum of 5G. File.disk is the name of the file to store
  723. the disk in. You can change file.disk as well but make sure you remember that you changed it! Here's
  724. the sample command:
  725. qemu-img create -f raw file.disk 5G
  726. Now that we've made our hard drive, let's boot up the virtual machine! The hda flag tells qemu where
  727. our hard drive is. The m flag says how much memory to allocate. You can get a feel of how much you
  728. have left by running gnome-system-monitor from the terminal. The server can run on 128M but bigger
  729. is better unless you run out of it on your host system. The name can be anything you want. I added -no-
  730. acpi because I was getting errors about it but you may not. My system also gives a segfault error on
  731. shutdown. From what I can tell, this is only in the part where it actually turns off the power so it
  732. shouldn't be a problem or a security risk. The redir flag tells qemu to forward traffic to localhost (host)
  733. on port 5022 (TCP) to the guest os on port 80 (TCP). Here's my sample command, which you would
  734. need to run in the directory where you downloaded Ubuntu Server Edition. Remember: Most times
  735. before you boot up the virtual machine you'll need to run the command “xhost +torify”.
  736. qemu -hda /media/truecrypt1/file.disk -m 127M -name TorMachine -no-acpi -redir tcp:5022::80
  737. -cdrom ubuntu-9.04-server-i386.iso -boot d
  738. You should install it pretty much the same way you installed your host system. You shouldn't use disk
  739. encryption (as it's already encrypted twice). When it asks, you want a LAMP server which stands for
  740. Linux-Apache-MySQL-PHP.
  741. After you install the server, you can run it using this command:
  742. qemu -hda /media/truecrypt1/file.disk -m 128M -name TorMachine -no-acpi -redir tcp:5022::80
  743. For when you're working in the virtual machine, you can access your host machine at 10.0.2.2. This
  744. means that privoxy (your web proxy) is at 10.0.2.2:8118 and Tor is at 10.0.2.2:9050
  745. If you want any of your programs on the virtual machine (such as the auto-updater, wget, etc.) to work,
  746. you'll have to run this command:
  747. export http_proxy=http://10.0.2.2:8118
  748. This setting will stay this way until you restart your system so if you want it to stick around, you'll have
  749. to edit your bash configuration file by running the command nano ~/.bashrc. If there is already a line
  750. that says http_proxy, modify it like we did in the previous command. If there isn't, you'll need to add it.
  751. Once you're done editing the file, hit Control and W.Next we'll need to update your server. Run the command:
  752. sudo aptitude update
  753. If you get 404 errors or network connection errors, something has probably messed up with the http
  754. proxy variable. It could also be Tor not working well so try updating a few more times combined with
  755. restarting Tor. If nothing went wrong, run the command sudo aptitude safe-upgrade and wait for it to
  756. finish. Once it's done, you'll want to restart and depending on how many updates are available you may
  757. have to do this several times. To turn off your server (and then turn back on to restart) type “sudo halt”
  758. in the virtual machine.
  759. The final thing we'll want to do is be extra sure that we're sending our traffic through Tor. Type the
  760. command “w3m http://torstatus.kgprog.com/” and you should be greeted with a page that says you're
  761. sucessfully using Tor.
  762. Running Your Virtual Machine
  763. Now that you've installed your virtual machine, it's time to start working on it! If you followed the
  764. guide verbatim, here are the instructions to get your virtual machine up and running
  765. 1. Log in as the torify user
  766. 2. Open Truecrypt, mount your hidden service in /media/truecrypt1
  767. 3. Start Tor using the command sudo tor -f /media/truecrypt1/torrc
  768. 4. Run the command qemu -hda /media/truecrypt1/testing.img -m 128 -name TorMachine -no-
  769. acpi -redir tcp:5022::80
  770. 5. Log into your server
  771. 6. Lock your screen!
  772. Locking Down Your Server
  773. There's a reason that many hidden services don't use PHP or active scripting: it's a huge security risk.
  774. Because your server is running in a virtual machine, you'll be much safer but give any adversary
  775. command-line access for long enough and they might just be able to break out of your sandbox.
  776. A popular saying in the IT and computer security field is that 'obscurity is not security'. This basically
  777. means that you can't assume that a system is secure just because your adversary doesn't know about it.
  778. The phone companies learned this lesson the hard way. When we're dealing with a hidden service,
  779. obscurity can provide some security. If your adversary can't determine which server software your
  780. machine is running, breaking into it will take a little longer.
  781. The first thing we need to do is change some of Apache's settings. Apache is the web server we'll be
  782. using. Most of the files you'll need to edit for Apache are in /etc/apache2. It would probably be
  783. beneficial to go through all of the files in there and tweak the security settings. Here's a few tweaks I
  784. thought would be useful.
  785. In conf.d/security, change SecurityTokens to “Prod” so that your server gives out less information
  786. about itself. Also, change ServerSignature to Off so that Apache doesn't tell people it's running. If you
  787. change TraceEnable to Off, you'll get less wordy error messages. This is good because we don't wantattackers getting a view of your machine's configuration.
  788. We'll also want to disable the “server status” module. Unfortunately, Tor's traffic will appear to come
  789. from localhost (the local machine) and we therefore don't want to allow localhost to see anything
  790. sensitive. In mods-enabled/status.conf comment the lines that begin with Allow.
  791. If you're going to be hosting lots of files in a single directory (or a few), you'll probably want to enable
  792. indexing for those directories. Indexing is nice because it displays all the files in a directory. As a fail-
  793. safe, it's best to disable indexing everywhere and then manually enable it where you want or else you
  794. might accidentally enable indexes for folders you didn't intend to. There's a good guide for how to do
  795. this at http://www.ducea.com/2006/06/26/apache-tips-tricks-disable-directory-indexes/ that's pretty
  796. easy to understand.
  797. While your server will never know its real IP address or hostname, revealing it's virtual IP or hostname
  798. tells an attacker that you're in a virtual machine. If you want to change this, you can do so in the
  799. envvars file. I suggest adding this:
  800. export SERVER_ADDR=127.0.0.1
  801. export SERVER_NAME=localhost
  802. I also suggest changing some of PHPs default settings (in /etc/php5/apache2/php.ini). You can spend
  803. all day hacking PHP to be more secure, so I suggest looking up guides on securing or “hardening”
  804. PHP. Here are some important ones:
  805. #don't tell people PHP is running
  806. php.ini expose_php = Off
  807. #if an error happens, don't tell the user anything sensitive
  808. display_errors = Off
  809. #make sure errors go to logs
  810. log_errors = On
  811. #set your maximum size for people uploading files. If you're running a service where people can
  812. upload files, this one is important. Just use 10M, 50M, etc.
  813. upload_max_filesize = XM
  814. Uploading Files To Your Server
  815. There are a few ways you can get files onto your server. If you're looking to grab files from the web,
  816. such as the install package for Drupal, you can just run the command “wget
  817. http://www.example.com/file.zip” from the server's command line. If you want to upload your own
  818. files, it gets a little trickier.
  819. Most hosting companies allow users to upload their files through FTP or SSH. The best way to upload
  820. files to your hidden service is without either of these services as they open new avenues for attackers.
  821. The safest way to upload files is to stick them in a disk image. A disk image is an entire disk on a
  822. single file which when opened properly will look like a disk (similar to the concept of a zip file). We'll
  823. be making these disk images with a program called Brasero. On your host machine, run the command
  824. brasero. Click data project and then add the files you want to transfer over. You can add as many as
  825. you want since you won't actually be burning this to a cd. Once you're done, go to project > burn and
  826. select image file from the drop-down menu you select. Save it anywhere (your truecrypt volume would
  827. be good). When you boot up your server next time, add the -cdrom /wherever/you/stored/your/file.iso
  828. flag to the qemu command. Once you're booted up, run these commands:sudo mkdir /mnt/cdrom
  829. sudo mount /dev/cdrom0 /mnt/cdrom
  830. cp /mnt/cdrom/* /where/you/want/to/put/everything
  831. This should copy over all of your files from the iso. Once you've done this, and shut down your virtual
  832. machine, you can delete the iso file.
  833. If you want to install a FTP/SSH server, there are several guides that will help you through doing so.
  834. There's a good FTP guide at http://www.ubuntugeek.com/settingup-an-ftp-server-on-ubuntu-with-
  835. proftpd.html Setting up an SSH server is even easier to set up than a FTP server and requires almost no
  836. configuration http://www.cyberciti.biz/faq/ubuntu-linux-openssh-server-installation-and-configuration/.
  837. If you want to allow access to these services from your onion url, don't forget to edit your torrc and
  838. qemu command to reflect it.Additional Resources
  839. Free Software
  840. http://www.gnu.org/philosophy/free-sw.html
  841. http://en.wikipedia.org/wiki/Free_software
  842. http://www.fsf.org - Creators of many core linux apps, the GPL license, etc.
  843. Encryption
  844. http://www.truecrypt.org/docs/
  845. http://en.wikipedia.org/wiki/Public_key_encryption
  846. http://www.pidgin.im - A good IM client that can use AIM, ICQ, YIM, Jabber/Google Talk, IRC,
  847. SILC, and many others .
  848. http://www.cypherpunks.ca/otr/ - Encrypt Instant Messages with Pidgin
  849. http://www.getthunderbird.com - A mail application that integrates well with PGP (use the enigmail
  850. add-on)
  851. Crypto: How Code Rebels Beat the Government by Steven Levy
  852. http://english.ohmynews.com/ArticleView/article_view.asp?no=381337&rel_no=1 NSA AG-Crypto
  853. Sting
  854. Privacy/Anonymity
  855. https://www.freenetproject.org - Anonymous distributed data-storing and communications system
  856. https://www.torproject.org - Home of the Tor Project
  857. https://ssl.scroogle.org - Encrypted anonymous Google searches also see cuil.com
  858. http://www.eff.org - Legal defenders of electronic rights, the ACLU of the internet
  859. http://www.epic.org - Electronic Privacy Information Center - a group that defends privacy online and
  860. in real life, has been pivotal in many cases
  861. http://www.tor2web.com - For when you just can't install Tor
  862. Network Forensics Evasion: How to exit the matrix - A how to guide about privacy that was taken
  863. offline.
  864. http://www.nickyhager.info/ebook-of-secret-power/ (UKUSA Agreement)
  865. https://forum.nonvocalscream.com/ Unofficial Tor Forums
  866. Security
  867. https://www.cacert.org - Free certificate authority
  868. 2600 Magazine - 2600.com - A hacking magazine with a lot of useful information. Only DeCSS
  869. defendant to fight the MPAA
  870. Secrets and Lies: Digital Security in a Networked World by Bruce Schneier - One of the best security
  871. books ever written
  872. Activist Security Guide – activistsecurity.org – A very in-depth guide about security for activists
  873. Security for Activists - http://security.resist.ca/personal/securebooklet.pdf
  874. Security at Resist.ca - http://security.resist.ca/
  875. Security at Riseup - http://help.riseup.net/security/
  876. http://citp.princeton.edu/memory/ - Information about Cold Boot Attacks
  877. Tech Collectives/Resourceshttps://www.hackbloc.org – Mainly US-based
  878. http://www.riseup.net – Mainly US based
  879. http://www.aktivix.org/ - Mainly UK based
  880. http://www.tao.ca – Mainly Canada Based
  881. http://www.resist.ca - Another Canadian riseup-like collective
  882. http://www.linux.org/groups/ Linux User Groups
  883. http://lug.org.uk/lugs/all UK Linux User Groups
  884. Software For Your Hidden Service:
  885. Wordpress.org – A blogging platform with no regard for privacy but much regard for usability. Could
  886. never get this to work in a virtual machine
  887. Drupal.org – A PHP content management system that's very popular and versatile
  888. http://www.acme.com/software/thttpd/ - Extremely lightweight webserver
  889. http://www.mediawiki.org – Wiki software that is used by Wikileaks and Wikipedia
  890. http://moinmo.in/ - Lightweight python-based wiki that is popular in the onion.
  891. https://www.yacy.net - A distributed search engine
  892. http://www.phpmyadmin.net/ A great SQL Database Manager with web interface
  893. Other Links:
  894. https://secure.wikileaks.org - Censored and leaked information from around the world
  895. http://www.cryptome.org - Censored and leaked information from around the world, mainly pertaining
  896. to intelligence
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement