Shell

Create Azure Linux VM with worpress pre-installed

This is my first completed automated Linux Azure VM deployment. I like to share it with you. There are 3 parts Create a keygen for ssh Powershell script Bash script First start powershell and create a keypair with passphase ssh-keygen -m PEM -t rsa -b 4096 Then place the bash script somewhere on your local computer #! /bin/bash apt-get update apt-get install -y wordpress php libapache2-mod-php mysql-server php-mysql echo "Alias /blog /usr/share/wordpress" >>/etc/apache2/sites-available/wordpress.conf echo "" >>/etc/apache2/sites-available/wordpress.conf echo " Options FollowSymLinks" >>/etc/apache2/sites-available/wordpress.conf echo " AllowOverride Limit Options FileInfo" >>/etc/apache2/sites-available/wordpress.conf echo " DirectoryIndex index.php" >>/etc/apache2/sites-available/wordpress.conf echo " Order allow,deny" >>/etc/apache2/sites-available/wordpress.conf echo " Allow from all" >>/etc/apache2/sites-available/wordpress.conf echo "" >>/etc/apache2/sites-available/wordpress.conf echo "" >>/etc/apache2/sites-available/wordpress.conf echo " Options FollowSymLinks" >>/etc/apache2/sites-available/wordpress.conf echo " Order allow,deny" >>/etc/apache2/sites-available/wordpress.conf echo " Allow from all" >>/etc/apache2/sites-available/wordpress.conf echo "" >>/etc/apache2/sites-available/wordpress.conf a2ensite wordpress a2enmod rewrite reload apache2 service apache2 reload systemctl restart apache2 mysql -e "CREATE DATABASE wordpress;" mysql -e "CREATE USER wordpress@localhost IDENTIFIED BY 'Secret@Pass1';" mysql -e "GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER ON wordpress.* TO wordpress@localhost;" mysql -e "FLUSH PRIVILEGES;" echo ">/etc/wordpress/config-localhost.php echo "define('DB_NAME', 'wordpress');">>/etc/wordpress/config-localhost.php echo "define('DB_USER', 'wordpress');">>/etc/wordpress/config-localhost.php echo "define('DB_PASSWORD', 'Secret@Pass1');">>/etc/wordpress/config-localhost.php echo "define('DB_HOST', 'localhost');">>/etc/wordpress/config-localhost.php echo "define('DB_COLLATE', 'utf8_general_ci');">>/etc/wordpress/config-localhost.php echo "define('WP_CONTENT_DIR', '/usr/share/wordpress/wp-content');">>/etc/wordpress/config-localhost.php echo "?>">>/etc/wordpress/config-localhost.php service mysql start publicip=$(dig +short myip.opendns.com @resolver1.opendns.com) && mv /etc/wordpress/config-localhost.php /etc/wordpress/config-$publicip.php Then put the code in the Powershell ISE, change some variables and kickoff the script. ...

February 6, 2021 · 3 min · thomasf
Shell

Citrix reboot server script

This Citrix script will reboot all the servers with the tags SomeTag or SomeOtherTag and are in maintenance mode. Have fun! $machines=Get-BrokerMachine | Where-Object {($_.Tags -eq "SomeTag" -or $_.Tags -eq "SomeOtherTag") -and ($_.InMaintenanceMode -eq "True")} Foreach($machine in $machines) {New-BrokerHostingPowerAction -Action Restart -MachineName $machine.Machinename}

October 15, 2020 · 1 min · thomasf
wale

Install Pihole on Synology with docker

