Browse Source

A bit of everything

Håvard O. Nordstrand 5 years ago
parent
commit
43c7a7d2ae

+ 11 - 7
config/linux-servers/storage.md

@@ -60,13 +60,17 @@ breadcrumbs:
 
 See [smartmontools](../../linux-general/applications/#smartmontools).
 
-For HDDs, the attributes below should stay near 0 and should not be rising. If they are, it may indicate the drive is about to commit seppuku.
+For HDDs, the following attributes should stay near 0 and should not be rising. If they are, it may indicate the drive is about to commit seppuku.
 
-- 005: Reallocated Sectors Count
-- 187: Reported Uncorrectable Errors
-- 188: Command Timeout
-- 197: Current Pending Sector Count
-- 198: Uncorrectable Sector Count
+- 005 (Reallocated Sectors Count)
+- 187 (Reported Uncorrectable Errors)
+- 188 (Command Timeout)
+- 197 (Current Pending Sector Count)
+- 198 (Uncorrectable Sector Count)
+
+#### Seagate
+
+Attributes 1 (Raw Read Error Rate) and 7 (Seek Error Rate) can be a bit misleading, as a non-zero value does not mean there are errors. They are 48-bit values where the most significant 16 bits are the error count and the lower 32 bits are the number of operations (acting sort of like a fraction/rate).
 
 ## System Storage
 
@@ -284,7 +288,7 @@ The installation part is highly specific to Debian 10.
 Some guides recommend using backport repos, but this way avoids that.
 
 1. Enable the `contrib` and `non-free` repo areas.
-1. Install (it might give errors): `zfs-dkms zfsutils-linux zfs-zed`
+1. Install (will probably stall a bit because of errors): `apt install zfs-dkms zfsutils-linux zfs-zed`
 1. Load the ZFS module: `modprobe zfs`
 1. Fix the ZFS install: `apt install`
 

+ 24 - 0
config/linux-servers/unifi-debian.md

@@ -0,0 +1,24 @@
+---
+title: Ubiquiti UniFi Controller (Debian)
+breadcrumbs:
+- title: Configuration
+- title: Linux Servers
+---
+{% include header.md %}
+
+### Using
+{:.no_toc}
+
+UniFi 5 on Debian 9 (Stretch).
+
+## Forewords
+
+UniFi 5 is the latest version and does only officially support Debian 9 (Stretch) and Ubuntu Desktop/Server 16.04 for Linux. It requires Java 8 and other stuff which is an absolute pain to install on later versions of Debian. There is also the official physical Cloud Key device and multiple unofficial Docker images and installation packages for Linux servers.
+
+Official installation instructions: [UniFi - How to Install & Upgrade the UniFi Network Controller Software](https://help.ubnt.com/hc/en-us/articles/360012282453-UniFi-How-to-Install-Upgrade-the-UniFi-Network-Controller-Software)
+
+## Installation
+
+1. Install Debian 9.
+
+{% include footer.md %}

+ 1 - 1
config/network/cisco-ios-routers.md

@@ -24,7 +24,7 @@ breadcrumbs:
 ## Security
 
 - Disable directed broadcasts:
-  - `no ip directed-broadcast`
+  - Config: `no ip directed-broadcast`
   - Used by smurf and fraggle attacks.
 
 {% include footer.md %}

+ 0 - 4
config/network/cisco-ios-switches.md

@@ -248,8 +248,4 @@ Hold the "mode" button for 30 seconds or until it says in the console that it's
     - Alternating green-amber: Link fault. Could be caused by hardware errors or mismatched speed or duplex.
     - Amber and blinking amber: Blocked by STP.
 
-## Resources
-
-- [https://github.com/cisco-config-analysis-tool/ccat](https://github.com/cisco-config-analysis-tool/ccat)
-
 {% include footer.md %}

+ 54 - 35
config/network/cisco-ios.md

@@ -12,51 +12,70 @@ breadcrumbs:
 - [Cisco IOS Routers](../cisco-ios-routers/)
 - [Cisco IOS Switches](../cisco-ios-switches/)
 
-## General Configuration
+## Resources
 
-### Simple Actions
+- [Cisco Config Analysis Tool (CCAT)](https://github.com/cisco-config-analysis-tool/ccat)
 
-- Save running config: `copy run start` or `write mem`
-- Restore startup config: `copy start run`
-- Show configurations: `show [run|start]`
-    - `| section <section>` can be used to show a specific section.
-
-### AAA
-
-- Disable the `password-encryption` service, use encrypted passwords instead.
-- Use type 9 (scrypt) secrets.
-
-## Version String Convention
-
-- Running example: `15.0(2)SE11`
-- Train (`15.0SE`): Like the major versjon number.
-- Throttle (`2`): Like the minor version number.
-- Rebuild (`11`): Like the patch version number. Omitted for rebuild zero. May be specified as a letter directly after the throttle for old versions.
+## CLI
 
+### Modes
 
-## Theory
+- User EXEC mode (`Router>`):
+    - Used to run basic, non-privileged commands, like `ping` or `show` (limited).
+    - Entered when logging in as "not very privileged" users.
+- Privileged EXEC mode (`Router#`) (aka enable mode):
+    - Used to run more privileged (all) commands.
+    - Entered when logging in as "privileged" users or when running `enable` from user EXEC mode.
+- Global configuration mode (`Router(config)#`) and special configuration mode (`Router(config-xxx)#`):
+    - Used to configure the unit.
+    - Global configuration mode is entered by running `configure terminal` in privileged EXEC mode.
+    - "Special" configuration mode (it's not actually collectively called that) is entered when configuring an interface, a virtual router interface, a console line, a VLAN etc. from global configuration mode.
+- Setup mode:
+    - Used to interactivly configure some the "basics".
+    - Entered when loggin into a factory reset unit or when running `setup`.
+    - Completely useless, never use it.
+- ROM monitor mode (aka ROMMON).
 
-### CLI
+### General Usage
 
-#### Modes
+- Most commands take effect immediately.
+- Select range of interfaces: `int range g1/0/1-52` (example)
+- Reset interface(s): `default int [range] <if>[-<end>]`
+- CLI interaction:
+    - Tab: Auto-complete.
+    - `?`: Prints the allowed keywords.
+    - `| <filter>`: Can be used to filter the output using one of the filter commands.
 
-- User EXEC mode (`Router>`).
-- Privileged EXEC mode (`Router#`).
-- Configuration modes:
-    - Global configuration mode (`Router(config)#`).
-    - Interface, line, etc. configuration mode (`Router(config-xxx)#`).
-- Setup mode.
-- ROMMON mode.
+## Configuration
 
-#### Using the CLI
+### Basics
 
-- Tab: Auto-complete.
-- `?`: Prints the allowed keywords.
-- `|`: Can be used to filter the output.
+- Save running config: `copy run start` or `write mem`
+- Restore startup config: `copy start run`
+- Show configurations: `show [run|start]`
+    - `| section <section>` can be used to show a specific section.
 
-##### Configuration Mode
+### AAA
 
-- Select range of interfaces: `int range g1/0/1-52` (example)
-- Reset interface(s): `default int [range] <if>[-<end>]`
+- Disable the `password-encryption` service, use encrypted passwords instead. Perferrably type 9 (scrypt) secrets if available.
+
+## Miscellaneous
+
+### Version and Image String Notations
+
+- Version 12 notation (e.g. `12.4(24a)T1`):
+    - Major release (`12`).
+    - Minor release (`4`).
+    - Maintenance number (`24`).
+    - Rebuild number (alt. 1) (`a`).
+    - Train identifier (`T`).
+    - Rebuild number (alt. 2) (`1`).
+- Version 15 notation (e.g. `15.0(1)M1`):
+    - Major release (`15`).
+    - Minor release (`0`).
+    - Feature release (`1`).
+    - Release type (`M`).
+    - Rebuild number (`1`).
+- If it has `K9` in the image name, it has cryptographic features included. Some images don't because of US export laws.
 
 {% include footer.md %}

+ 7 - 0
config/network/linux.md

@@ -26,6 +26,8 @@ Issues may also be related to stupid things like which ports you're using on the
 
 ## Setup
 
+(In semi-random order.)
+
 - Setup the Linux node as described in [Debian Server: Basic Setup](/config/linux-server/debian-server/#basic-setup).
 - Setup the firewall for filtering both forwarded traffic and input/output to the router.
 - Setup the firewall for NAT.
@@ -49,4 +51,9 @@ Issues may also be related to stupid things like which ports you're using on the
 - Make sure network interrupts from a given NIC are distributed across all cores.
     - See `/proc/interrupts`.
 
+## Notes
+
+- DHCPv4 servers and clients use raw sockets, which bypasses Netfilter, because it uses special IP addresses.
+  DHCPv6 does not, however, because it uses real IP addresses.
+
 {% include footer.md %}

+ 62 - 71
config/network/security.md

@@ -8,92 +8,83 @@ breadcrumbs:
 
 ## Hosts
 
-- Directed broadcasts of ICMP echo:
-  - Should generally be disabled.
-  - Exploited by smurf and fraggle attacks.
-  - Linux:
-    - ICMP echo reception disabled by default.
-    - `icmp_echo_ignore_broadcasts=1`
-- ICMP redirects:
-  - Should be blocked or ignored.
-  - Allows attackers to change the default gateway or inject bogus routes.
-  - The secure variant (Linux) specifies that the host will only accept redirects from hosts in its gateway list.
-  - Can be blocked by the firewall or ignored through configuration.
-  - Ignore with Linux:
-    - Redirects are accepted by default on hosts and ignored by default on routers. IPv4 secure redirects are enabled by default.
-    - IPv4: `net.ipv4.conf.all.accept_redirects=0`
-    - IPv6: `net.ipv6.conf.all.accept_redirects=0`
-    - IPv4 secure: `net.ipv4.conf.all.secure_redirects=0`
-- Syn cookies:
-  - Should be enabled on servers.
-  - Prevents connection-based DDoS attacks.
-  - When the connection queue is filled up, syn cookies are used for new connections. Connections using syn cookies must have all TCP options rejected, thus violating TCP.
-  - Linux:
-    - Enabled by default.
-    - `net.ipv4.tcp_syncookies=1`
+- Smurf and Fraggle attacks:
+    - DDoS where the adversary uses sends an ICMP/UDP echo packet (or similar) to a broadcast/multicast address using a spoofed source address, causing all reply traffic to be sent toward the user of the spoofed address.
+    - Linux hosts:
+        - Ignore broadcast/multicast ICMP echo and timestamp: `net.ipv4.icmp_echo_ignore_broadcasts=1` (Ignored (1) by default)
+        - Ignore UDP echo etc.: Firewall it.
+- ICMP redirects (IPv4):
+    - Should be blocked or ignored for IPv4 since they can act as attack vectors and are basically never used in network designs.
+    - Allows attackers to change the default gateway or inject bogus routes.
+    - For IPv6, it is a more central functionality and should not be disabled.
+    - Can be blocked by the firewall or ignored through configuration.
+    - Linux:
+        - Linux has a secure variant (`secure_redirects`) that specifies that the host will only accept redirects from hosts in its gateway list.
+        - Disable reception of "insecure" ICMP redirects: `net.ipv4.conf.<all+default>.accept_redirects=0` (enabled (1) for hosts and disabled (0) for routers by default)
+        - Disable reception of secure ICMP redirects`net.ipv4.conf.<all+default>.secure_redirects=0` (enabled (1) by default)
+        - Disable sending ICMP redirects: `net.ipv4.conf.<all+default>.send_redirects=0` (enabled (1) by default)
+- SYN cookies:
+    - Should be enabled on servers.
+    - Prevents TCP DDoS attacks.
+    - When the connection queue is filled up, SYN cookies are used for new connections. Connections using SYN cookies must have all TCP options rejected, thus violating TCP.
+    - Linux:
+        - Enable: `net.ipv4.tcp_syncookies=1` (enabled (1) by default)
 
 ## Switches
 
-**TODO** (see switch pages)
+**TODO** (see switch pages, personal notes and papers on my desk)
 
 ## Routers
 
-- Bogin filtering:
-  - Should be enabled if appropriate.
-  - Blocks packets from fake/invalid addresses such as from unused or unallocated prefixes.
-  - May include RFC 1918 addresses.
-  - Can be done by explicitly blacklisting all stable bogon prefixes.
+- ICMP redirects:
+    - See the [Hosts](#hosts) section.
+- Source routing:
+    - Should generally be disabled unless required. May be used in certain mobility scenarios.
+    - Allows attackers to send packets to unintended paths/destinations.
+    - For IPv4, there is the Strict Source Route (SSR) option and the Loose Source Routing (LSR) option. Both are considered insecure.
+    - For IPv6, there is the type 0 routing header, type 2 routing header and type 4 Segment Routing Header.
+    - Linux:
+        - Enabled by default on routers.
+        - Disable IPv4 SSR and LSR: `net.ipv4.conf.<all+default>.accept_source_route=0` (disabled (0) for hosts and enabled (1) for routers by default)
+        - Disable IPv6 type 0 routing headers only: `net.ipv6.conf.all.accept_source_route=0` (type 2 only allowed (0) by default)
+            - (Optional) Disable both IPv6 type 0 and 2 routing headers: `net.ipv6.conf.all.accept_source_route=-1`
+    - Cisco IOS:
+        - Disable source routing: `no source-route` (enabled by default)
 - Source verification:
-  - Should be enabled if appropriate.
-  - Prevents attackers on stub networks from spoofing source addresses outside the network.
-  - Can be done with the firewall.
+    - Should be handled somehow if possible.
+    - May prevent spoofed IP addresses, especially
+    - Can be done with firewall rules, reverse path forwarding (RPF), DHCP snooping-based verification, etc. based on scenario.
 - Reverse path filtering:
-  - Should be enabled.
-  - Filters packets from sources that are not reachable by the FIB (loose mode); or filter packets from sources that are not received on the interface that would be used to reach the source (strict mode).
-  - Use strict mode for most cases and loose mode if using asymmetric routing.
-  - Linux:
-    - Disabled by default but enabled by some distros.
-    - Use 1 for strict mode and 2 for loose mode.
-    - `net.ipv4.conf.all.rp_filter=<1|2>`
-- Directed broadcasts (forwarding):
-  - Should generally be disabled.
-  - Exploited by smurf and fraggle attacks.
-  - Linux:
-    - **TODO**
-  - Cisco IOS:
-    - Disabled by default.
-    - `no ip directed-broadcast`
-- Source routing:
-  - Should generally be disabled.
-  - Allows attackers to send packets to unintended paths/destinations.
-  - Uses the Strict Source Route (SSR) or Loose Source Routing (LSR) IPv4 header options.
-  - IPv6 source routing has been deprecated and replaced by segment routing.
-  - Linux:
-    - Enabled by default on routers.
-    - IPv4: `net.ipv4.conf.all.accept_source_route=0`
-    - (Optional) IPv6 (segment routing): `net.ipv6.conf.all.accept_source_route=-1`
-  - Cisco IOS:
-    - `no source-route`
-- ICMP redirects:
-  - See [Hosts](#hosts).
+    - Should be enabled. Use strict mode for most cases and loose mode if using asymmetric routing.
+    - Filters packets from sources that are not reachable by the FIB (loose mode); or filter packets from sources that are not received on the interface that would be used to reach the source (strict mode).
+    - Linux:
+        - Enable strict RPF (1) or loose RPF (2): `net.ipv4.conf.all.rp_filter=<0|1|2>` (default varies by distro, but generally disabled by default)
+- Directed broadcast forwarding:
+    - Should be disabled.
+    - Exploited by e.g. smurf and fraggle attacks.
+    - Linux routers:
+        - Always disabled.
+    - Cisco IOS:
+        - Disable `no ip directed-broadcast` (disabled by default)
+- Bogin filtering:
+    - Should be enabled if appropriate.
+    - Blocks packets from fake/invalid addresses such as from unused or unallocated prefixes.
+    - May include RFC 1918 addresses.
+    - Can be done by explicitly blacklisting all stable bogon prefixes.
 
 ## L4 Firewalls
 
-- NAT:
-  - Universal Plug and Play (UPnP), NAT Port Mapping Protocol (NAT-PMP), Port Control Protocol (PCP), Session Traversal Utilities for NAT (STUN), etc. can function as attack vectors as an adversarial program may be able to exploit it to allow external connections to internal devices. It should generally be turned off except if explicitly needed. It's typically used by multiplayer games and other peer-to-peer applications.
+- NAT traversal protocols:
+    - E.g. Universal Plug and Play (UPnP), NAT Port Mapping Protocol (NAT-PMP), Port Control Protocol (PCP), Session Traversal Utilities for NAT (STUN).
+    - Should generally be turned off unless explicitly needed. It's typically used by multiplayer games and other peer-to-peer applications.
+    - Can function as attack vectors as an adversarial program may be able to exploit it to allow external connections to internal devices.
 
 ## L7 Firewalls
 
-## Intrusion Detection Systems (IDSes)
+*Empty.*
 
-## Theory
-
-### Firewalls and Intrusion Detection Systems (IDSes)
+## Intrusion Detection Systems (IDSes)
 
-- Network address translation (NAT):
-  - Hairpinning/reflection: Reroute internal requests from a NATed network to an edge router's external IP address back into the router. It allows using domain names with public IP addresses from within the NATed network.
-  - Generally avoided in IPv6. Network prefix translation (NPT), however, can be used to translate dynamic global prefixes to static site-local prefixes.
-- Layer 7 firewalls: A.k.a. next-generation firewalls (NGFW). Provides deep packet inspection (DPI). Provides a foundation for IDS/IPS, user identity management and web application firewalls (WAF).
-- Intrusion prevention systemes (IPSes or IDPs): Can block traffic once a threat has been identified, unlike a plain IDS.
+*Empty.*
 
 {% include footer.md %}