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
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. 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! # 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

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
dns

Ubuntu Linux cannot ping FQDN

Because this is the fifth time I fixed this issue I write a blog about it… Microsoft uses .local as the recommended root of internal domains, and serves them via unicast dns. Linux uses .local as the root of multicast dns. If you’re stuck on a broken MS network like this, reconfigure your linux multicast DNS to use a different domain like .alocal. To do this, add a domain-name=.alocal line to the [server] section of /etc/avahi/avahi-daemon.conf, then restart avahi-daemon: sudo service avahi-daemon restart. ...

December 16, 2017 · 1 min · thomasf
SSL-Certificate-how-to-secure-your-web-site

Convert PFX to PEM and upload the certificate to Plesk

Export the Private Key: ` Remove the password from the SSL certificate (unencrypted is needed for plesk): Export the certificate: ` Now upload the certificate: And bind the certificate in your hosting settings:

December 21, 2015 · 1 min · thomasf
usb

Clone HP ThinState Capture USB stick (or any other USB disk)

The ThinState USB disk is split into 2 partitions. And the second partition isn’t accessible in Windows so it was very hard to build a stick from scratch. There are a lot of Windows USB clone tools but because I had to clone the ThinState 16GB to a 8GB stick also, it was impossible to do it from my windows workstation. But when some things get more difficulty what do you do? Use Linux :) ...

April 8, 2015 · 2 min · thomasf
arch-mini

Install chrome with Arch Linux

In Windows I like Firefox more than chrome because everything is already “Google”. But Google chrome has a nice stable and fast flash plugin built-in and so I need a chrome browser in Linux…. Because I’m testing Arch Linux (Antergos actually ) and Google don’t have arch packages I found a way to install it automatically for me with the AUR repository. $yaourt -S google-chrome More info about the yaourt ( Y et A n O ther U ser R epository T ool): ...

August 15, 2014 · 1 min · thomasf
spam

Find spam script

We have detected that this IP is NATting for, or is infected itself, with a Linux (or possibly some other Unix-like system such as FreeBSD) PHP spam mailing script. Occasionally Windows servers are infected as well. We do not know how the malware got installed onto the machine, but we know a lot of what it does. The main thing we’ve seen it doing is sending staggering large volumes of email spam. But it can do a lot more than that, and that is the real danger. ...

May 21, 2014 · 9 min · thomasf
xi-logo-large

Nagios xi remove host and services

Run each of the following scripts from: /usr/local/nagiosxi/scripts cd /usr/local/nagiosxi/scripts/ ./nagiosql_delete_service.php –-config=LOC_MASShost_1 After the services have successfully been deleted, the host can be removed as well: ./nagiosql_delete_host.php –-host=LOC_MASShost_1 Once the host is removed, the new configuration can be applied and verified by running the reconfigure_nagios.sh ./reconfigure_nagios.sh

April 23, 2014 · 1 min · thomasf