forked from andonome/lk
initial commit
This commit is contained in:
90
networking/basics.md
Normal file
90
networking/basics.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# Protocols
|
||||
|
||||
| TCP | UDP | ICMP |
|
||||
|:-----------------|:-----------------|:------------------|
|
||||
|Transmission Control Protocol | User Datagram Protocol | Internet Control Message Protocol |
|
||||
| Reliable and slow. | Fast but unreliable, such as VOIP. Provides checksums. | Dirty checks such as pings. |
|
||||
|
||||
|
||||
|
||||
|
||||
# Networking Addressing
|
||||
|
||||
## IPv4
|
||||
|
||||
Three address ranges pertain only to private networks, so no computer looks beyond the local router to resolve them:
|
||||
|
||||
10.0.0.0 to 10.255.255.255
|
||||
|
||||
172.16.0.0 to 172.31.255.255
|
||||
|
||||
192.168.0.0 to 192.168.255.255
|
||||
|
||||
In theory, networks should fall within one of 3 ranges, depending upon their first octet:
|
||||
|
||||
Class A 1-127
|
||||
|
||||
Class B 128 to 191
|
||||
|
||||
Class C 192 to 223
|
||||
|
||||
|
||||
|
||||
# Service Ports
|
||||
|
||||
There are three types of port ranges:
|
||||
|
||||
1 to 1023: Well-known and established ports.
|
||||
|
||||
1024 to 49151 ICANN registered ports, used by various products, with limited oversight.
|
||||
|
||||
49152 to 65535 Dynamic ports for ad hoc use.
|
||||
|
||||
View a more complete list of ports with:
|
||||
|
||||
> less /etc/services
|
||||
|
||||
|
||||
# ip
|
||||
|
||||
Show all addresses with:
|
||||
|
||||
> ip a{dd{ress}} s{how}
|
||||
|
||||
If a link's not present, load it with:
|
||||
|
||||
sudo ip link set dev wlp3s0 up
|
||||
|
||||
Add an interface to a device as so:
|
||||
|
||||
> sudo ip a add 192.168.0.15/255.255.255.0 dev eth1
|
||||
|
||||
See network interfaces available on Fedora with:
|
||||
|
||||
> less /etc/sysconfig/network-scripts/ifcfg-enp2s0f0
|
||||
|
||||
or on Debian with:
|
||||
|
||||
> less /etc/network/interfaces
|
||||
|
||||
Mostly, interfaces will receive automatic addresses from a DHCP server. If this hasn't happened for you, you can request a dhcp address with:
|
||||
|
||||
> sudo dhclient eth1
|
||||
|
||||
View your current route to the internet with:
|
||||
|
||||
> route
|
||||
|
||||
... although on void this is:
|
||||
|
||||
> routel
|
||||
|
||||
If you don't have a route to the internet, you can manually specify the default gateway with:
|
||||
|
||||
> sudo route add default gw 192.168.0.1
|
||||
|
||||
... or ...
|
||||
|
||||
> sudo ip route add default via 192.168.0.1
|
||||
|
||||
|
22
networking/dns.md
Normal file
22
networking/dns.md
Normal file
@@ -0,0 +1,22 @@
|
||||
# Designate DNS
|
||||
|
||||
On Debian, a file might gain DNS services by adding the following to /etc/network/interfaces:
|
||||
|
||||
----------------
|
||||
auto eth0
|
||||
iface eth0 inet static
|
||||
address 10.0.0.23
|
||||
netmast 255.255.255.0
|
||||
gateway 10.0.0.1
|
||||
dns-nameservers 208.67.222.222 208.67.220.220
|
||||
dns-search example.com
|
||||
|
||||
----------------
|
||||
|
||||
# URL Aliases
|
||||
|
||||
To change where hosts go, edit /etc/hostnames. You can enter, e.g.:
|
||||
|
||||
`54.239.25.200 www.amazon.com a`
|
||||
|
||||
... which then means simply the letter 'a' will lead you to amazon.com.
|
20
networking/fail2ban.md
Normal file
20
networking/fail2ban.md
Normal file
@@ -0,0 +1,20 @@
|
||||
# SSH Daemon Jail
|
||||
|
||||
> sudo vim /etc/fail2ban/jail.d/ssh.local
|
||||
|
||||
```
|
||||
[sshd]
|
||||
enabled = true
|
||||
|
||||
ignoreip = 127.0.0.1/8 ::1,192.168.0.0/16 ::1
|
||||
|
||||
```
|
||||
|
||||
> sudo systemctl restart fail2ban
|
||||
|
||||
> sudo fail2ban-client status
|
||||
|
||||
> sudo fail2ban-client status sshd
|
||||
|
||||
|
||||
|
12
networking/graph-easy/example.txt
Normal file
12
networking/graph-easy/example.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
[ One ] { fill: seagreen; color: white; } -- label --> [ Two ] { shape: triangle; }
|
||||
[ One ] => { arrow-style: closed; } [ Three ]
|
||||
[ Five ] { fill: maroon; color: yellow; } <=> [ Three ]
|
||||
[ One ] .. Test\n label ..> [ Four ]
|
||||
[ Three ] { border-style: dashed; }
|
||||
.. Test\n label ..> { arrow-style: closed; } [ Six ] { label: Sixty\n Six\nand\nsix; }
|
||||
[ Seven ] -- [ Eight ]
|
||||
[ Five ] --> [ Eight ]
|
||||
[ Five ] --> [ Seven ]
|
||||
[ Two ] -> [ Four ]
|
||||
[ Three ] <-- Test label --> { arrow-style: closed; } [ Six ]
|
||||
[ Eight ] .. [ None ] { shape: none; fill: red; color: brown; }
|
53
networking/iptables.md
Normal file
53
networking/iptables.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# Intro
|
||||
|
||||
This is a basic Linux firewall program.
|
||||
|
||||
Look at your firewalls:
|
||||
|
||||
> iptables -L
|
||||
|
||||
We see the output of input, output and forwarding rules.
|
||||
|
||||
# Forward
|
||||
|
||||
I don't need any forwarding, so I'm going to drop all forwarding:
|
||||
|
||||
> iptables -P FORWARD DROP
|
||||
|
||||
# Input
|
||||
|
||||
Let's 'A'dd, or 'A'ppend a rule with -A. Let's drop all input from a nearby IP
|
||||
|
||||
> iptables -A INPUT -s 192.168.0.23 -j DROP
|
||||
|
||||
Or we can block all input from a particular port on the full network.
|
||||
|
||||
> iptables -A INPUT -s 192.168.0.0/24 -p tcp --destination-port 25 -j DROP
|
||||
|
||||
> iptables -A INPUT --dport 80 -j ACCEPT
|
||||
|
||||
|
||||
This allows http traffic to an Apache web server over port 80.
|
||||
|
||||
However, rules are accepted in order - so a packet cannot be rejected and then accepted.
|
||||
|
||||
To delete rule 2 from the INPUT chain:
|
||||
|
||||
> iptables -D INPUT 3
|
||||
|
||||
Alternatively, you can 'I'nsert a rule at the start, rather than 'A'ppending it.
|
||||
|
||||
> iptables -I INPUT -s 192.168.0.13 DROP
|
||||
|
||||
# Catchalls
|
||||
|
||||
Catchall rules state that anything which is not permitted is forbidden. They must be allowed last.
|
||||
|
||||
# -Jurice-Diction
|
||||
|
||||
The -j flag accepts ACCEPT/REJECT/DROP. The last two are identical except that "REJECT" acknowledges the rejection.
|
||||
|
||||
Flush all existing rules with:
|
||||
|
||||
> iptables -F
|
||||
|
19
networking/iptables/examples.sh
Normal file
19
networking/iptables/examples.sh
Normal file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# Allow all loopback (lo0) traffic and drop all traffic to 127/8
|
||||
# that doesn't use lo0
|
||||
iptables -A INPUT -i lo -j ACCEPT
|
||||
iptables -A OUTPUT -o lo -j ACCEPT
|
||||
iptables -A INPUT -d 127.0.0.0/8 ! -i lo -j REJECT --reject-with icmp-port-unreachable
|
||||
|
||||
# Allow established sessions to receive traffic
|
||||
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||
|
||||
# Allow ICMP pings
|
||||
iptables -A INPUT -p icmp -m icmp --icmp-type 8 -j ACCEPT
|
||||
|
||||
# Allow SSH remote
|
||||
iptables -I INPUT -p tcp --dport 22 -j ACCEPT
|
||||
|
||||
# Reject all other inbound connections
|
||||
iptables -A INPUT -j REJECT --reject-with icmp-port-unreachable
|
||||
iptables -A FORWARD -j REJECT --reject-with icmp-port-unreachable
|
52
networking/iptables/iptables.md
Normal file
52
networking/iptables/iptables.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# Intro
|
||||
|
||||
This is a basic Linux firewall program.
|
||||
|
||||
Look at your firewalls:
|
||||
|
||||
> iptables -L
|
||||
|
||||
We see the output of input, output and forwarding rules.
|
||||
|
||||
# Forward
|
||||
|
||||
I don't need any forwarding, so I'm going to drop all forwarding:
|
||||
|
||||
> iptables -P FORWARD DROP
|
||||
|
||||
# Input
|
||||
|
||||
Let's 'A'dd, or 'A'ppend a rule with -A. Let's drop all input from a nearby IP
|
||||
|
||||
> iptables -A INPUT -s 192.168.0.23 -j DROP
|
||||
|
||||
Or we can block all input from a particular port on the full network.
|
||||
|
||||
> iptables -A INPUT -s 192.168.0.0/24 -p tcp --destination-port 25 -j DROP
|
||||
|
||||
> iptables -A INPUT --dport 80 -j ACCEPT
|
||||
|
||||
|
||||
This allows http traffic to an Apache web server over port 80.
|
||||
|
||||
However, rules are accepted in order - so a packet cannot be rejected and then accepted.
|
||||
|
||||
To delete rule 2 from the INPUT chain:
|
||||
|
||||
> iptables -D INPUT 3
|
||||
|
||||
Alternatively, you can 'I'nsert a rule at the start, rather than 'A'ppending it.
|
||||
|
||||
> iptables -I INPUT -s 192.168.0.13 DROP
|
||||
|
||||
# Catchalls
|
||||
|
||||
Catchall rules state that anything which is not permitted is forbidden. They must be allowed last.
|
||||
|
||||
# -Jurice-Diction
|
||||
|
||||
The -j flag accepts ACCEPT/REJECT/DROP. The last two are identical except that "REJECT" acknowledges the rejection.
|
||||
|
||||
Flush all existing rules with:
|
||||
|
||||
> iptables -F
|
11390
networking/ldap/guide.html
Normal file
11390
networking/ldap/guide.html
Normal file
File diff suppressed because it is too large
Load Diff
17
networking/nmap.md
Normal file
17
networking/nmap.md
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
Example:
|
||||
|
||||
> nmap 192.168.1.1/24
|
||||
|
||||
Flags:
|
||||
|
||||
| Flag | Meaning | Effect |
|
||||
| :---| :---| :---|
|
||||
| -F | Fast | First 100 ports only |
|
||||
|
||||
Look for a web server, which has ports 80 and 443 open:
|
||||
|
||||
> nmap 192.168.1.1/24 -p 80,443 --open
|
||||
|
||||
|
||||
|
27
networking/pihole/pihole.md
Normal file
27
networking/pihole/pihole.md
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
# List Out DNS
|
||||
|
||||
> echo "addn-hosts=/etc/pihole/lan.list" | sudo tee /etc/dnsmasq.d/02-lan.conf
|
||||
|
||||
Then edit that list
|
||||
|
||||
> sudo vim /etc/dnsmasq.d/02-lan.conf
|
||||
|
||||
`192.168.0.10 ratking.lan ratking`
|
||||
|
||||
Then restart the pihole's dns:
|
||||
|
||||
> sudo pihole restartdns
|
||||
|
||||
#View DNS traffic
|
||||
|
||||
> pihole -t
|
||||
|
||||
#Change password
|
||||
|
||||
> pihole -a -p
|
||||
|
||||
# Get new list of cancer
|
||||
|
||||
> pihole -g
|
||||
|
5
networking/pip.md
Normal file
5
networking/pip.md
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
Upgrade all packages
|
||||
|
||||
> pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
|
||||
|
6
networking/qutebrowser
Normal file
6
networking/qutebrowser
Normal file
@@ -0,0 +1,6 @@
|
||||
set tabs.position left
|
||||
|
||||
# Download css files to theme.
|
||||
|
||||
:set content.user_stylesheets
|
||||
|
55
networking/rclone.md
Normal file
55
networking/rclone.md
Normal file
@@ -0,0 +1,55 @@
|
||||
The manpage's 'Synopsis' provides a fast reference.
|
||||
|
||||
We'll assume a folder in Google Drive called 'test', and local folder called 'foo'.
|
||||
|
||||
Generate a config file with:
|
||||
|
||||
> rclone config
|
||||
|
||||
Look at the contents of Google Drive:
|
||||
|
||||
> rclone ls gd:/
|
||||
|
||||
If rclone loses authorization:
|
||||
|
||||
> rclone authorization
|
||||
|
||||
List only directories:
|
||||
|
||||
> rclone lsf -dirs-only google:/
|
||||
|
||||
Mount the remote location on /tmp/google with:
|
||||
|
||||
> rclone mount google /tmp/google
|
||||
|
||||
Copy the contents of 'foo' to 'test'.
|
||||
|
||||
> rclone copy foo/ google:test
|
||||
|
||||
Sync contents of foo and test with a progress bar (will delete Google items):
|
||||
|
||||
> rclone sync foo google:test -P
|
||||
|
||||
Remove all duplicates
|
||||
|
||||
> rclone dedupe google:test
|
||||
|
||||
Delete contets of a remote file:
|
||||
|
||||
> rclone delete n:test
|
||||
|
||||
Or delete the folder and contents as well:
|
||||
|
||||
> rclone purge n:test
|
||||
|
||||
Copy to and from with:
|
||||
|
||||
> rclone copyto google:test foo
|
||||
|
||||
or
|
||||
|
||||
> rclone copyto foo google:test
|
||||
|
||||
|
||||
|
||||
|
50
networking/screen.md
Normal file
50
networking/screen.md
Normal file
@@ -0,0 +1,50 @@
|
||||
|
||||
start session: screen
|
||||
|
||||
> screen -S 'name'
|
||||
Make a screen with name 'name'
|
||||
> screen -r 'name'
|
||||
Reattach screen 'name'. Names need not be complete
|
||||
> screen -ls
|
||||
list screen sessions
|
||||
> screen -X -S 'screen' 'command'
|
||||
Send 'command' to 'screen', e.g. 'quit',
|
||||
|
||||
**Ctrl + a**
|
||||
Screens have a list of commands to send
|
||||
|
||||
:? - keybindings
|
||||
:" - list screen sessions
|
||||
:A - rename window
|
||||
:d - detatch
|
||||
:k - kill the screen
|
||||
:n - next screen
|
||||
:p - previous screen
|
||||
:\ - kill all screens
|
||||
:| - create new pane
|
||||
|
||||
**Panes**
|
||||
:| - create new pane
|
||||
:w - list of windows, input name of window to summon
|
||||
:C - clear pane
|
||||
:d - detatch pane
|
||||
:X - kill pane
|
||||
:* - displays
|
||||
:{/} - history
|
||||
:i - info
|
||||
:k - kill
|
||||
:x - lockscreen
|
||||
:L - login
|
||||
:S - horizontal pane
|
||||
:w - list of open windows
|
||||
[n] - pick number 1-0 to pick a window
|
||||
|
||||
|
||||
------Example----------
|
||||
Start a new session with 'screen -S base' (which calls that session 'base'). Make a horizontal split with ^|, move into it with ^tab then create a new screen with ^c in that second split. The new screen can be named with ^A as 'music' before entering cmus. Next up, visualizations with vis in another screen. ^S makes a horizontal split and you can switch into that with ^tab to name is 'visualizations' and start vis. Switch back to the first screen and make another horizontal split and a screen in there with the name 'reading'. Inside reading you type ^? to get a list of useless screen commands. Reading can then be detatched with ^d and the horizontal split destroyed with ^X.
|
||||
Those visualizations should be larger, so we enlarge them with Ctrl+: to send the command resize 50 and :resize -h 100.
|
||||
Once done with reading, you can destroy it wil ^k then destroy the lot once done with ^\. Outside the screens entirely you can ensure complete death with 'killall screen'.
|
||||
|
||||
----------------------
|
||||
|
||||
|
108
networking/screenrc
Normal file
108
networking/screenrc
Normal file
@@ -0,0 +1,108 @@
|
||||
# $Id: screenrc,v 1.15 2003/10/08 11:39:03 zal Exp $
|
||||
#
|
||||
# /etc/screenrc
|
||||
#
|
||||
# This is the system wide screenrc.
|
||||
#
|
||||
# You can use this file to change the default behavior of screen system wide
|
||||
# or copy it to ~/.screenrc and use it as a starting point for your own
|
||||
# settings.
|
||||
#
|
||||
# Commands in this file are used to set options, bind screen functions to
|
||||
# keys, redefine terminal capabilities, and to automatically establish one or
|
||||
# more windows at the beginning of your screen session.
|
||||
#
|
||||
# This is not a comprehensive list of options, look at the screen manual for
|
||||
# details on everything that you can put in this file.
|
||||
#
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# SCREEN SETTINGS
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
startup_message off
|
||||
#nethack on
|
||||
|
||||
#defflow on # will force screen to process ^S/^Q
|
||||
deflogin on
|
||||
#autodetach off
|
||||
|
||||
# turn visual bell on
|
||||
vbell on
|
||||
vbell_msg " Wuff ---- Wuff!! "
|
||||
|
||||
# define a bigger scrollback, default is 100 lines
|
||||
defscrollback 1024
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# SCREEN KEYBINDINGS
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Remove some stupid / dangerous key bindings
|
||||
bind ^k
|
||||
#bind L
|
||||
bind ^\
|
||||
# Make them better
|
||||
bind \\ quit
|
||||
bind K kill
|
||||
bind I login on
|
||||
bind O login off
|
||||
bind } history
|
||||
|
||||
# An example of a "screen scraper" which will launch urlview on the current
|
||||
# screen window
|
||||
#
|
||||
#bind ^B eval "hardcopy_append off" "hardcopy -h $HOME/.screen-urlview" "screen urlview $HOME/.screen-urlview"
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# TERMINAL SETTINGS
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# The vt100 description does not mention "dl". *sigh*
|
||||
termcapinfo vt100 dl=5\E[M
|
||||
|
||||
# turn sending of screen messages to hardstatus off
|
||||
hardstatus off
|
||||
# Set the hardstatus prop on gui terms to set the titlebar/icon title
|
||||
termcapinfo xterm*|rxvt*|kterm*|Eterm* hs:ts=\E]0;:fs=\007:ds=\E]0;\007
|
||||
# use this for the hard status string
|
||||
hardstatus string "%h%? users: %u%?"
|
||||
|
||||
# An alternative hardstatus to display a bar at the bottom listing the
|
||||
# windownames and highlighting the current windowname in blue. (This is only
|
||||
# enabled if there is no hardstatus setting for your terminal)
|
||||
#
|
||||
#hardstatus lastline "%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<"
|
||||
|
||||
# set these terminals up to be 'optimal' instead of vt100
|
||||
termcapinfo xterm*|linux*|rxvt*|Eterm* OP
|
||||
|
||||
# Change the xterm initialization string from is2=\E[!p\E[?3;4l\E[4l\E>
|
||||
# (This fixes the "Aborted because of window size change" konsole symptoms found
|
||||
# in bug #134198)
|
||||
termcapinfo xterm 'is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;4;6l'
|
||||
|
||||
# To get screen to add lines to xterm's scrollback buffer, uncomment the
|
||||
# following termcapinfo line which tells xterm to use the normal screen buffer
|
||||
# (which has scrollback), not the alternate screen buffer.
|
||||
#
|
||||
#termcapinfo xterm|xterms|xs|rxvt ti@:te@
|
||||
|
||||
# Enable non-blocking mode to better cope with flaky ssh connections.
|
||||
defnonblock 5
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# STARTUP SCREENS
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
# Example of automatically running some programs in windows on screen startup.
|
||||
#
|
||||
# The following will open top in the first window, an ssh session to monkey
|
||||
# in the next window, and then open mutt and tail in windows 8 and 9
|
||||
# respectively.
|
||||
#
|
||||
# screen htop
|
||||
# screen -t monkey ssh monkey
|
||||
# screen -t mail 8 mutt
|
||||
# screen -t daemon 9 tail -f /var/log/daemon.log
|
||||
|
67
networking/ssh/reverse-ssh
Normal file
67
networking/ssh/reverse-ssh
Normal file
@@ -0,0 +1,67 @@
|
||||
#From Laptop
|
||||
|
||||
> ssh -f -N -T -R[highport]:localhost:22 [server username]@[server public ip]
|
||||
|
||||
#From Server
|
||||
|
||||
> sudo ssh -p [highport] -D localhost:22 [laptop username]@localhost
|
||||
|
||||
## Example
|
||||
|
||||
From laptop, type:
|
||||
|
||||
> ssh -f -N -T -R9022:localhost:22 pi@89.216.113.126
|
||||
|
||||
Then from server, type:
|
||||
|
||||
> ssh -p 2210 [laptop username]@localhost
|
||||
|
||||
#Explanations
|
||||
|
||||
The -f switch feels out for connections in the background.
|
||||
|
||||
The -N switch is 'No commands', as you don't actually need to tunnel to anywhere.
|
||||
|
||||
The -T disables pseudo-tty allocation (???).
|
||||
|
||||
#Longterm
|
||||
|
||||
To set this up for permanent access, add this to the ~/.ssh/config:
|
||||
|
||||
> host remotehostname
|
||||
> User remoteusername
|
||||
> Hostname localhost
|
||||
> Port 22222
|
||||
|
||||
'Remotehostname' can be anything, but 'remoteusername' must match.
|
||||
|
||||
For example
|
||||
|
||||
```
|
||||
|
||||
host hostelche
|
||||
User hostelche
|
||||
Hostname localhost
|
||||
Port 9071
|
||||
|
||||
```
|
||||
|
||||
# Automatic startup
|
||||
|
||||
set file in /etc/network/if-up.d/phone-home
|
||||
|
||||
> chmod 755 /etc/network/if-up.d/phone-home
|
||||
|
||||
set file /etc/rc.local
|
||||
|
||||
> chmod 755 rc.local
|
||||
|
||||
Both files contain:
|
||||
|
||||
```
|
||||
#!/bin/bash
|
||||
sleep 60
|
||||
ssh -f -N -T -R2049:localhost:22 pi@89.216.113.126
|
||||
|
||||
```
|
||||
|
4
networking/ssh/sshfs
Normal file
4
networking/ssh/sshfs
Normal file
@@ -0,0 +1,4 @@
|
||||
Auto-mounting an sshfs directory can be done with an /etc/fstab entry:
|
||||
|
||||
`sshfs#pi@belgradecats.tk:/home/pi/cats /home/ghost/cuties fuse defaults,allow_other,reconnect,delay_connect 0 0`
|
||||
|
13
networking/ssh/sshfs.md
Normal file
13
networking/ssh/sshfs.md
Normal file
@@ -0,0 +1,13 @@
|
||||
# Mount
|
||||
|
||||
> sshfs alfred@192.168.0.14:Sync/Alfred
|
||||
|
||||
Various flags:
|
||||
|
||||
- Encryption: -C
|
||||
- Map between local and remote user UIDs: -o idmap-user
|
||||
|
||||
# Unmount
|
||||
|
||||
> fusermount3 -u Sync/Alfred
|
||||
|
17
networking/ssh/tricks.md
Normal file
17
networking/ssh/tricks.md
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
Mount a remote filesystem locally with fuse-sshfs:
|
||||
|
||||
> sshfs ghost@192.168.0.10:/home/ghost /tmp/mnt
|
||||
|
||||
Unmount with:
|
||||
|
||||
> fusermount -u /tmp/mnt
|
||||
|
||||
Set it up on /etc/fstab with:
|
||||
|
||||
> sshfs#bkp@bkp.a-server.ninja:/media/store1/bkp /backup fuse defaults,allow_other,reconnect,delay_connect 0 0
|
||||
|
||||
Make image backup of sda1 and sda2 from one machine and pass it through ssh to another.
|
||||
|
||||
> for i in {1,2};do sudo dd if=/dev/sda$i | ssh -C ghost@192.168.0.10 "dd of=/mnt/Biggie/Backup/winback-oct-\"$i\".img" status=progress; done
|
||||
|
22
networking/tor
Normal file
22
networking/tor
Normal file
@@ -0,0 +1,22 @@
|
||||
# I've added lines to /etc/network/interfaces. They might need to all be remove (1st line is original).
|
||||
|
||||
#I've added lines to /etc/tor/torrc. The documentation on torproject.org states this should be in /usr/local/etc/tor/torrc, but I don't have that file.
|
||||
|
||||
# Tor must be enabled with
|
||||
|
||||
sysrc tor_enable=YES
|
||||
service tor start
|
||||
|
||||
# And it's recommended to use "random id" by adding
|
||||
echo "net.inet.ip.random_id=1" >> /etc/sysctl.conf
|
||||
sysctl net.inet.ip.random_id=1
|
||||
|
||||
# Opening firewall ports 9030 and 9001
|
||||
# They seem to be already open
|
||||
|
||||
# Checking CPU usage. It's around 0.30 average.
|
||||
# Checking logs
|
||||
sudo less /var/log/tor/log
|
||||
# Seems like it's working.
|
||||
|
||||
|
7
networking/tor.md
Normal file
7
networking/tor.md
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
# Get a hostname
|
||||
|
||||
> sudo vim /etc/tor/torrc
|
||||
|
||||
Uncomment the lines about `/var/lib/tor/hidden_services`, including port 22 (or whatever); restart tor, then go to that directory, and cat the hostname.
|
||||
|
68
networking/transmission
Normal file
68
networking/transmission
Normal file
@@ -0,0 +1,68 @@
|
||||
# Basic instructions
|
||||
|
||||
Search for a torrent on The Pirate Bay.
|
||||
|
||||
> torrench -t 'my film'
|
||||
|
||||
Follow instructions to yank the magnet link into the clipboard. Now you have a magnet link copied.
|
||||
|
||||
> transmission-remote -a 'magnet:blahblahblah'
|
||||
|
||||
Type that in, then add -a and paste in your magnet link (all in quotes).
|
||||
|
||||
Now let's check that the torrent's been added successfully.
|
||||
|
||||
> transmission-remote -l
|
||||
|
||||
|
||||
|
||||
# Setting up
|
||||
|
||||
> transmission-daemon --download-dir ~/Torrents
|
||||
|
||||
This sets up where the torrents will land.
|
||||
|
||||
# Stop transmission
|
||||
> transmission-remote --exit
|
||||
|
||||
|
||||
# Start torrents
|
||||
> transmission-daemon
|
||||
|
||||
# List current torrents
|
||||
> transmission-remote -l
|
||||
|
||||
# Add a torrent file to go to the Music folder
|
||||
> transmission-remote -a file1.transmission file2.transmission -w Music
|
||||
|
||||
> transmission-remote -a 'magnet link'
|
||||
|
||||
# Select all active/ all torrents
|
||||
> transmission-remote -t active
|
||||
> transmission-remote -t all
|
||||
|
||||
## Get information on selected torrents
|
||||
> transmission-remote -i
|
||||
|
||||
# Delete torrents after adding (or not)
|
||||
> transmission-remote --trash-torrent
|
||||
> transmission-remote --no-trash-torrent
|
||||
|
||||
# Directory for Downloads
|
||||
|
||||
> /var/lib/transmission-daemon/downloads
|
||||
|
||||
# Torrench Searching
|
||||
|
||||
> torrench -d kali
|
||||
|
||||
Search on distrowatch for kali.
|
||||
|
||||
> torrench -k "akira"
|
||||
|
||||
Search on KickAss torrents for Akira.
|
||||
|
||||
> torrench -t "Chronicle"
|
||||
|
||||
Search on The Pirate Bay for Chronicle.
|
||||
|
15
networking/troubleshooting-map
Normal file
15
networking/troubleshooting-map
Normal file
@@ -0,0 +1,15 @@
|
||||
[ no network ] --> [ Is there an IP address? ]
|
||||
|
||||
[ Is there an IP address? ] -- no --> [ Check NIC driver, dmesg ]
|
||||
|
||||
[ Is there an IP address? ] -- yes --> [ Can you ping the router? ]
|
||||
|
||||
[ Can you ping the router? ] -- no --> [ Check cables, router, and switches ]
|
||||
|
||||
[ Can you ping the router? ] -- yes --> [ Can you ping a DNS address? ]
|
||||
|
||||
[ Can you ping a DNS address? ] -- no --> [ Trying pinging 8.8.8.8 ]
|
||||
|
||||
[ Can you ping a DNS address? ] -- yes --> [ Traceroute ]
|
||||
|
||||
|
16
networking/troubleshooting.md
Normal file
16
networking/troubleshooting.md
Normal file
@@ -0,0 +1,16 @@
|
||||
|
||||
# Do you have an IP?
|
||||
|
||||
If not, try checking out what your local networking interfaces are, then check if they have been picked up:
|
||||
|
||||
> dmesg | grep eth0
|
||||
|
||||
# Display Active Ports
|
||||
|
||||
> netstat -l
|
||||
|
||||
... or maybe narrow it down to http:
|
||||
|
||||
> netstat -l | grep http
|
||||
|
||||
|
9
networking/troubleshooting.txt
Normal file
9
networking/troubleshooting.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
┌────────────┐ ┌─────────────────────────┐ yes ┌────────────────────────────────────┐ yes ┌─────────────────────────────┐ yes ┌────────────┐
|
||||
│ no network │ ──> │ Is there an IP address? │ ─────> │ Can you ping the router? │ ─────> │ Can you ping a DNS address? │ ─────> │ Traceroute │
|
||||
└────────────┘ └─────────────────────────┘ └────────────────────────────────────┘ └─────────────────────────────┘ └────────────┘
|
||||
│ │ │
|
||||
│ no │ no │ no
|
||||
∨ ∨ ∨
|
||||
┌─────────────────────────┐ ┌────────────────────────────────────┐ ┌─────────────────────────────┐
|
||||
│ Check NIC driver, dmesg │ │ Check cables, router, and switches │ │ Trying pinging 8.8.8.8 │
|
||||
└─────────────────────────┘ └────────────────────────────────────┘ └─────────────────────────────┘
|
63
networking/unison.md
Normal file
63
networking/unison.md
Normal file
@@ -0,0 +1,63 @@
|
||||
|
||||
# Local Sync
|
||||
|
||||
unison Dir_A Dir_B
|
||||
|
||||
Accept defaults with:
|
||||
|
||||
> unison -auto Dir_A Dir_B
|
||||
|
||||
Ask no questions with:
|
||||
|
||||
> unison -batch Dir_A Dir_B
|
||||
|
||||
# Remote Sync
|
||||
|
||||
Sync the folders ~/LK on pi and localhost with:
|
||||
|
||||
> unison LK ssh://pi@192.168.0.13/LK
|
||||
|
||||
|
||||
#Back Script Example
|
||||
Make backup script 'rat' by entering the configurations in ~/.unison/rat.prf
|
||||
|
||||
```{r}
|
||||
# Where to synchronize from
|
||||
root=/home/roach-1/
|
||||
|
||||
root=ssh://ubuntu@10.0.3.76/
|
||||
|
||||
auto = true
|
||||
batch = true
|
||||
## for ssh arguments, add as so:
|
||||
#sshargs=-p 4792
|
||||
|
||||
## Directories to synchronize
|
||||
## a path such as 'Album 1' will not work - don't use quotes.
|
||||
path=box 1
|
||||
path=box 2
|
||||
path=house
|
||||
path=.vimrc
|
||||
path=.bashrc
|
||||
|
||||
ignore=Name temp.*
|
||||
ignore=Name *.swp
|
||||
|
||||
## Merging
|
||||
## This line handles the merge, but it's based on Emacs, which cannot run in a tty, but requires X.
|
||||
|
||||
diff = diff -u CURRENT2 CURRENT1 | perl -pe 's/^\+/>/; s/^\-/</'
|
||||
```
|
||||
|
||||
# Scheduled Backups
|
||||
|
||||
A full backup can be run with:
|
||||
|
||||
> unison rat.prf
|
||||
|
||||
And a crontab can be set with:
|
||||
|
||||
* */4 * * * /usr/bin/unison rat
|
||||
|
||||
|
||||
|
67
networking/wireless.md
Normal file
67
networking/wireless.md
Normal file
@@ -0,0 +1,67 @@
|
||||
|
||||
# Check wifi's working
|
||||
> lspci -k
|
||||
|
||||
Or for usb wifi:
|
||||
|
||||
> dmesg | grep usbcore
|
||||
|
||||
... and hopefully it'll say the new interface is registered.
|
||||
|
||||
# Check if a wifi interface has been created
|
||||
|
||||
> ip link
|
||||
|
||||
or
|
||||
|
||||
> iw dev
|
||||
|
||||
Assuming it's wlan0, bring it up with
|
||||
|
||||
> ip link set wlan0 up
|
||||
|
||||
Error messages probably means your wireless chipset requires a firmware to function. In this case, check the kernel messages for firmware being loaded
|
||||
|
||||
> dmesg | grep firmware
|
||||
|
||||
# Utilities
|
||||
|
||||
iw doesn't do wpa/wpa2. wpa_supplicant does everything. iwd does everything except WEXT encryption.
|
||||
|
||||
# Connecting
|
||||
|
||||
Get the link status:
|
||||
|
||||
> iw dev wlan0 link
|
||||
|
||||
Scan for available points:
|
||||
|
||||
> iw dev wlan0 scan
|
||||
|
||||
The connecting commands do not cover wpa2.
|
||||
|
||||
# Fucking Hell
|
||||
|
||||
I really need to script this. Something like:
|
||||
|
||||
1. Auto-check wireless device.
|
||||
|
||||
2. Auto-check scan for devices and grab names
|
||||
|
||||
3. Display names
|
||||
|
||||
4. Prompt for name selection (e.g. '1').
|
||||
|
||||
5. Auto-connect to wireless associated with selection n.
|
||||
|
||||
6. Prompt for password.
|
||||
|
||||
7. Try to connect.
|
||||
|
||||
8. Ask if user wants a password copy stored in /tmp/.
|
||||
|
||||
|
||||
# Connection
|
||||
This is a shitshow. Focus: netctl is the Arch project to get this going.
|
||||
|
||||
Okay - can't be fucked. Most of this is systemd based.
|
59
networking/wpa_supplicant
Normal file
59
networking/wpa_supplicant
Normal file
@@ -0,0 +1,59 @@
|
||||
# Intro
|
||||
|
||||
wpa_supplicant configurations are stored in /etc/wpa_supplicant/wpa_supplicant-wlan0 (or equivalent).
|
||||
|
||||
A default is presented.
|
||||
|
||||
# Generating Keys Manually
|
||||
|
||||
> wpa_passphrase [ssid] [password]
|
||||
|
||||
For example:
|
||||
|
||||
> wpa_passphrase 'Cafe Kosachok' 'Kosachok2019'
|
||||
|
||||
This then spills the relevant psk and such to be entered into the wpa_supplicant configuration file.
|
||||
|
||||
If you encounter problems, you will probably need to delete the old device pid in (e.g.) /run/wlan0/
|
||||
|
||||
Next up, start wpa_supplicant:
|
||||
|
||||
> wpa_supplicant -B -iwlan0 -c /etc/wpa_supplicant/wpa_supplicant-wlan0
|
||||
|
||||
The -B flag runs this as a background process. Remove this to see real-time output in order to solve problems. The -i flag denotes the physical device used for the wifi. The -c flag points to the configuration file for use.
|
||||
|
||||
# Automatic WiFi Connection
|
||||
|
||||
> wpa_cli
|
||||
|
||||
This has a number of commands to input. In order:
|
||||
|
||||
> scan
|
||||
|
||||
> scan_results
|
||||
|
||||
> add_network
|
||||
|
||||
This outputs a network number, e.g. '3'. This is the new network you'll work with.
|
||||
|
||||
> set_network 3 ssid "Kosachok Cafe"
|
||||
|
||||
> set_network 3 psk "Kosachok2019"
|
||||
|
||||
OR
|
||||
|
||||
> set_network 3 key_mgmt NONE
|
||||
|
||||
> enable_network 3
|
||||
|
||||
> save_config
|
||||
|
||||
... and possibly:
|
||||
|
||||
> sudo sv restart dhcpcd
|
||||
|
||||
or maybe:
|
||||
|
||||
> dhcpd wlp3s0
|
||||
|
||||
|
Reference in New Issue
Block a user