General Enhancements (#50)
* Hide email clients. * Always install CRON. * Add variable for the static IP to Hyperling.com. * Change IPs. * Beginnings of a script to do IPv6 SCP. * Add ability to specify which port SSH runs on. * Require the destination.
This commit is contained in:
parent
a561bdecc1
commit
04a980a7a3
88
files/scripts/ssh6.sh
Normal file
88
files/scripts/ssh6.sh
Normal file
@ -0,0 +1,88 @@
|
||||
#!/bin/bash
|
||||
# 2024-01-28 Hyperling
|
||||
# Make it a little easier to handle IPv6 addresses with SSH and SCP.
|
||||
|
||||
## Variables ##
|
||||
|
||||
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
|
||||
PROG="$(basename -- "${BASH_SOURCE[0]}")"
|
||||
echo "Running '$DIR/$PROG'."
|
||||
|
||||
# Defaults
|
||||
user="$LOGNAME"
|
||||
port=22
|
||||
output=""
|
||||
receive="N"
|
||||
|
||||
## Functions ##
|
||||
|
||||
function usage {
|
||||
echo -n "$PROG -d DESTINATION [-p PORT] [-u USER] [-i INPUT] "
|
||||
echo "[-o OUTPUT] [-r] [-h]"
|
||||
cat <<- EOF
|
||||
Script around having to sometimes doing "[IPv6]" syntax.
|
||||
-d : The IP address of the external system to connect to.
|
||||
-u : User to connect as. Defaults to current user.
|
||||
-p : Port which the external system is listening on.
|
||||
-i : File or folder which needs sent. This is done recursively.
|
||||
If this is not provided then only an SSH is done, not SCP.
|
||||
-o : Location on the receiving end where things should land.
|
||||
Defaults to :, meaning the foreign user's home directory.
|
||||
-r : Receive a file to the local machine, rather than send a file out.
|
||||
-h : Print this usage text.
|
||||
EOF
|
||||
exit $1
|
||||
}
|
||||
|
||||
## Parameters ##
|
||||
|
||||
while getopts ":d:u:i:o:rh" opt; do
|
||||
case "$opt" in
|
||||
d) destination="$OPTARG" ;;
|
||||
u) user="$OPTARG" ;;
|
||||
p) port="$OPTARG" ;;
|
||||
i) input="$OPTARG" ;;
|
||||
o) output="$OPTARG" ;;
|
||||
r) receive="Y" ;;
|
||||
h) usage 0 ;;
|
||||
*) echo "ERROR: $OPTARG not recognized." >&2
|
||||
usage 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
## Validations ##
|
||||
|
||||
if [[ -z $destination ]]; then
|
||||
echo "ERROR: Destination was not provided. $destination" >&2
|
||||
usage 2
|
||||
fi
|
||||
|
||||
if [[ -z $input && -n $output ]]; then
|
||||
echo "ERROR: Output '$output' was provided but not input. $input" >&2
|
||||
usage 3
|
||||
fi
|
||||
|
||||
## Main ##
|
||||
|
||||
date
|
||||
if [[ -n $input ]]; then
|
||||
if [[ $receive == "N" ]]; then
|
||||
echo -n "Sending '$input' from localhost to '$user@$destination' "
|
||||
echo " at '$output' using port '$port'."
|
||||
scp -r -p$port "$user@[$destination]":"$input" "$output"
|
||||
elif [[ $receive == "Y" ]]; then
|
||||
echo -n "Receiving '$input' from '$user@$destination' "
|
||||
echo " to '$output' on localhost using port '$port'."
|
||||
scp -r -p$port "$input" "$user@[$destination]":"$output"
|
||||
else
|
||||
echo "ERROR: Receive variable is screwed up. $receive" >&2
|
||||
fi
|
||||
else
|
||||
echo "No input file provided, connecting to destination."
|
||||
ssh -t $user@$destination
|
||||
fi
|
||||
date
|
||||
|
||||
## Finish ##
|
||||
|
||||
exit 0
|
@ -70,6 +70,10 @@
|
||||
; Example: /usr/local/swap
|
||||
; Default: /swapfile
|
||||
;
|
||||
; sshd_port : Determine the port which SSHD should listen on.
|
||||
; Example: 12345
|
||||
; Default: 22
|
||||
;
|
||||
[global]
|
||||
marker: '; {mark} MANAGED BY ANSIBLE | Generic Config'
|
||||
state: present
|
||||
@ -88,6 +92,7 @@
|
||||
swap_block: "{{ lookup('ini', 'swap_block file={{gen_file}} default=false') }}"
|
||||
swap_count: "{{ lookup('ini', 'swap_count file={{gen_file}} default=1') }}"
|
||||
swap_file: "{{ lookup('ini', 'swap_file file={{gen_file}} default=/swapfile') }}"
|
||||
sshd_port: "{{ lookup('ini', 'sshd_port file={{gen_file}} default=22') }}"
|
||||
|
||||
- name: General | Account Management | Provisioning Configuration | General | List
|
||||
set_fact:
|
||||
@ -103,6 +108,7 @@
|
||||
- { 'swap_block': "{{ swap_block }}" }
|
||||
- { 'swap_count': "{{ swap_count }}" }
|
||||
- { 'swap_file': "{{ swap_file }}" }
|
||||
- { 'sshd_port': "{{ sshd_port }}" }
|
||||
|
||||
|
||||
## Workstation ##
|
||||
|
@ -451,6 +451,10 @@
|
||||
}
|
||||
alias_clone: |
|
||||
alias clone="rsync -auPh --delete"
|
||||
export_hyperling:
|
||||
export HYPERLING6="2a07:e03:3:80::1"
|
||||
export HYPERLING4="185.130.47.173"
|
||||
export HYPERLING="$HYPERLING4"
|
||||
|
||||
- name: General | Account Management | Users | Files | Common Variable
|
||||
set_fact:
|
||||
@ -489,6 +493,7 @@
|
||||
{{ function_clean_filenames }}
|
||||
{{ function_clean_filenames_tree }}
|
||||
{{ alias_clone }}
|
||||
{{ export_hyperling }}
|
||||
|
||||
- name: General | Account Management | Users | Files | .bashrc
|
||||
blockinfile:
|
||||
|
@ -53,6 +53,7 @@
|
||||
- at
|
||||
- gcc
|
||||
- vim
|
||||
- "{{ cron }}"
|
||||
state: present
|
||||
|
||||
- name: General | Software | Packages | Install Software (DEV)
|
||||
@ -75,12 +76,6 @@
|
||||
when: ansible_distribution == "Ubuntu"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: General | Software | Services | Install CROND (Looking at you, Fedora+Mobian+openSUSE)
|
||||
package:
|
||||
name: "{{ cron }}"
|
||||
state: present
|
||||
when: ansible_pkg_mgr in ("dnf", "zypper") or ansible_distribution == "Mobian"
|
||||
|
||||
- name: General | Software | Services | Install killall (Looking at you, Debian)
|
||||
package:
|
||||
name: psmisc
|
||||
|
@ -50,7 +50,7 @@
|
||||
- { "key": '^[\#]?LogLevel', "value": 'LogLevel verbose'}
|
||||
- { "key": '^[\#]?MaxAuthTries', "value": 'MaxAuthTries 3'}
|
||||
- { "key": '^[\#]?MaxSessions', "value": 'MaxSessions 2'}
|
||||
#- { "key": '^[\#]?Port', "value": 'Port '}
|
||||
- { "key": '^[\#]?Port', "value": 'Port {{ sshd_port }}'}
|
||||
- { "key": '^[\#]?TCPKeepAlive', "value": 'TCPKeepAlive no'}
|
||||
- { "key": '^[\#]?X11Forwarding', "value": 'X11Forwarding no'}
|
||||
- { "key": '^[\#]?AllowAgentForwarding', "value": 'AllowAgentForwarding no'}
|
||||
|
@ -12,10 +12,6 @@
|
||||
, 'org.gnome.Nautilus.desktop'
|
||||
, 'io.gitlab.librewolf-community.desktop', 'librewolf.desktop'
|
||||
, 'org.mozilla.firefox.desktop', 'firefox.desktop'
|
||||
, 'org.gnome.Evolution.desktop'
|
||||
, 'chat.delta.desktop.desktop', 'deltachat.desktop'
|
||||
, 'org.gnome.Geary.desktop'
|
||||
, 'org.mozilla.Thunderbird.desktop'
|
||||
, 'com.visualstudio.code-oss.desktop', 'code-oss.desktop'
|
||||
, 'org.godotengine.Godot.desktop'
|
||||
, 'org.shotcut.Shotcut.desktop'
|
||||
@ -29,6 +25,11 @@
|
||||
dconf_terminal: gnome-terminal
|
||||
dconf_theme: Adwaita-dark
|
||||
dconf_icons: Adwaita
|
||||
# 2024-01-28 No longer using local email clients.
|
||||
#, 'org.gnome.Evolution.desktop'
|
||||
#, 'chat.delta.desktop.desktop', 'deltachat.desktop'
|
||||
#, 'org.gnome.Geary.desktop'
|
||||
#, 'org.mozilla.Thunderbird.desktop'
|
||||
|
||||
- name: Workstation | Account Management | GNOME | Facts (NixOS)
|
||||
set_fact:
|
||||
|
Loading…
x
Reference in New Issue
Block a user