diff --git a/files/scripts/ssh6.sh b/files/scripts/ssh6.sh new file mode 100644 index 0000000..aff890f --- /dev/null +++ b/files/scripts/ssh6.sh @@ -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 diff --git a/tasks/general/acct_mgmt/provision_config.yml b/tasks/general/acct_mgmt/provision_config.yml index 6a10a64..6bae1a5 100644 --- a/tasks/general/acct_mgmt/provision_config.yml +++ b/tasks/general/acct_mgmt/provision_config.yml @@ -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 ## diff --git a/tasks/general/acct_mgmt/users.yml b/tasks/general/acct_mgmt/users.yml index bdc0559..973ef9c 100644 --- a/tasks/general/acct_mgmt/users.yml +++ b/tasks/general/acct_mgmt/users.yml @@ -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: diff --git a/tasks/general/software/packages.yml b/tasks/general/software/packages.yml index 84f5d48..915c351 100644 --- a/tasks/general/software/packages.yml +++ b/tasks/general/software/packages.yml @@ -19,7 +19,7 @@ shell: exit 1 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. - name: General | Software | Packages | Fix Parrot OS 2 (update) shell: "mv `which update` `which update`.zz.`date +%Y%m%d`" @@ -38,7 +38,7 @@ when: ansible_system == "FreeBSD" - name: General | Software | Packages | Install Software - package: + package: name: - bash - sudo @@ -53,10 +53,11 @@ - at - gcc - vim + - "{{ cron }}" state: present - name: General | Software | Packages | Install Software (DEV) - package: + package: name: - "{{ microcode_amd }}" - "{{ microcode_intel }}" @@ -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 @@ -89,7 +84,7 @@ - name: General | Software | Services | Install "Bloat" (Looking at you, Arch Base) package: - name: + name: - which - "{{ cron }}" state: present @@ -97,9 +92,9 @@ - name: General | Software | Services | Install Fix (Looking at you, openSUSE) package: - name: - # 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 + name: + # 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 # guess I got it! Luckily was easy to figure out based on CLI error on launch. - libvulkan1 # Provides c99 used to compile ST for DWM. @@ -108,7 +103,7 @@ when: ansible_pkg_mgr in ("zypper") - name: General | Software | Packages | Update Software (Disabled) - package: + package: name: - ansible - git @@ -116,7 +111,7 @@ when: 1 == 0 - name: General | Software | Packages | Remove Software - package: + package: name: - cowsay # Sorry ;) - chromium @@ -134,7 +129,7 @@ ignore_errors: yes - name: General | Software | Packages | Remove Snap (Besides Ubuntu) - package: + package: name: - snapd state: absent diff --git a/tasks/general/software/services.yml b/tasks/general/software/services.yml index 8c4f890..43e3ffc 100644 --- a/tasks/general/software/services.yml +++ b/tasks/general/software/services.yml @@ -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'} diff --git a/tasks/workstation/shared/settings/gnome.yml b/tasks/workstation/shared/settings/gnome.yml index d2b6dcf..b530408 100644 --- a/tasks/workstation/shared/settings/gnome.yml +++ b/tasks/workstation/shared/settings/gnome.yml @@ -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: