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:
Hyperling 2024-01-30 05:25:50 -07:00 committed by GitHub
parent a561bdecc1
commit 04a980a7a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 116 additions and 21 deletions

88
files/scripts/ssh6.sh Normal file
View 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

View File

@ -70,6 +70,10 @@
; Example: /usr/local/swap ; Example: /usr/local/swap
; Default: /swapfile ; Default: /swapfile
; ;
; sshd_port : Determine the port which SSHD should listen on.
; Example: 12345
; Default: 22
;
[global] [global]
marker: '; {mark} MANAGED BY ANSIBLE | Generic Config' marker: '; {mark} MANAGED BY ANSIBLE | Generic Config'
state: present state: present
@ -88,6 +92,7 @@
swap_block: "{{ lookup('ini', 'swap_block file={{gen_file}} default=false') }}" swap_block: "{{ lookup('ini', 'swap_block file={{gen_file}} default=false') }}"
swap_count: "{{ lookup('ini', 'swap_count file={{gen_file}} default=1') }}" swap_count: "{{ lookup('ini', 'swap_count file={{gen_file}} default=1') }}"
swap_file: "{{ lookup('ini', 'swap_file file={{gen_file}} default=/swapfile') }}" 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 - name: General | Account Management | Provisioning Configuration | General | List
set_fact: set_fact:
@ -103,6 +108,7 @@
- { 'swap_block': "{{ swap_block }}" } - { 'swap_block': "{{ swap_block }}" }
- { 'swap_count': "{{ swap_count }}" } - { 'swap_count': "{{ swap_count }}" }
- { 'swap_file': "{{ swap_file }}" } - { 'swap_file': "{{ swap_file }}" }
- { 'sshd_port': "{{ sshd_port }}" }
## Workstation ## ## Workstation ##

View File

@ -451,6 +451,10 @@
} }
alias_clone: | alias_clone: |
alias clone="rsync -auPh --delete" 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 - name: General | Account Management | Users | Files | Common Variable
set_fact: set_fact:
@ -489,6 +493,7 @@
{{ function_clean_filenames }} {{ function_clean_filenames }}
{{ function_clean_filenames_tree }} {{ function_clean_filenames_tree }}
{{ alias_clone }} {{ alias_clone }}
{{ export_hyperling }}
- name: General | Account Management | Users | Files | .bashrc - name: General | Account Management | Users | Files | .bashrc
blockinfile: blockinfile:

View File