Unfortunately, there isn’t a pihole addon in the Synology package center. But you can build your pihole in a docker container instead :) The reason you must use docker-compose instead of the Synology docker package itself is that you want to bridge net NIC of your Synology and place the pihole direct in your network. You cannot do this with the GUI. The steps: Install docker with the package center Activate SSH Download de image pihole/pihole:latest Login with ssh type vi docker-compose.yaml Paste the content from the docker-compose.yaml example into the vi Change the IP adressen to your own network Type :wr to save the file Type :q to quit vi Type “sudo docker-compose up” Have fun! Docker-compose.yaml Example # Note: 192.168.123.xxx is an example network, you must update all these to match your own. version: '2' services: pihole: container_name: pihole image: pihole/pihole:latest hostname: pihole domainname: localhost # <-- Update mac_address: d0:ca:ab:cd:ef:01 cap_add: - NET_ADMIN networks: pihole_network: ipv4_address: 192.168.123.199 # <-- Update dns: - 127.0.0.1 - 1.1.1.1 ports: - 443/tcp - 53/tcp - 53/udp - 67/udp - 80/tcp environment: ServerIP: 192.168.123.199 # <-- Update (match ipv4_address) VIRTUAL_HOST: pihole.localhost # <-- Update (match hostname + domainname) WEBPASSWORD: "justarondompassword" # <-- Add password (if required) restart: unless-stopped networks: pihole_network: driver: macvlan driver_opts: parent: ovs_eth0 ipam: config: - subnet: 192.168.123.0/24 # <-- Update gateway: 192.168.123.1 # <-- Update ip_range: 192.168.123.192/28 # <-- Update When you want to update the docker container, all you have to do is: ...

May 12, 2020 · 2 min · thomasf

Policy WSUS: "Automatically download updates and install them on the schedule specified below" don't work...!!!?!

So I configure a “configure automatic updates” policy for testing purposes but the auto-update and installation won’t work. The main cause….? Lack of patience ;-) How this Policy works (source): The Windows Update Agent periodically checks the WSUS server for updates. Updates it finds, it reports state for: Installed, Not Installed, Not Applicable. If a “Not Installed” update is approved and available, the WUA queues the installation files for download if the Configure Automatic Updates policy is set to AUOption ‘3’ or ‘4’. ...

February 4, 2020 · 3 min · thomasf

Create a local TCP port for a remote server on a ubuntu/debian server

You can do this stuff with netcat and inetd apt-get install openbsd-inetd (netcat is installed by default) nano /etc/inetd.conf LOCALIP:443 stream tcp nowait root /bin/nc nc REMOTEIP 443 /etc/init.d/openbsd-inetd restart Have fun!

February 1, 2020 · 1 min · thomasf
dialog-question

How to keep processes running after ending ssh session

ssh into the remote machine start tmux by typing tmux into the shell start the process you want inside the started tmux session leave/detach the tmux session by typing Ctrl+b and then d

February 1, 2020 · 1 min · thomasf

Thomas zijn overdracht pagina'tje

Hey Marlou (of illegaal Kolibrietje)! Je hebt hem gevonden: “Thomas zijn overdracht pagina’tje”…! Op deze pagina kun je wat interesante URL’s vinden om jouw leven bij Kolibrie weer een stukje makkelijker te maken :) @Illegaal kolibrietje: Wat ben je toch een hacker ;) Zomaar een beetje QR codes van andere scannen en wachtwoorden van geeltjes overtypen… Maar misschien zit er voor jou ook nog wel wat tussen ;) Dit zijn ze: ...

December 12, 2019 · 1 min · thomasf
image-3

Enable SMB in Kodi XBOX One (UWP)

Go to add-ons My add-ons All Select SMB support (libsmb2) Enable That’s all!

November 27, 2019 · 1 min · thomasf
image-1

Papercut: Simple Desktop SMTP Server

Sometimes you want to test a mail application without spamming the internet with your garbage. Use can user Papercut to local test your mail application. URL: https://github.com/ChangemakerStudios/Papercut/releases

November 22, 2019 · 1 min · thomasf

Compare 2 sql tables

A simple SQL compare is realy easy: select * from dbtest02.dbo.article except select * from dbtest01.dbo.article Source: https://www.mssqltips.com/sqlservertip/2779/ways-to-compare-and-find-differences-for-sql-server-tables-and-data/

May 15, 2018 · 1 min · thomasf