{ "id": "bn_positive_internet", "title": "Positive Internet", "username": "admin", "created_at": "2026-08-19 10:56:45", "updated_at": "2026-08-19 10:56:45", "notes": [ { "id": "note_1_6a858bed6abbd", "title": "Login Egguburt", "description": "Login details", "subnotes": [ { "id": "sub_1_6a858bed6abbf", "title": "Eggburt", "type": "command", "content": "I want to Admin Positive Servers!" }, { "id": "sub_2_6a858bed6abc0", "title": "Timpani", "type": "command", "content": "I want to administer Timpani." }, { "id": "sub_3_6a858bed6abc1", "title": "## How to connect in Timpani ##", "type": "command", "content": "From Eggburt: ssh timpani@timpops\r\nPassword: 99flak3\r\ntimpss 'servername'" } ] }, { "id": "note_2_6a858bed6abcc", "title": "Varnish", "description": "Varnish collection of commands", "subnotes": [ { "id": "sub_1_6a858bed6abcd", "title": "Varnish Domain Clean Cache", "type": "command", "content": "varnishadm \"ban req.http.host ~ DOMAIN\"" }, { "id": "sub_2_6a858bed6abce", "title": "Check the varnish syntax command:", "type": "command", "content": "varnishd -C -f \/etc\/varnish\/default.vcl" } ] }, { "id": "note_3_6a858bed6abcf", "title": "Find Spam IP", "description": "findspam commands", "subnotes": [ { "id": "sub_1_6a858bed6abd0", "title": "Spam in fw-a", "type": "command", "content": "tail -n3000 \/var\/log\/nginx\/access.log | awk '{print $1}' | sort -nr | uniq -c | sort -nr | head -n15" }, { "id": "sub_2_6a858bed6abd1", "title": "Spam in Home Dir", "type": "command", "content": "tail -n3000 \/home\/*\/logs\/*access*log | awk '{print $1}' | sort -nr | uniq -c | sort -nr | head -n15" }, { "id": "sub_3_6a858bed6abd2", "title": "Spam in App (apache2)", "type": "command", "content": "tail -n3000 \/var\/log\/apache2\/access.log | awk '{print $1}' | sort -nr | uniq -c | sort -nr | head -n15" }, { "id": "sub_4_6a858bed6abd3", "title": "Check all kind of logs in nginx", "type": "command", "content": "tail -n3000 \/var\/log\/nginx\/*access*log* | awk '{print $1}' | sort -nr | uniq -c | sort -nr | head -n15" } ] }, { "id": "note_4_6a858bed6abd4", "title": "Clean Disks Space", "description": "Cleaning Diskspaces for each kind of VMs", "subnotes": [ { "id": "sub_1_6a858bed6abd5", "title": "## Usually for App VM ##", "type": "command", "content": "apt clean; journalctl --vacuum-size=8M; logrotate -vf \/etc\/logrotate.d\/rsyslog; logrotate -vf \/etc\/logrotate.d\/apache2; logrotate -vf \/etc\/logrotate.d\/nginx; logrotate -vf \/etc\/logrotate.d\/varnish;" }, { "id": "sub_2_6a858bed6abd6", "title": "## Usually for firewall VM ##", "type": "command", "content": "apt clean; journalctl --vacuum-size=8M; logrotate -vf \/etc\/logrotate.d\/rsyslog; logrotate -vf \/etc\/logrotate.d\/nginx; logrotate -vf \/etc\/logrotate.d\/varnish;" }, { "id": "sub_3_6a858bed6abd7", "title": "## PHP ##", "type": "command", "content": "logrotate -vf \/etc\/logrotate.d\/php5.6-fpm; logrotate -vf \/etc\/logrotate.d\/php7.3-fpm; logrotate -vf \/etc\/logrotate.d\/php7.4-fpm; logrotate -vf \/etc\/logrotate.d\/php8.1-fpm; logrotate -vf \/etc\/logrotate.d\/php8.2-fpm;" }, { "id": "sub_4_6a858bed6abd8", "title": "## ONLY BASIC ##", "type": "command", "content": "apt clean; journalctl --vacuum-size=8M; logrotate -vf \/etc\/logrotate.d\/rsyslog;" }, { "id": "sub_5_6a858bed6abd9", "title": "VM + only apache2", "type": "command", "content": "apt clean; journalctl --vacuum-size=8M; logrotate -vf \/etc\/logrotate.d\/rsyslog; logrotate -vf \/etc\/logrotate.d\/apache2;" } ] }, { "id": "note_5_6a858bed6abda", "title": "Add findspam Script", "description": "This is the findspam from the repository.", "subnotes": [ { "id": "sub_1_6a858bed6abdb", "title": "Command:", "type": "command", "content": "apt install -y jq; echo \"\" && echo \"Checking the reachability of the server...\"; ping -c 2 -W 2 scripts.svm.picl.co.uk > \/dev\/null 2>&1 && echo \"Server reachable. Proceeding with script update.\" || { echo \"Server unreachable. Update canceled.\"; exit 1; }; for i in updatebspamscripts findspam blockspamip spamwhat nobanip unblockspams; do echo \"Updating script $i...\"; curl -s -o \/usr\/local\/sbin\/$i https:\/\/scripts.svm.picl.co.uk\/scripts\/$i.sh && chmod 700 \/usr\/local\/sbin\/$i && echo \"Script '$i' updated.\" || echo \"Error updating script '$i'.\"; done" } ] }, { "id": "note_6_6a858bed6abdc", "title": "Create New Database", "description": "Command to create new database and database use", "subnotes": [ { "id": "sub_1_6a858bed6abdd", "title": "## Create Databases ##", "type": "command", "content": "CREATE DATABASE unixuser;" }, { "id": "sub_2_6a858bed6abde", "title": "# Create User For DB #", "type": "command", "content": "grant all privileges on `unixuser`.* to `unixuser`@'%' identified by 'password database';" } ] }, { "id": "note_7_6a858bed6abdf", "title": "Rsync From Server to the other", "description": "Command to rsync between the servers", "subnotes": [ { "id": "sub_1_6a858bed6abe0", "title": "## Rsync Command ##", "type": "command", "content": "rsync -avzP \/home\/user\/public_html\/ user@10.10.10.17:\/home\/user\/public_html\/" } ] }, { "id": "note_8_6a858bed6abe1", "title": "WP-CLI Commands", "description": "Usefully commands for wp-cli. Note that you need to change \"from-website\" and \"to-website\" with the correct domain.", "subnotes": [ { "id": "sub_1_6a858bed6abe2", "title": "## Export DB ##", "type": "command", "content": "wp db export" }, { "id": "sub_2_6a858bed6abe3", "title": "## Change Links for wordpress ##", "type": "command", "content": "wp search-replace 'from-website.Com' 'to-website.com' --all-tables" }, { "id": "sub_3_6a858bed6abe4", "title": "Add New User (change the '###*' strings with the correct informations)", "type": "command", "content": "wp user create ###USERNAME ###EMAIL@DOMAIN --role=administrator --user_pass=\"###PASSWORD\"" }, { "id": "sub_4_6a858bed6abe5", "title": "Install WP-CLI (Use this as root user)", "type": "command", "content": "curl -O https:\/\/raw.githubusercontent.com\/wp-cli\/builds\/gh-pages\/phar\/wp-cli.phar; chmod +x wp-cli.phar; sudo mv wp-cli.phar \/usr\/local\/bin\/wp" }, { "id": "sub_5_6a858bed6abe6", "title": "Install varnish-cache plugin:", "type": "command", "content": "wp plugin install varnish-http-purge\r\nwp plugin activate varnish-http-purge" }, { "id": "sub_6_6a858bed6abe7", "title": "Configuration to add in wp-config.php for the cache plugin", "type": "command", "content": "define('VHP_VARNISH_IP','varnish-vip:6081');" }, { "id": "sub_7_6a858bed6abe8", "title": "(Run as Root) Checksums verify WP CLI on all \/home folders", "type": "command", "content": "for u in \/home\/*; do user=$(basename \"$u\"); for d in httpdocs public_html; do if [ -d \"$u\/$d\" ] && [ -f \"$u\/$d\/wp-config.php\" ]; then echo \"=== $user ($d) ===\"; sudo -u \"$user\" -H wp --path=\"$u\/$d\" core verify-checksums; echo; fi; done; done" }, { "id": "sub_8_6a858bed6abe9", "title": "verify checksum for a single website", "type": "command", "content": "wp core verify-checksums" }, { "id": "sub_9_6a858bed6abea", "title": "restore corefiles", "type": "command", "content": "wp core download --version=$(wp core version) --force" }, { "id": "sub_10_6a858bed6abeb", "title": "Create posops user", "type": "command", "content": "wp user create posops good@positive-internet.com --role=administrator --user_pass='P3dsfj7nYLaMxxXk'" }, { "id": "sub_11_6a858bed6abec", "title": "Cambiare la password di un utente", "type": "command", "content": "wp user update posops --user_pass='P3dsfj7nYLaMxxXk'" } ] }, { "id": "note_9_6a858bed6abed", "title": "Find Killig Process Error", "description": "Command to check what has been killed in the VMs \/ Machine", "subnotes": [ { "id": "sub_1_6a858bed6abee", "title": "## How to check errors ##", "type": "command", "content": "grep -E '(reaper|oom)' \/var\/log\/syslog" } ] }, { "id": "note_10_6a858bed6abef", "title": "Generate SSH Key", "description": "Command to generate ssh key", "subnotes": [ { "id": "sub_1_6a858bed6abf0", "title": "## ED25519 ##", "type": "command", "content": "ssh-keygen -t ed25519" }, { "id": "sub_2_6a858bed6abf1", "title": "## RSA ##", "type": "command", "content": "ssh-keygen -t rsa -b 4096" } ] }, { "id": "note_11_6a858bed6abf2", "title": "User Basic Auth", "description": "How to create \/ add user for the basicauth.", "subnotes": [ { "id": "sub_1_6a858bed6abf3", "title": "## CREATE A FILE \/ USER (cancel existing one) ##", "type": "command", "content": "htpasswd -c \/etc\/nginx\/.htpasswd-name nuovo_utente" }, { "id": "sub_2_6a858bed6abf4", "title": "## ADD EXTRA USER ##", "type": "command", "content": "htpasswd \/etc\/nginx\/.htpasswd-name username" }, { "id": "sub_3_6a858bed6abf5", "title": "Block to add", "type": "command", "content": "auth_basic \"Restricted Access\";\r\n auth_basic_user_file \/etc\/nginx\/.htpasswd;" }, { "id": "sub_4_6a858bed6abf6", "title": "Ownership and privileges", "type": "command", "content": "htpassloc=\"etc\/nginx\/.htpasswd\";\r\nchown www-data:www-data $htpassloc;\r\nchmod 644 $htpassloc" } ] }, { "id": "note_12_6a858bed6abf7", "title": "Check DB Size", "description": "Command to check the dimension of the databases; (needs to be specified the databases names)", "subnotes": [ { "id": "sub_1_6a858bed6abf8", "title": "## CHECK DB SIZE ##", "type": "command", "content": "SELECT table_schema AS \"Database\", ROUND(SUM(data_length + index_length) \/ 1024 \/ 1024, 2) AS \"Dimension (MB)\" FROM information_schema.tables WHERE table_schema IN (\"dbname1 \", \"dbname2\", \"dbname3\", \"dbname4\") GROUP BY table_schema;" } ] }, { "id": "note_13_6a858bed6abf9", "title": "Remove Files and keep the newest one", "description": "Change the variable keep in base to how much newest file you need to keep!", "subnotes": [ { "id": "sub_1_6a858bed6abfa", "title": "## REMOVE OLDEST FILES CODE ##", "type": "command", "content": "count=0; keep=4; echo \"### FILE THAT WILL BE REMOVED: ###\"; echo \"-------------------------------\"; for i in $(ls -t); do if [ $count -lt $keep ]; then echo \"Keeping: $i\"; else echo \"Removing $i\"; fi; ((count++)); done; echo \"-------------------------------\"; echo \"Do you wish to continue?\"; echo \"y - Yes\"; echo \"default - no\"; read check; check=${check,,}; if [ \"$check\" == \"y\" ]; then echo \"#### REMOVING FILE ####\"; echo \"-------------------------------\"; count=0; for i in $(ls -t); do if [ $count -lt $keep ]; then echo \"Keeping: $i\"; else echo \"Removed $i\"; rm \"$i\"; fi; ((count++)); done; echo \"-------------------------------\"; else echo \"Not Removed\"; fi\r\n" } ] }, { "id": "note_14_6a858bed6abfb", "title": "Add Diskspace Command", "description": "After increased the diskspace of the hard disk on proxmox, we can run this command to add the 100% of the diskspace to the root partition.", "subnotes": [ { "id": "sub_1_6a858bed6abfc", "title": "Command:", "type": "command", "content": "parted \/dev\/vda resizepart 1 100%; pvresize \/dev\/vda1; lvextend -l +100%FREE \/dev\/vgmain\/root; resize2fs \/dev\/vgmain\/root" } ] }, { "id": "note_15_6a858bed6abfd", "title": "New Certboot Certificate", "description": "Install new certboot Certificate", "subnotes": [ { "id": "sub_1_6a858bed6abfe", "title": "Command:", "type": "command", "content": "certbot certonly --webroot -w \/var\/www\/html -d ###DOMAIN" } ] }, { "id": "note_16_6a858bed6abff", "title": "Extract pfx key", "description": "Use this command to extract the key and the pem files from a .pfx file.\r\nChange the variables before to run the command.", "subnotes": [ { "id": "sub_1_6a858bed6ac00", "title": "Command:", "type": "command", "content": "PFX=\"FILE_NAME\";\r\nPASS=\"PASSWORD_PFX\";\r\nopenssl pkcs12 -in \"$PFX\" -passin pass:\"$PASS\" -nocerts -nodes -out server.key && \\\r\nopenssl pkcs12 -in \"$PFX\" -passin pass:\"$PASS\" -nokeys | \\\r\nsed -n '\/BEGIN CERTIFICATE\/,\/END CERTIFICATE\/p' > fullchain.pem\r\n" } ] }, { "id": "note_17_6a858bed6ac01", "title": "check if the ssh-key is valid", "description": "With this command we can check if a ssh key is valid or not", "subnotes": [ { "id": "sub_1_6a858bed6ac02", "title": "Command:", "type": "command", "content": "FILENAME=\"path\/to\/the\/file\";\r\nssh-keygen -l -f $FILENAME;\r\n" } ] }, { "id": "note_18_6a858bed6ac03", "title": "checking valid rules for studiorep-fw", "description": "This command is checking which of the following rules has been accepted for the php-rules", "subnotes": [ { "id": "sub_1_6a858bed6ac04", "title": "Command:", "type": "command", "content": "php-fpm8.3 -tt 2>&1 | grep -A50 \"\\[POOL_NAME\\]\"" } ] }, { "id": "note_19_6a858bed6ac05", "title": "Add new VM to spa", "description": "Use this to add the new element to the spa command. Specify the Public IP, the port and the hostname", "subnotes": [ { "id": "sub_1_6a858bed6ac06", "title": "Command:", "type": "command", "content": "sudoedit \/home\/posops\/ansible\/hosts" } ] }, { "id": "note_20_6a858bed6ac07", "title": "PHP-FPM Scripts", "description": "Script Collection for PHP-FPM", "subnotes": [ { "id": "sub_1_6a858bed6ac08", "title": "Restarting all php-fpm existing", "type": "command", "content": "for i in \/etc\/php\/*; do version=$(basename \"$i\"); service=\"php${version}-fpm\"; if systemctl list-units --type=service --all | grep -q \"$service\"; then echo \"[ $service ]\"; systemctl restart \"$service\"; systemctl status \"$service\" | grep Active; fi; done" }, { "id": "sub_2_6a858bed6ac09", "title": "Check the php-version for the vhost", "type": "command", "content": "VERSION=8.3; for i in *; do socket=$(grep -oP 'SetHandler\\s+\"proxy:unix:\\K[^|\"]+' \"$i\"); if [ -n \"$socket\" ]; then domain=$(basename \"$socket\" .sock); match=$(grep -iRl \"$domain\" \/etc\/php\/*\/fpm\/pool.d\/); if [ -n \"$match\" ]; then phpver=$(echo \"$match\" | sed -n 's|\/etc\/php\/\\([^\/]*\\)\/fpm\/.*|\\1|p' | sort -u); if echo \"$phpver\" | grep -q \"^$VERSION$\"; then echo \"[ $domain ]\"; echo \"php-fpm $phpver\"; fi; fi; fi; done" }, { "id": "sub_3_6a858bed6ac0a", "title": "Check the php-version for the vhost", "type": "command", "content": "exver=\"7.4\" instver=\"8.4\" ; for i in $(dpkg -l *php* | awk '{print $2}' | grep $exver); do apt install php$instver${i:6} -y; done" } ] }, { "id": "note_21_6a858bed6ac0b", "title": "ownership to 755 folder and 644 files", "description": "Changing the ownership from 755 to the folders and 644 to the files (sub-directories included) with find + xarg in the current director.", "subnotes": [ { "id": "sub_1_6a858bed6ac0c", "title": "Command", "type": "command", "content": "find . -type d -print0 | xargs -0 chmod 755;\r\nfind . -type f -print0 | xargs -0 chmod 644" } ] } ] }