@ -19,7 +19,7 @@
shell: exit 1 shell: exit 1
when: ansible_distribution == "Parrot OS" and parrotos_zypper_removed is defined and not parrotos_zypper_removed.failed when: ansible_distribution == "Parrot OS" and parrotos_zypper_removed is defined and not parrotos_zypper_removed.failed
# More Parrot OS junk. They have a command called update in /usr/bin. Doesn't # More Parrot OS junk. They have a command called update in /usr/bin. Doesn't
# have sudo or anything in it. Hide it in preference for .bashrc update function. # have sudo or anything in it. Hide it in preference for .bashrc update function.
- name: General | Software | Packages | Fix Parrot OS 2 (update) - name: General | Software | Packages | Fix Parrot OS 2 (update)
shell: "mv `which update` `which update`.zz.`date +%Y%m%d`" shell: "mv `which update` `which update`.zz.`date +%Y%m%d`"
@ -38,7 +38,7 @@
when: ansible_system == "FreeBSD" when: ansible_system == "FreeBSD"
- name: General | Software | Packages | Install Software - name: General | Software | Packages | Install Software
package: package:
name: name:
- bash - bash
- sudo - sudo
@ -53,10 +53,11 @@
- at - at
- gcc - gcc
- vim - vim
- "{{ cron }}"
state: present state: present
- name: General | Software | Packages | Install Software (DEV) - name: General | Software | Packages | Install Software (DEV)
package: package:
name: name:
- "{{ microcode_amd }}" - "{{ microcode_amd }}"
- "{{ microcode_intel }}" - "{{ microcode_intel }}"
@ -75,12 +76,6 @@
when: ansible_distribution == "Ubuntu" when: ansible_distribution == "Ubuntu"
ignore_errors: yes 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) - name: General | Software | Services | Install killall (Looking at you, Debian)
package: package:
name: psmisc name: psmisc
@ -89,7 +84,7 @@
- name: General | Software | Services | Install "Bloat" (Looking at you, Arch Base) - name: General | Software | Services | Install "Bloat" (Looking at you, Arch Base)
package: package:
name: name:
- which - which
- "{{ cron }}" - "{{ cron }}"
state: present state: present
@ -97,9 +92,9 @@
- name: General | Software | Services | Install Fix (Looking at you, openSUSE) - name: General | Software | Services | Install Fix (Looking at you, openSUSE)
package: package:
name: name:
# openSUSE Tumbleweed comes without gnome-control-center being able to open # openSUSE Tumbleweed comes without gnome-control-center being able to open
# properly. Hopefully just a one-time accident but I wanted bleeding edge so I # properly. Hopefully just a one-time accident but I wanted bleeding edge so I
# guess I got it! Luckily was easy to figure out based on CLI error on launch. # guess I got it! Luckily was easy to figure out based on CLI error on launch.
- libvulkan1 - libvulkan1
# Provides c99 used to compile ST for DWM. # Provides c99 used to compile ST for DWM.
@ -108,7 +103,7 @@
when: ansible_pkg_mgr in ("zypper") when: ansible_pkg_mgr in ("zypper")
- name: General | Software | Packages | Update Software (Disabled) - name: General | Software | Packages | Update Software (Disabled)
package: package:
name: name:
- ansible - ansible
- git - git
@ -116,7 +111,7 @@
when: 1 == 0 when: 1 == 0
- name: General | Software | Packages | Remove Software - name: General | Software | Packages | Remove Software
package: package:
name: name:
- cowsay # Sorry ;) - cowsay # Sorry ;)
- chromium - chromium
@ -134,7 +129,7 @@
ignore_errors: yes ignore_errors: yes
- name: General | Software | Packages | Remove Snap (Besides Ubuntu) - name: General | Software | Packages | Remove Snap (Besides Ubuntu)
package: package:
name: name:
- snapd - snapd
state: absent state: absent

View File

@ -50,7 +50,7 @@
- { "key": '^[\#]?LogLevel', "value": 'LogLevel verbose'} - { "key": '^[\#]?LogLevel', "value": 'LogLevel verbose'}
- { "key": '^[\#]?MaxAuthTries', "value": 'MaxAuthTries 3'} - { "key": '^[\#]?MaxAuthTries', "value": 'MaxAuthTries 3'}
- { "key": '^[\#]?MaxSessions', "value": 'MaxSessions 2'} - { "key": '^[\#]?MaxSessions', "value": 'MaxSessions 2'}
#- { "key": '^[\#]?Port', "value": 'Port '} - { "key": '^[\#]?Port', "value": 'Port {{ sshd_port }}'}
- { "key": '^[\#]?TCPKeepAlive', "value": 'TCPKeepAlive no'} - { "key": '^[\#]?TCPKeepAlive', "value": 'TCPKeepAlive no'}
- { "key": '^[\#]?X11Forwarding', "value": 'X11Forwarding no'} - { "key": '^[\#]?X11Forwarding', "value": 'X11Forwarding no'}
- { "key": '^[\#]?AllowAgentForwarding', "value": 'AllowAgentForwarding no'} - { "key": '^[\#]?AllowAgentForwarding', "value": 'AllowAgentForwarding no'}

View File

@ -12,10 +12,6 @@
, 'org.gnome.Nautilus.desktop' , 'org.gnome.Nautilus.desktop'
, 'io.gitlab.librewolf-community.desktop', 'librewolf.desktop' , 'io.gitlab.librewolf-community.desktop', 'librewolf.desktop'
, 'org.mozilla.firefox.desktop', 'firefox.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' , 'com.visualstudio.code-oss.desktop', 'code-oss.desktop'
, 'org.godotengine.Godot.desktop' , 'org.godotengine.Godot.desktop'
, 'org.shotcut.Shotcut.desktop' , 'org.shotcut.Shotcut.desktop'
@ -29,6 +25,11 @@
dconf_terminal: gnome-terminal dconf_terminal: gnome-terminal
dconf_theme: Adwaita-dark dconf_theme: Adwaita-dark
dconf_icons: Adwaita 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) - name: Workstation | Account Management | GNOME | Facts (NixOS)
set_fact: set_fact: