Linux Security Methods

Total Page:16

File Type:pdf, Size:1020Kb

Linux Security Methods Network Security Using LINUX Michael Sweeney Network Security Using Linux by Michael Sweeney Copyright 2005 Michael Sweeney. All rights reserved Printed in the United States of America Published by PacketPress, 4917 Leeds Ave, Orange, CA 92867. PacketPress books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (www.packetpress.net). For more information contact our sales department at: 1-714-637-4235 or [email protected] Editor: Jeanne Teehan Technical Editor: Cover Designer: Amanda Sweeney Printing History: January 2005 First Edition. While every precaution has been taken in the preparation of this book, the publisher and the author assume no responsibility for errors, or omissions, or for damages resulting from the use of the information contained herein. "The idea is to try to give all the information to help others to judge the value of your contribution; not just the information that leads to judgment in one particular direction or another" Richard Feynman Table of Contents Network Security using Linux......................................................... Credits.............................................................................................X Preface............................................................................................xii Who is this book for?......................................................................................xiii How the book was written..............................................................................xiii Chapter 1..........................................................................................1 TCP/IP Fundamentals.........................................................................................1 Layers.................................................................................................................2 TCP/IP Addressing.............................................................................................3 Subnetting with CIDR...................................................................................6 Subnetting with VLSM..................................................................................7 TCP/IP Version 6...............................................................................................8 IPv6 and the Kernel.....................................................................................11 Constructing Packets........................................................................................14 TCP Communication........................................................................................16 Any port will do...........................................................................................18 What does a router really do?...........................................................................18 Open Source Linux Routers........................................................................20 Is a Linux router secure?..................................................................................22 Shutting off the unwanted services.............................................................22 Chapter 2........................................................................................24 Firewalling the Network...................................................................................24 Isn’t a router a firewall?...................................................................................26 IP v6 and IPTables...........................................................................................28 Patch-O-Matic.............................................................................................29 Firewalling 101................................................................................................31 Papers Please....................................................................................................34 The Penguin Builds a Wall...............................................................................34 TOC pv Bastille Linux...................................................................................................36 Free is good......................................................................................................37 IPCOP..........................................................................................................38 Firestarter.....................................................................................................40 Shorewall.....................................................................................................41 Web Based Tools.........................................................................................43 Commercial Firewalls......................................................................................44 Astaro..........................................................................................................44 Smoothwall..................................................................................................46 Gibraltar.......................................................................................................47 Resources.....................................................................................................50 Chapter 3........................................................................................52 IP Tables, Rules and Filters..............................................................................52 Chain Syntax...........................................................................................53 Rules.......................................................................................................53 Building of a Basic Rule..............................................................................54 Demonstrating rules................................................................................55 Advanced Rules...........................................................................................56 Matching Connection States...................................................................56 Configuring NAT...................................................................................57 Defending Against Basic Attacks ..........................................................59 Examing The Rules ................................................................................60 Strengthen Your Rules with ROPE .......................................................60 Your Basic Firewall.....................................................................................62 Firewall Testing...........................................................................................63 Firewall Script........................................................................................65 Resources.....................................................................................................72 Chapter 4........................................................................................73 Updating Linux................................................................................................73 RPMs................................................................................................................73 Red Hat Up2date..............................................................................................81 TOC pvi YUM.................................................................................................................84 APT..................................................................................................................86 What is a kernel update?..................................................................................87 How do I tell which kernel I have installed?...................................................88 How do I update the kernel?............................................................................88 Alternative Security Kernels............................................................................90 Keeping the LID on.....................................................................................91 Resources.....................................................................................................92 Chapter 5........................................................................................93 Encryption or protecting your Data..................................................................93 What is encryption?..........................................................................................93 What is this alphabet soup?..............................................................................94 How does encryption work?............................................................................95 What are keys all about?..................................................................................96 Why do I need encryption?..............................................................................98 How do I use GPG?..........................................................................................98 Managing keys...........................................................................................106 Revoking a Key....................................................................................106 Key Signing Parties..............................................................................107 Additional Notes About GnuPG................................................................108 Securing Data with SSH.................................................................................109
Recommended publications
  • Usability and Security of Personal Firewalls
    Usability and Security of Personal Firewalls Almut Herzog^ and Nahid Shahmehri^ Dept. of Computer and Information Science, Linkopings universitet,Sweden {almhe, nahsh}@ida.liu.se Abstract. Effective security of a personal firewall depends on (1) the rule granularity and the implementation of the rule enforcement and (2) the correctness and granularity of user decisions at the time of an alert. A misconfigured or loosely configured firewall may be more dangerous than no firewall at all because of the user's false sense of security. This study assesses effective security of 13 personal firewalls by comparing possible granularity of rules as well as the usability of rule set-up and its influence on security. In order to evaluate usability, we have submitted each firewall to use cases that require user decisions and cause rule creation. In order to evaluate the firewalls' security, we analysed the created rules. In ad­ dition, we ran a port scan and replaced a legitimate, network-enabled application with another program to etssess the firewalls' behaviour in misuse cases. We have conducted a cognitive walkthrough paying special attention to user guidance and user decision support. We conclude that a stronger emphasis on user guidance, on conveying the design of the personal firewall application, on the principle of least privilege and on implications of default settings would greatly enhance both usability and security of personal firewalls. 1 Introduction In times where roaming users connect their laptops to a variety of public, pri­ vate and corporate wireless or wired networks and in times where more and more computers are always online, host-based firewalls implemented in soft­ ware, called personal firewalls, have become an important part of the security armour of a personal computer.
    [Show full text]
  • Linux on the Road
    Linux on the Road Linux with Laptops, Notebooks, PDAs, Mobile Phones and Other Portable Devices Werner Heuser <wehe[AT]tuxmobil.org> Linux Mobile Edition Edition Version 3.22 TuxMobil Berlin Copyright © 2000-2011 Werner Heuser 2011-12-12 Revision History Revision 3.22 2011-12-12 Revised by: wh The address of the opensuse-mobile mailing list has been added, a section power management for graphics cards has been added, a short description of Intel's LinuxPowerTop project has been added, all references to Suspend2 have been changed to TuxOnIce, links to OpenSync and Funambol syncronization packages have been added, some notes about SSDs have been added, many URLs have been checked and some minor improvements have been made. Revision 3.21 2005-11-14 Revised by: wh Some more typos have been fixed. Revision 3.20 2005-11-14 Revised by: wh Some typos have been fixed. Revision 3.19 2005-11-14 Revised by: wh A link to keytouch has been added, minor changes have been made. Revision 3.18 2005-10-10 Revised by: wh Some URLs have been updated, spelling has been corrected, minor changes have been made. Revision 3.17.1 2005-09-28 Revised by: sh A technical and a language review have been performed by Sebastian Henschel. Numerous bugs have been fixed and many URLs have been updated. Revision 3.17 2005-08-28 Revised by: wh Some more tools added to external monitor/projector section, link to Zaurus Development with Damn Small Linux added to cross-compile section, some additions about acoustic management for hard disks added, references to X.org added to X11 sections, link to laptop-mode-tools added, some URLs updated, spelling cleaned, minor changes.
    [Show full text]
  • A Letter to the FCC [PDF]
    Before the FEDERAL COMMUNICATIONS COMMISSION Washington, DC 20554 In the Matter of ) ) Amendment of Part 0, 1, 2, 15 and 18 of the ) ET Docket No. 15­170 Commission’s Rules regarding Authorization ) Of Radio frequency Equipment ) ) Request for the Allowance of Optional ) RM­11673 Electronic Labeling for Wireless Devices ) Summary The rules laid out in ET Docket No. 15­170 should not go into effect as written. They would cause more harm than good and risk a significant overreach of the Commission’s authority. Specifically, the rules would limit the ability to upgrade or replace firmware in commercial, off­the­shelf home or small­business routers. This would damage the compliance, security, reliability and functionality of home and business networks. It would also restrict innovation and research into new networking technologies. We present an alternate proposal that better meets the goals of the FCC, not only ensuring the desired operation of the RF portion of a Wi­Fi router within the mandated parameters, but also assisting in the FCC’s broader goals of increasing consumer choice, fostering competition, protecting infrastructure, and increasing resiliency to communication disruptions. If the Commission does not intend to prohibit the upgrade or replacement of firmware in Wi­Fi ​ ​ devices, the undersigned would welcome a clear statement of that intent. Introduction We recommend the FCC pursue an alternative path to ensuring Radio Frequency (RF) compliance from Wi­Fi equipment. We understand there are significant concerns regarding existing users of the Wi­Fi ​ spectrum, and a desire to avoid uncontrolled change. However, we most strenuously advise against prohibiting changes to firmware of devices containing radio components, and furthermore advise against allowing non­updatable devices into the field.
    [Show full text]
  • Active-Active Firewall Cluster Support in Openbsd
    Active-Active Firewall Cluster Support in OpenBSD David Gwynne School of Information Technology and Electrical Engineering, University of Queensland Submitted for the degree of Bachelor of Information Technology COMP4000 Special Topics Industry Project February 2009 to leese, who puts up with this stuff ii Acknowledgements I would like to thank Peter Sutton for allowing me the opportunity to do this work as part of my studies at the University of Queensland. A huge thanks must go to Ryan McBride for answering all my questions about pf and pfsync in general, and for the many hours working with me on this problem and helping me test and debug the code. Thanks also go to Theo de Raadt, Claudio Jeker, Henning Brauer, and everyone else at the OpenBSD network hackathons who helped me through this. iii Abstract The OpenBSD UNIX-like operating system has developed several technologies that make it useful in the role of an IP router and packet filtering firewall. These technologies include support for several standard routing protocols such as BGP and OSPF, a high performance stateful IP packet filter called pf, shared IP address and fail-over support with CARP (Common Address Redundancy Protocol), and a protocol called pfsync for synchronisation of the firewalls state with firewalls over a network link. These technologies together allow the deployment of two or more computers to provide redundant and highly available routers on a network. However, when performing stateful filtering of the TCP protocol with pf, the routers must be configured in an active-passive configuration due to the current semantics of pfsync.
    [Show full text]
  • Ubuntu Enables Advanced Computer Research Into Killer Diseases
    Case Study Ubuntu enables advanced computer research into killer diseases Delivering training courses to researchers in developing countries – Ubuntu was the first choice for The Wellcome Trust Sanger Institute. Background The Wellcome Trust Sanger Institute is charity at the forefront of research into the study of the genomes of the world’s major killer diseases such as malaria, typhoid fever and the ‘superbug’ MRSA. The Trust aims to offers workshops for free to countries in the developing world. Giving their researchers up-to- date training in the fast-moving arena of analysis, and providing them with the mechanisms to keep up with new developments. In June 2006, the Trust ran the first of their workshop project in Uruguay. The courseprovided an introduction to the bioinformatics tools freely available on the Internet. It focussed primarily on The Human Genome data and gave students hands-on training in the use of public databases, and web-based sequence analysis tools. In addition to training researchers from all over South America the Wellcome Trust donated high-powered computers, essential for analysing the genomes, to the Instituto de Higiene, Uruguay. Business challenge The Instituto de Higiene set up a permanent training room to house the computers, and act as a centre for workshops in South America. The Institutes Informatics Systems Group needed to ensure that it was possible to install the training room computers, and networks, anywhere in the world that offers reliable electrical power and a connection to the Internet. That’s where Ubuntu came in. Ubuntu solution The Systems Group integrated Ubuntu into a flexible, self-contained training room that was straightforward enough for local staff to administer.
    [Show full text]
  • Campus Networking Best Practices Session 5: Wireless
    Campus Networking Best Practices Session 5: Wireless LAN Hervey Allen Dale Smith NSRC & University of Oregon University of Oregon & NSRC [email protected] [email protected] Wireless LAN • Provide wireless network across your campus that has the following characteristics: – Authentication – only allow your users – Roaming – allow users to start up in one section of your network, then move to another location – Runs on your campus network Firewall/ Border Traffic Shaper Router Wireless REN switch Authentication Core Gateway Router Core Servers Network Access Control (NAC) Enterprise Identity Management • Processes and Documentation of users. – Now you must deal with this. – What to use as the back-end user store? • LDAP • Active Directory • Kerberos • Other? – Will this play nice with future use? • email, student/staff information, resource access, ... Identity Management Cont. • An example of such a project can be seen here: – http://ccadmin.uoregon.edu/idm/ • This is a retrofit on to an already retrofitted system. • Learn from others and try to avoid this situation if possible. A Wireless Captive Portal The Wireless Captive Portal • Previous example was very simple. • A Captive Portal is your chance to: – Explain your Acceptable Use Policies – Decide if you must authenticate, or – Allow users on your network and monitor for problems instead (alternate solution). – Anything else? Branding? What's Happening? • remember our initial network diagrams...? • Do you think our hotel built their own solution? • Probably not... Commercial Solutions • Aruba http://www.arubanetworks.com/ • Bradford Networks – http://www.bradfordnetworks.com/ • Cisco NAC Appliance (Clean Access) – http://www.cisco.com/en/US/products/ps6128/ • Cisco Wireless LAN Controllers – http://www.cisco.com/en/US/products/hw/wireless/ • Enterasys http://www.enterasys.com/ • Vernier http://www.verniernetworks.com Open Source Solutions • CoovaChilli (morphed from Chillispot) – http://coova.org/wiki/index.php/CoovaChilli – Uses RADIUS for access and accounting.
    [Show full text]
  • EC-Council Network Security Administrator (Exam 312-38)
    Product Information Sheet Exam 312-38 EC-Council Network Security Administrator (Exam 312-38) Page | 1 ENSAv4 Copyright © by EC-Council All Rights Reserved. Reproduction is Strictly Prohibited. Product Information Sheet Exam 312-38 EC-Council NSA is CNSS 4011 Certified The Committee on National Security Systems (CNSS)/National Security Agency (NSA) of the United States of America certified EC-Council’s Network Security Administrator (ENSA) course as having met 100% of the requirements as set out by the Committee on National Security Systems (CNSS) National Standards 4011. This certification is managed by the Information Assurance Courseware Evaluation (IACE) Program, National INFOSEC (Information Security) Education and Training Program and is administered by the U.S. National Security Agency (NSA). The Committee on National Security Systems (CNSS) and National Security Agency (NSA) has developed a nationally recognized certification program based on NSTISSI standards. The CNSS/NSA Certification is a government class certification that is recognized as the National Training Standard for Information Security Professionals Students who have obtained these certifications would have demonstrated a solid grasp of the principles as outlined in the 4011 standard. With this, EC-Council has joined the ranks of the organizations United States Air Force Academy, United States Military Academy, Air Force Institute of Technology and Carnegie Mellon University; all of whom have attained the National Training Standard for Information Security Professionals - the CNSS 4011. Introduction The EC-Council's Network Security Administrator certification looks at the network security in defensive view while the CEH certification program looks at the security in offensive mode. The ENSA program is designed to provide fundamental skills needed to analyze the internal and external security threats against a network, and to develop security policies that will protect an organization’s information.
    [Show full text]
  • Iptables with Shorewall!
    Iptables with shorewall! Table of Contents 1. Install swarmlab-sec (Home PC) . 1 2. shorewall . 1 2.1. Installation . 2 3. Basic Two-Interface Firewall. 2 4. Shorewall Concepts . 3 4.1. zones — Shorewall zone declaration file . 3 4.2. interfaces — Shorewall interfaces file. 4 4.3. policy — Shorewall policy file . 4 4.4. rules — Shorewall rules file . 4 4.5. Compile then Execute . 4 5. Three-Interface Firewall. 5 5.1. zones . 6 5.2. interfaces . 6 5.3. policy . 7 5.4. rules . 7 5.5. masq - Shorewall Masquerade/SNAT definition file . 7 5.6. snat — Shorewall SNAT/Masquerade definition file . 8 5.7. Compile and Execute . 8 1. Install swarmlab-sec (Home PC) HowTo: See http://docs.swarmlab.io/lab/sec/sec.adoc.html NOTE Assuming you’re already logged in 2. shorewall Shorewall is an open source firewall tool for Linux that builds upon the Netfilter (iptables/ipchains) system built into the Linux kernel, making it easier to manage more complex configuration schemes by providing a higher level of abstraction for describing rules using text files. More: wikipedia 1 NOTE Our docker instances have only one nic to add more nic’s: create netowrk frist docker network create --driver=bridge --subnet=192.168.0.0/16 net1 docker network create --driver=bridge --subnet=192.168.0.0/16 net2 docker network create --driver=bridge --subnet=192.168.0.0/16 net3 then connect network to container connect network created to container docker network connect net1 master docker network connect net1 worker1 docker network connect net2 master docker network connect net2 worker2 now let’s look at the following image 2.1.
    [Show full text]
  • Test-Beds and Guidelines for Securing Iot Products and for Secure Set-Up Production Environments
    IoT4CPS – Trustworthy IoT for CPS FFG - ICT of the Future Project No. 863129 Deliverable D7.4 Test-beds and guidelines for securing IoT products and for secure set-up production environments The IoT4CPS Consortium: AIT – Austrian Institute of Technology GmbH AVL – AVL List GmbH DUK – Donau-Universit t Krems I!AT – In"neon Technologies Austria AG #KU – JK Universit t Lin$ / Institute for &ervasive 'om(uting #) – Joanneum )esearch !orschungsgesellschaft mbH *+KIA – No,ia -olutions an. Net/or,s 0sterreich GmbH *1& – *1& -emicon.uctors Austria GmbH -2A – -2A )esearch GmbH -)!G – -al$burg )esearch !orschungsgesellschaft -''H – -oft/are 'om(etence 'enter Hagenberg GmbH -AG0 – -iemens AG 0sterreich TTTech – TTTech 'om(utertechni, AG IAIK – TU Gra$ / Institute for A((lie. Information &rocessing an. 'ommunications ITI – TU Gra$ / Institute for Technical Informatics TU3 – TU 3ien / Institute of 'om(uter 4ngineering 1*4T – 1-Net -ervices GmbH © Copyright 2020, the Members of the IoT4CPS Consortium !or more information on this .ocument or the IoT5'&- (ro6ect, (lease contact8 9ario Drobics7 AIT Austrian Institute of Technology7 mario:.robics@ait:ac:at IoT4C&- – <=>?@A Test-be.s an. guidelines for securing IoT (ro.ucts an. for secure set-up (ro.uction environments Dissemination level8 &U2LI' Document Control Title8 Test-be.s an. gui.elines for securing IoT (ro.ucts an. for secure set-u( (ro.uction environments Ty(e8 &ublic 4.itorBsC8 Katharina Kloiber 4-mail8 ,,;D-net:at AuthorBsC8 Katharina Kloiber, Ni,olaus DEr,, -ilvio -tern )evie/erBsC8 -te(hanie von )E.en, Violeta Dam6anovic, Leo Ha((-2otler Doc ID8 DF:5 Amendment History Version Date Author Description/Comments VG:? ?>:G?:@G@G -ilvio -tern Technology Analysis VG:@ ?G:G>:@G@G -ilvio -tern &ossible )esearch !iel.s for the -2I--ystem VG:> >?:G<:@G@G Katharina Kloiber Initial version (re(are.
    [Show full text]
  • Te19 Emata Diplomovy19 Ych Prac19 2011/12
    Na´vrh te´mat diplomovy´ch a rocˇnı´kovy´ch pracı´ pro akademicky´rok 2012/13 Vedoucı´pra´ce: RNDr. Sˇa´rka Vavrecˇkova´, Ph.D. Poslednı´aktualizace: 22. rˇı´jna 2012 Upozorneˇnı´: te´ma musı´ by´t prˇed vybra´nı´m konzultova´no s vedoucı´m pra´ce. Pokud ma´te vlastnı´na´pad, je nutne´s nı´m prˇijı´t co nejdrˇı´v. Tento seznam je v aktua´lnı´elektronicke´formeˇ k dispozici na http://fpf.slu.cz/~vav10ui/obsahy/dipl/temata.pdf. DNS a ENUM (DNS and ENUM) Komenta´rˇ: ENUM (Electronic Number Mapping) je protokol vydany´organizacı´IETF, ktery´ Rezervova´no umozˇnˇuje prˇekla´dat telefonnı´cˇı´sla podle standardu E.164 na ru˚zna´URI podle existujı´cı´ch mozˇnostı´ (e-mail – Mailto, SIP, H323, ICQ, IRC, HTTP, FTP, IP adresa, atd.). Jde vlastneˇ o vytvorˇenı´a pouzˇı´va´nı´relacı´mezi ru˚zny´mi identifikacemi te´zˇe identity. Za´sady pro vypracova´nı´: IETF ENUM (Electronic Number Mapping) je protokol popisujı´cı´prˇe- klad telefonnı´ch cˇı´sel podle standardu E.164 na URI, standardizova´n jako RFC 3761. Student v pra´ci popı´sˇe princip DNS a ENUM, jejich vza´jemny´vztah, typicke´protokoly/sluzˇby, jejichzˇ URI mohou by´t cı´lem prˇekladu, na´vaznost na PSTN a VoIP, potrˇebne´protokoly, zabezpecˇenı´ proti chyba´m a beˇzˇny´m u´toku˚m, mozˇnosti vyuzˇitı´, konfiguraci ve zvolene´m DNS serveru. Zdroje: • ENUM [online]. Stra´nky organizace ITU-T. Dostupne´na: http://www.itu.int/osg/spu/enum/ • The E.164 to Uniform Resource Identifiers (URI) Dynamic Delegation Discovery System (DDDS) Application (ENUM)[online].
    [Show full text]
  • Pf3e Index.Pdf
    INDEX Note: Pages numbers followed by f, n, priority-based queues, 136–145 or t indicate figures, notes, and tables, match rule for queue assignment, respectively. 137–138 overview, 134–135 Symbols performance improvement, 136–137 # (hash mark), 13, 15 queuing for servers in DMZ, ! (logical NOT) operator, 42 142–144 setting up, 135–136 A on FreeBSD, 135–136 on NetBSD, 136 Acar, Can Erkin, 173 on OpenBSD, 135 ACK (acknowledgment) packets transitioning to priority and class-based bandwidth allocation, queuing system, 131–133 139–140 anchors, 35–36 HFSC algorithm, 124, 126, 142 authpf program, 61, 63 priority queues, 132, 137–138 listing current contents of, 92 two-priority configuration, loading rules into, 92 120–121, 120n1 manipulating contents, 92 adaptive.end value, 188 relayd daemon, 74 adaptive firewalls, 97–99 restructuring rule set with, 91–94 adaptive.start value, 188 tagging to help policy routing, 93 advbase parameter, 153–154 ancontrol command, 46n1 advskew parameter, 153–154, 158–159 antispoof tool, 27, 193–195, 194f aggressive value, 192 ARP balancing, 151, 157–158 ALTQ (alternate queuing) framework, atomic rule set load, 21 9, 133–145, 133n2 authpf program, 59–63, 60 basic concepts, 134 basic authenticating gateways, class-based bandwidth allocation, 60–62 139–140 public networks, 62–63 overview, 135 queue definition, 139–140 tying queues into rule set, 140 B handling unwanted traffic, 144–145 bandwidth operating system-based queue actual available, 142–143 assignments, 145 class-based allocation of, 139–140 overloading to
    [Show full text]
  • Network Devices Configuration Guide for Packetfence Version 6.5.0 Network Devices Configuration Guide by Inverse Inc
    Network Devices Configuration Guide for PacketFence version 6.5.0 Network Devices Configuration Guide by Inverse Inc. Version 6.5.0 - Jan 2017 Copyright © 2017 Inverse inc. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". The fonts used in this guide are licensed under the SIL Open Font License, Version 1.1. This license is available with a FAQ at: http:// scripts.sil.org/OFL Copyright © Łukasz Dziedzic, http://www.latofonts.com, with Reserved Font Name: "Lato". Copyright © Raph Levien, http://levien.com/, with Reserved Font Name: "Inconsolata". Table of Contents About this Guide ............................................................................................................... 1 Other sources of information ..................................................................................... 1 Note on Inline enforcement support ................................................................................... 2 List of supported Network Devices ..................................................................................... 3 Switch configuration .......................................................................................................... 4 Assumptions ............................................................................................................
    [Show full text]