Useful Software und SSH-Hardening: Unterschied zwischen den Seiten

Aus Wiki
(Unterschied zwischen Seiten)
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
 
Keine Bearbeitungszusammenfassung
 
Zeile 1: Zeile 1:
[[Kategorie:Lexikon]]
Based on https://stribika.github.io/2015/01/04/secure-secure-shell.html (with a stripped down list of Ciphers and MACs)


A collection of software products that can come in quite handy at the TU Vienna.
=== Server configuration ===


== Essentials ==
Remove all <code>HostKey</code> directives in <code>/etc/ssh/sshd_config</code>, then append at the bottom:


* [https://vowi.fsinf.at/ VoWi] &mdash; public wiki containing information, experiences and resources about courses
<pre>
* [https://toss.fsinf.at/ TOSS] &mdash; search engine for courses, lecturers, rooms and curricula
# SSH hardening, see https://wiki.fsinf.at/wiki/SSH-Hardening
* [[VPN]] to connect to the TU Vienna Intranet


== Quality of Life ==
# Disable SSHv1
Protocol 2


* [https://github.com/fsinf/userscripts TU Wien Userscripts] for auto-login, adding links to [https://mattermost.fsinf.at Mattermost] and [https://vowi.fsinf.at VoWi], etc.
# Only allow Public Key Authentication
PubkeyAuthentication yes
PasswordAuthentication no
ChallengeResponseAuthentication no


* [https://fsinf.github.io/pdf-page-stripper/ PDF Page Stripper] to get rid of duplicated slides in PDF presentations
# Only allow users in the "users" group (no system users!).
# NOTE: See /etc/adduser.conf (EXTRA_GROUPS and ADD_EXTRA_GROUPS) to
# automatically add new non-system users to a group.
AllowGroups users
# Don't forget to remove HostKey directives above
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com
</pre>


== Documents ==
... and execute:


* [https://cryptpad.fr/ CryptPad] &mdash; encrypted collaborative Editor for text, presentations, whiteboards & more
cd /etc/ssh/
rm ssh_host_*
ssh-keygen -t rsa -b 4096 -f ssh_host_rsa_key -N ""
ssh-keygen -t ed25519 -f ssh_host_ed25519_key -N ""


* [https://www.overleaf.com/ Overleaf] &mdash; online LaTeX Editor ([https://www.overleaf.com/edu/tuw '''Free TU Premium''' version])
===== restart server =====


* [https://zettlr.com/ Zettlr] &mdash; offline Markdown Editor with support for LaTeX Equations
When restarting, current session is not affected, make sure you keep it open, in case you've done something wrong:


* [https://www.zotero.org/ Zotero] + browser extension + [http://zotfile.com/ ZotFile] to extract PDF annotations
systemctl restart sshd
:Tip: Set the Default Format to BibLaTeX under ''Edit > Preferences > Export''.


== Maths ==
=== Client configuration ===


* [https://www.wolframalpha.com/ Wolfram Alpha] &mdash; online calculator and knowledge base
On top of your <code>~/.ssh/config</code>, add:
* [https://www.symbolab.com/ Symbolab] &mdash; online calculator with step-by-step solutions
* [https://tuwien2020.github.io/tgi-pages/#/ TGI Tools] &mdash; online tools for the TGI lecture.


== Programming ==
Host *
* [https://www.jetbrains.com/ Jetbrains IDEs] &mdash; IDEs for the most popular programming languages. [https://www.jetbrains.com/community/education/#students Free for students]
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
* [https://code.visualstudio.com/ Visual Studio Code] &mdash; IDE with extensions for most programming language. [https://code.visualstudio.com/ Free for everyone]
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
== Mail ==
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160
* [https://www.thunderbird.net/ Thunderbird] &mdash; Open source desktop mail client that works.
 
Note that we add diffie-hellman-group-exchange-sha256 in comparison to the server config - this is for comparability with Ubuntu 12.04 (remove it if you don't care).
 
If possible, you can also regenerate your own SSH keys:
 
ssh-keygen -t ed25519 -o -a 100
ssh-keygen -t rsa -b 4096 -o -a 100
 
'''WARNING:''' This overwrites your old keys if you're not careful. If you don't add a new key to your servers before removing the old ones, you're locked out.
 
=== Sources ===
* https://cipherli.st/
* '''old, from 2015:''' https://stribika.github.io/2015/01/04/secure-secure-shell.html
 
[[Kategorie:FOSS]]
[[Kategorie:Linux]]

Aktuelle Version vom 7. Februar 2023, 19:47 Uhr

Based on https://stribika.github.io/2015/01/04/secure-secure-shell.html (with a stripped down list of Ciphers and MACs)

Server configuration[Bearbeiten | Quelltext bearbeiten]

Remove all HostKey directives in /etc/ssh/sshd_config, then append at the bottom:

# SSH hardening, see https://wiki.fsinf.at/wiki/SSH-Hardening

# Disable SSHv1
Protocol 2

# Only allow Public Key Authentication
PubkeyAuthentication yes
PasswordAuthentication no
ChallengeResponseAuthentication no

# Only allow users in the "users" group (no system users!).
# NOTE: See /etc/adduser.conf (EXTRA_GROUPS and ADD_EXTRA_GROUPS) to 
# automatically add new non-system users to a group.
AllowGroups users
 
# Don't forget to remove HostKey directives above
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,umac-128@openssh.com

... and execute:

cd /etc/ssh/
rm ssh_host_*
ssh-keygen -t rsa -b 4096 -f ssh_host_rsa_key -N ""
ssh-keygen -t ed25519 -f ssh_host_ed25519_key -N ""
restart server[Bearbeiten | Quelltext bearbeiten]

When restarting, current session is not affected, make sure you keep it open, in case you've done something wrong:

systemctl restart sshd

Client configuration[Bearbeiten | Quelltext bearbeiten]

On top of your ~/.ssh/config, add:

Host *
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes256-ctr
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160

Note that we add diffie-hellman-group-exchange-sha256 in comparison to the server config - this is for comparability with Ubuntu 12.04 (remove it if you don't care).

If possible, you can also regenerate your own SSH keys:

ssh-keygen -t ed25519 -o -a 100
ssh-keygen -t rsa -b 4096 -o -a 100

WARNING: This overwrites your old keys if you're not careful. If you don't add a new key to your servers before removing the old ones, you're locked out.

Sources[Bearbeiten | Quelltext bearbeiten]