Audit policy CLI commands to set the success or failure to enable (Enable – enables logging). Get the current settings of the audit policy.
LibreNMS – Notes On Upgrading from Ubuntu 20.04 to 22.04
These are the steps that need to be done when doing an in-place Ubuntu upgrade on a LibreNMS system using do-release-upgrade. Running daily.sh in /opt/librenms should give you most of the errors you need to fix that we will go through in this guide. Most commands here will assume you are running as root or…
Expand Logical volume in Linux LVM
LVM makes it easy to resize volumes in Linux. This can be done without unmounting drives orrequiring a restart. First determine the free space of the group volume. First determine the partition where your OS is installed. Expand the partition. Here we will assume that the partition is sda3. You can view the volume grow…
Useful Tools
Link Compilation Linux Useful Commands Linux Tool Alternatives
Allow SSH connections only from certain addresses using hosts.deny/hosts.allow
This is the method that can be used to allow SSH connections from certain IP networks. An example use for this is allowing SSH from certain public IP networks, as well as from my Tailscale network. If possible, it is probably better to use iptables/nftables/ufw or the firewall feature of your hosting provider if they…
Rate limit connections in Linux
Use the following iptables command to rate limit connections per IP. This is useful for preventing a DDoS attack on DNS servers. However, for DDoS protection for your DNS servers, you should be hosting DNS with the big cloud providers like Cloudflare, or running dnsdist in front of your authoritive servers.
Enable older SSH key exchange methods
Insert the following in /etc/ssh/ssh_config to apply it system wide or ~/.ssh/config for just your user. It will enable most algorithms that older devices may need. You might get the following error when accessing old SSH servers on Fedora or other RedHat based distributions with weaker keys. To allow these weaker keys, update the crypto…
Yarn Repository Expire Key Error
When using yarn through the apt repo, the key might expire, giving you the following error when updating apt. Issue the following command to update the key and then update the repository.
Django Query Sets
More information can be found at the official Django Making Queries documentation.
Python Code Snippets
List of files, just filenames, no directories. List files, no directories, full path. Indicate that your string variable is a raw string. Locate the path of Python you are currently using.