TheHackersManual2015RevisedEdition
.pdfGet the UK’s best-selling
Linux magazine
OUT
NOW!
DELIVERED DIRECT TO YOUR DOOR
Order online at www.myfavouritemagazines.co.uk
or find us in your nearest supermarket, newsagent or bookstore!
EDITORIAL TEAM
MANAGING ART EDITOR |
EDITOR |
CONTRIBUTORS |
Fraser McDermott |
Neil Mohr |
Jonni Bidwell, Matt Beilby, |
|
|
Neil Bothwick, Chris Brown, |
ADDITIONAL ART |
EDITOR-IN-CHIEF |
Jolyon Brown, Kent Elchuk, |
Elly Walton |
Graham Barlow |
Matthew Hanson, Les Pounder, |
|
|
Richard Smedley, Alexander |
|
|
Tolstoy, Mihalis Tsoukalos. |
MANAGEMENT |
MARKETING |
CIRCULATION |
CONTENT & MARKETING DIRECTOR |
MARKETING MANAGER |
TRADE MARKETING MANAGER |
Nial Ferguson |
Richard Stephens |
Juliette Winyard |
|
|
Phone +44(0)7551 150984 |
HEAD OF CONTENT & MARKETING, TECH |
|
|
Nick Merritt |
PRINT & PRODUCTION |
LICENSING |
|
||
GROUP EDITOR-IN-CHIEF |
PRODUCTION MANAGER |
LICENSING & SYNDICATION DIRECTOR |
Paul Newman |
Mark Constance |
Regina Erak |
|
|
regina.erak@futurenet.com |
GROUP ART DIRECTOR |
PRODUCTION CONTROLLER |
Phone +44(0)1225 442244 |
Steve Gotobed |
Marie Quilter |
Fax +44 (0)1225 732275 |
SUBSCRIPTIONS
UK reader order line & enquiries: 0844 848 2852
Overseas reader order line & enquiries: +44 (0)1604 251045
Online enquiries: www.myfavouritemagazines.co.uk
Future Publishing Limited
Quay House, The Ambury, Bath, BA1 1UA, UK www.futureplc.com www.myfavouritemagazines.co.uk
Phone +44 (0)1225 442244 Fax +44 (0)1225 732275
All contents copyright © 2015 Future Publishing Limited or published under licence. All rights reserved. No part of this magazine may be reproduced, stored, transmitted or used in any way without the prior written permission of the publisher.
'VUVSF 1VCMJTIJOH -JNJUFE DPNQBOZ OVNCFS JT SFHJTUFSFE JO &OHMBOE BOE 8BMFT 3FHJTUFSFE PGmDF 3FHJTUFSFE PGmDF 2VBZ )PVTF 5IF "NCVSZ #BUI #" 6"
All information contained in this publication is for information only and is, as far as we are aware, correct at the time of going to press. Future cannot accept any responsibility for errors or inaccuracies in such information. You are advised to contact manufacturers and retailers directly with regard to the price and other details of products or services referred to in this publication. Apps and websites mentioned in this publication are not under our control. We are not responsible for their contents or any changes or updates to them.
If you submit unsolicited material to us, you automatically grant Future a licence to publish your submission in whole or in part in all editions of the magazine, including licensed editions worldwide and in any physical or digital format throughout the world. Any material you submit is sent at your risk and, although every care is taken, neither Future nor its employees, agents or subcontractors shall be liable for loss or damage.
Future is an award-winning international media group and leading digital business. We reach more than 49 million international consumers a month and create world-class content and advertising solutions for passionate consumers online, on tablet & smartphone and in print.
Future plc is a public |
Chief executive ;JMMBI #ZOH .BEEJDL |
company quoted |
Non-executive chairman Peter Allen |
on the London |
&KLHI ÀQDQFLDO RIÀFHU 3JDIBSE )BMFZ |
Stock Exchange |
5FM -POEPO |
TZNCPM '653 |
|
www.futureplc.com |
5FM #BUI |
Welcome!
…to the super-enhanced Hacker’s Manual for 2015. Dive in and learn how to hack everything.
Hacker! Lock up the children and hide the silver! Hacking has a bad name in the mainstream press, but we know the truth, hacking has much nobler roots.
It’s generally held as originating at MIT, in the 1960s, as a term for the crème de la crème of programmers. They were the master alchemists of languages such as Fortran, and known for pushing them beyond their limitations and making them work in ways they were never intended – what they achieved often felt like magic.
Hacking is really about making the most of
your systems, turning the conventional into the unconventional, and subverting tools to tasks no one thought possible. And like the original hackers it’s about a hunger for knowledge, which is why we’ve laid out the best tutorials and the most useful features from the most recent issues of Linux Format as a feast for the hungry hacker to devour.
You’ll learn things like how to stay anonymous online; how to secure your phone; how to take control of all your data and set up a personal cloud and even learn a few web cracks that the ‘Dark Side’ may try to fling in your direction.
We think this year’s Hacker Manual is the best one yet. Tuck in and enjoy the hack!
Neil Mohr, Editor
Guru Guides are designed to help experienced technology users dive deeper into a subject. Whether you’re learning a new programming language or planning to start a new business, each book aspires to be…
Ο A reference you can keep on your desk or next to your
computer and consult time and time again when you need to know how to do something or solve a problem
Ο A teacher – helping you develop your skills and take with you through your life, applying them at home or even in the workplace
Ο A challenge – we know that you know the basics so instead of patronising you we’ll suggest new things to try and help you take your knowledge to the next level
How are we doing? Email techbookseditor@futurenet.com and let us know if we’ve lived up to our promises!
Manifesto & Welcome
The Hacker’s Manual 2015 | 5
Contents
Dive into the world of hacking with this indepth manual that covers the big topics from the Linux kernel and wider open-source OS to hacking servers, the web and beyond.
Linux
Hack the kernel and dive into the open source OS that we all know and love
10 Next-gen Linux
18 Build your own kernel
24 Master package managers
28 Discover Arch Linux
32 Using Rescatux
Privacy
Keep it secret, keep it safe. Tools and hacks to block GCHQ and the NSA
38 Anonymising distros
45 Beat the NSA
54 Full-drive encryption
56 Build your own VPS
60 Cryptography explained
65 Android security
6 | The Hacker’s Manual 2015
sntentoC
Hardware
Cool hacks to bust open hardware and get it to run whatever OS you want
72 Linux on Chromebooks
76 Free Android
80 Crack open UEFI
84 Build a Linux PC
94 Advanced file systems
98 Build your own NAS
104 Build your own robot
108 OpenGL on the Pi
112 Hack your router
Networks Internet
Take control of your LAN and |
How to take control of the |
||
your servers with protocols |
world wide web, hack |
||
and monitoring tools |
servers and stay safe |
||
118 |
Master the basics |
162 |
Deploy OwnCloud and kick |
|
|
|
out Google forever! |
122 |
Go next-gen IPv6 |
|
|
|
|
166 |
Discover how you can hack |
126 |
Build a log server |
|
and protect servers |
130 |
Monitor packets |
174 |
Take control of your email |
|
with Wireshark |
|
with your own webmail |
134 |
Samba and Windows |
|
|
141 |
Docker and virtual servers |
|
|
150 |
Ldap authentication |
|
|
156 |
Discovering Dtrace |
|
|
The Hacker’s Manual 2015 | 7
Linux hacks
Dive into the kernel and deeper OS to take control of your systems
10Next-gen Linux
Get next-gen features of the kernel today with our guide to the latest developments.
18Build your own kernel
Take complete control and build the Linux kernel you want from the source.
24Package management
Discover how Linux controls and updates your software through apt-get and more.
28Arch Linux
Install the rolling release distro that all the expert hackers love and you will too.
32Recover systems with Rescatux
When it all goes wrong roll out Rescatux to recover lost files, partitions and more.
Contents | hacks Linux
The Hacker’s Manual 2015 | 9
Linux hacks | Cutting-edge Linux
Linux hacks
GET THE TECH OF
With the enthusiasm of a kid using the newest and shiniest toys, we show you how to play with the latest Linux software.
e often hear how wonderful WLinux is for older hardware,
and it is. Linux enables many users to keep using
systems that others would be forced to discard. But statements like that are also doing Linux a disservice, and
give the impression that it’s just a poor man’s operating system for hardware that’s no longer up to running the latest and greatest [<cough> - Ed] version of Windows.
Nothing could be further from the truth, Linux has some cutting edge software available, although the mainstream distros do not always reflect this. The distro development teams have to worry about compatibility and stability, so they generally
default to using stable, well tested software. Even popular distros such as Ubuntu, which uses Debian Testing packages and has a reputation for being forward looking, doesn’t use the very latest software.
So what do you do if you want to try life on
the bleeding edge? What software is out there that the distros are not yet using and how can you try it for yourself?
Over the next few pages, we will look at some of the new technologies being developed for Linux, but not in a theoretical
way. This is the stuff that may well appear in your favourite distribution next year, but we will show you how you can try it now.
You can see what the future holds, as we show you how to install it. We will also look at some of the pitfalls surrounding doing
this, after all, there is a reason the distros don’t include the latest experimental code, and show you how to try it without risking your system or your sanity. It doesn’t really matter which distro you currently
use, although some do make it easier than others (such as Arch or Gentoo) but something like the ubiquitious Ubuntu (or one of its derivatives, such as Linux Mint) or OpenSUSE or Fedora are also an excellent base for experimentation.
10 | The Hacker’s Manual 2015