#security
18 one-liners with this tag.
All one-liners tagged security
Securely overwrite and delete a file
$shred -u -z -n 3 -- /root/old-dump.sql
Check Composer packages for known vulnerabilities
$composer audit --working-dir=/var/www/vhosts/example.com/httpdocs
Check whether a server supports TLS 1.3
$openssl s_client -connect example.com:443 -servername example.com -tls1_3 </dev/null 2>/dev/null | grep -E "^New,|Protocol *:"
Check WordPress core files for tampering
$wp core verify-checksums --path=/var/www/vhosts/example.com/httpdocs
Compare plugin files with the originals from wordpress.org
$wp plugin verify-checksums --all --path=/var/www/vhosts/example.com/httpdocs
Find a hacked mail account by its SMTP logins
#grep -o "sasl_username=[^ ,]*" /var/log/maillog | sort | uniq -c | sort -rn | head -20
Find files with the SUID or SGID bit
#find / -xdev \( -perm -4000 -o -perm -2000 \) -type f -exec ls -l {} + 2>/dev/null
Find world-writable files and directories
$find /var/www/vhosts -xdev -perm -0002 ! -type l -ls 2>/dev/null
List all MySQL users with their host
#mysql -e 'SELECT user, host FROM mysql.user ORDER BY user;'
List all WordPress administrators
$wp user list --role=administrator --fields=ID,user_login,user_email,user_registered --path=/var/www/vhosts/example.com/httpdocs
Regenerate WordPress security keys (salts)
$wp config shuffle-salts --path=/var/www/vhosts/example.com/httpdocs
Remove write permission for others recursively
$chmod -R o-w /var/www/vhosts/example.com/httpdocs
Secure the permissions of wp-config.php
$chmod 600 /var/www/vhosts/example.com/httpdocs/wp-config.php
Show all requests from one IP address in the access log
#awk -v ip="203.0.113.10" '$1 == ip' /var/www/vhosts/system/example.com/logs/access_ssl_log | tail -50
Show only pending security updates
$apt list --upgradable 2>/dev/null | grep -- -security
Show recently registered WordPress users
$wp user list --orderby=registered --order=DESC --fields=ID,user_login,user_email,user_registered,roles --path=/var/www/vhosts/example.com/httpdocs | head -n 15
Show the Web Application Firewall (ModSecurity) status in Plesk
#plesk bin server_pref --show-web-app-firewall
Test automatic updates (unattended-upgrades) with a dry run
#unattended-upgrade --dry-run -d