SSH Keys

I already use RSA ssh keys to access my VPS but a friend of mine send me a link about ED25519 public-key algorithm. But why ssh-keys? Mainly to avoid to type your password every single time.

https://medium.com/risan/upgrade-your-ssh-key-to-ed25519-c6e8d60d3c54

I will not explain the maths behind because I can’t (but I would love to understand) so wikipedia can do a better work (and in the main time, think of donating a few bucks 🙂

https://en.wikipedia.org/wiki/EdDSA

If you still want to generate RSA keys (you can have both), this is my go-to link:

https://www.cyberciti.biz/faq/how-to-set-up-ssh-keys-on-linux-unix/

Summary, just in case the links disappear:

# create your key RSA or Ed25519

$ ssh-keygen -t rsa -f ~/.ssh/id_rsa4096 -b 4096 -C "user@origin"

or

$ ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "user@origin"

# Add your priv key into your ssh-agent so it is used when connecting to the destination

$ ssh-add ~/.ssh/id_xxx

# Copy your PUBLIC!!! key to the remote server you want to login with that key (and so you dont need to type a password)

$ ssh-copy-id -i .ssh/id_xxx.pub user@remove_server

# Test your new ssh-key

$ ssh -i ~/.ssh/id_xxx user@remove_server

Linux Network Namespaces

At work, we use a vendor whose Network Operating System (NOS) is based in Linux. I am a network engineer so I was troubleshooting an issue inside a VRF. I couldn’t use much of the normal commands in the default VRF. So I opened a ticket with the vendor and learned a bit how the VRFs are implemented under the hoods. Obviously (not for me) they use Linux Namespaces, after googling the meaning of the commands they sent. My search brought me to the following links:

This is a good intro:

https://blog.scottlowe.org/2013/09/04/introducing-linux-network-namespaces/

From this link, I took some examples in my quick search

https://kashyapc.fedorapeople.org/virt/openstack/neutron/neutron-diagnostics.txt

At the end I used commands like these:

$ sudo ip netns list
$ sudo ip netns exec ns-INET ip link list
$ sudo ip netns exec ns-VRF1 arp -a
$ sudo ip netns exec ns-VRF1 route -n
$ sudo ip netns exec ns-VRF1 telnet -b src_ip dst_ip port
$ sudo ip netns exec ns-VRF1 tcpdump -i lo4 -nn  tcp 179
$ sudo ip netns exec ns-VRF1 ss --tcp --info
$ sudo ip netns exec ns-VRF1 ss --tcp --info -nt src IP

As well, “ss” is such a useful command for troubleshooting and I always feel that I dont make the most of it:

How I created this blog

Still in progress:

1- Get a VPS:

There are so many options, AWS, GCP, OVH, etc. I used OVH as it was pretty cheap initially and chose the most basic VPS. I use Debian as OS.

https://www.ovh.co.uk/vps/

2- Get a domain

There are many place to buy domains, you dont need anything fancy and spend big. Just google. I used OVH too

https://www.ovh.co.uk/domains/

3- Install LAMP

I used several links.

https://linuxconfig.org/how-to-install-a-lamp-server-on-debian-9-stretch-linux

The above should give you a working database (MariaDB/MySQL), PHP(7.0) and a web server (Apache2).

I found an issue trying to get apache and php to work.:

https://stackoverflow.com/questions/47024111/apache-installing-and-running-php-files

https://askubuntu.com/questions/451708/php-script-not-executing-on-apache-server

At the end I had to remove a module, add php7.0 module and restart. Afterwards I could thest apache was executing php. Once that was configured I removed the php file as recommended.

sudo a2dismod mpm_event
sudo a2enmod php7.0
sudo systemctl restart apache2

If apache+php dont work properly, the next steps will fail.

4- Install PHPmyAdmin

I used these links:

https://www.hostingadvice.com/how-to/install-phpmyadmin-on-ubuntu/

https://www.digitalocean.com/community/tutorials/how-to-install-and-secure-phpmyadmin-on-debian-9

4- Get SSL cert:

You can get this for free: https://letsencrypt.org/

It is so easy to get your certs generated, installed and renewed, that I can’t believe it:

https://certbot.eff.org/lets-encrypt/debianstretch-apache

5- Install WordPress

https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-debian-9

Still needed some tweaking as I am pretty clueless with Apache to make work WordPress:

https://www.rosehosting.com/blog/how-to-set-up-apache-virtual-hosts-on-debian-9/

6- Security

Keep in mind that you will create several user/pass.

  • mysql root user/pass
  • phpmyadmin user/pass
  • wordpressuser for mysql
  • wordpressuser for UI

Be conscious with the security, you don’t want your server/apps to be hacked and used for doggy activity.

Will ask for help to some friends and will another post how to secure this environment.