Tag: server

SETTING UP EMAIL WITH YUNOHOST AND CLOUDFLARE

In a previous blog post I set up a Yunohost (“YH” moving forward) box with a script so that it would report it’s location back to Cloudflare (“CF” moving forward) automatically using a cron job entry on the box and a cool piece of free software called ddns-cloudflare. That blog was to make sure the website stuff (ie. WordPress blog, Nextcloud, etc) would work. The other neat part about setting up your YH box this way, I was thinking during the process, is that (I guess but haven’t tested yet), you could just unplug it and plug it in at another physical location (with the right ports open at that location, of course) and it should just start ‘magically working’. This would be a real selling feature for getting ‘off the grid’.

Now to attack the part that most people like me avoid – EMAIL!

We have all heard that email servers are complicated and stressful, but, with the CF-YH combo – once I figured it out – it now seems much easier than I had expected. But there weren’t any specific blogs out there for me to follow so I decided it would be super helpful to write one to help others avoid what I just went through.

This tutorial will connect CF to your YH email and give you a few tips to test as you go until it’s all working, since there are a few things in both CF and in YH that are a bit ‘weird’ I discovered. My hope is that this tutorial helps you get setup faster and easier.

This tutorial assumes you already have a CF account setup with the settings from the previous tutorial (www and A record stuff).

KNOWING WHERE YOUR YUNOHOST SETTINGS ARE

You will be able to find the private and unique details for your own Yunohost installation in the following section of your user interface:

Domains / nameofyourdomain.com / DNS Configuration

When you click this it will open up a pane that has all your records from the previous tutorial but also the recommended email settings. If you are like me, none of it will make sense at all.

The parts you are going to need to match up to CF are:

MX, DKIM and DMARC

The way in which you input them into CF is more than half of the battle, and the part where this tutorial should save you about 3 days of messing around.

First, let me give you a link to Cloudflare’s own support page on this topic. This will also give you a list of pretty much any kind of entry you might need in your own setup, if it’s more advanced than this tutorial. It also shows you how to create a records in your CF DNS settings. Here’s the link.

Now that you know how to enter a record in general, let’s enter them.

I’m going to display this like this:

MX RECORD

  • WHAT YH SHOWS IN DNS CONFIG PANE: @ 3600 IN MX 10 mylataylor.ca
  • HOW TO ENTER AND PASTE IT INTO CF
  • TYPE: MX
  • NAME: nameofyourdomain.com
  • VALUE: SERVER: nameofyourdomain.com PRIORITY: 10
  • TTL: AUTOMATIC

DKIM RECORD

  • WHAT YH SHOWS IN DNS CONFIG PANE: mail._domainkey 3600 IN TXT “v=DKIM1; h=sha256; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA…super_duper_long_long_thing”
  • HOW TO ENTER AND PASTE IT INTO CF
  • TYPE: TXT
  • NAME: mail._domainkey
  • VALUE: v=DKIM1; h=sha256; k=rsa; p=MIGfMA0GCSqGSIb3DQEBAQUAA…super_duper_long_long_thing (NO quotations)
  • TTL: AUTOMATIC

DMARC RECORD

  • WHAT YH SHOWS IN DNS CONFIG PANE: _dmarc 3600 IN TXT “v=DMARC1; p=none”
  • HOW TO ENTER AND PASTE IT INTO CF
  • TYPE: TXT
  • NAME: _dmarc
  • VALUE: v=DMARC1; p=none
  • TTL: AUTOMATIC

It was explained to me that I also need to check RDNS, but I have not had any problems yet, and I’m not sure what this is nor how to do it. If you want to add this instruction in the comments that would be great.

If you refresh your page in CF and notice that an orange cloud has re-appeared from grey status, you may not have updated your .yml zone file correctly from previous tutorial. Your script might be updating the DNS records and accidentally forcing it back on. And this will stop your emails from working (the orange cloud). Go back to that tutorial and review the script yml config file setup and make sure you got he hashtags on the right lines…

At this point, it’s the moment of truth: will you be able to send and receive emails?

CREATE ACCOUNTS (AND EMAIL ACCOUNTS) IN YUNOHOST

This part created some issues for me because there may (or may not) be either a bug or an interface issue in the YH account setup. It appears, as you create the YH user that the email can be separate, however, from my experience, you should keep the username and the ’email name’ to be exactly the same – let YH auto-fill it and keep that as your email name. So, if you want your email to be johndoe@nameofyourdomain.com, make your YH username as johndoe at the top and let that auto-fill into the email field below. It seems like YH can’t take periods/dots in the username so john.doe won’t work. There appears to be email aliases that are supposed to work so probably you can figure this out but for me, for this tutorial, I would just avoid dots/periods, keep a simple username and make sure it auto-fills into the email field.

TEST YOUR SETUP

Once your username / email is set up in YH, now move on to test the email, in the client of your choice, but I strongly recommend Thunderbird to at least test to make sure things are working because it definitely works, I can confirm. Once this test is confirmed and you can send, receive emails with a basic thunderbird setup, then can feel confidence about all your settings above.

THUNDERBIRD SETUP

Literally, just follow this link exactly. If your settings are right, it will work. If they aren’t, they won’t. Also, be sure to wait at least 30 minutes for your cron jobs (if you are continuing from the Cloudflare tutorial) to run because the cron job can mess up your settings as well, I discovered. Once you have run a cycle or two of cron jobs and all is well, go wild with the hottest new technology – email…

TIP: when you get to the manual config, Thunderbird puts a period / dot before the serverhostname which is easy to miss. If your email is in the main domain root, then make sure to remove these dots.

Now send a test email to another account you have access to. One important thing to check is that you aren’t ending up in spam folders…

TIP: If you press send on your test email and it hangs on sending, go into your account settings of Thunderbird and you might have some old Outoing (SMTP) servers from previous YH email tests in there. I found after I deleted these old test servers and tried again, it worked perfectly, but if there were other ones in there it hung and failed.

Assuming you got your test email, now send a reply back to it and make sure you get that too. If you’re excited and bored or both, do this step over and over again perhaps with nursery rhyme verses…but make sure no one is watching you… I can’t emphasize enough that you need to wait at least a cycle or two of your cron jobs running to make sure it’s not messing things up over at Cloudflare.

All good? Nice. Another consideration now that you are a warrior hosting your own email is that by using Thunderbird you can back up your emails easily enough by simply connecting and synching your emails across multiple devices.

UBUNTU TOUCH DEKKO SETUP

Now let’s set this up on our Ubuntu Touch device with Dekko.

  1. Select the left hamburger menu
  2. Select the top right settings cogwheel on dark panel
  3. Select ‘mail’
  4. Select ‘accounts’
  5. Select the top right + plus sign
  6. Select IMAP
  7. Enter ‘whatever you want’ for the first two name options
  8. IMAP hostname: overwrite example with your yunhost server email location
  9. ENCRYPTION: should already default to this: ‘force encryption (SSL/TLS)’. if not, do it.
  10. username/password: auto-filled from first step
  11. authentication: change to ‘login’ (defaults to ‘plain’)
  12. SMTP server: overwrite example with your yunohost server email location
  13. SMTP port: 587
  14. ENCRYPTION: ‘use encryption (STARTTLS)
  15. AUTHENTICATION: change to ‘login’ (it defaults to ‘plain’)

Last and final and very important or your outbound email will literally break for this account and, I think, all your email accounts. You need to go back into the settings for this new email address and to this step:

  1. Select top left hamburger menu
  2. Select top right settings cogwheel on dark panel
  3. Select ‘mail’
  4. Select ‘accounts’
  5. Select Your newly-created yunohost email account
  6. Select Outgoing Server
  7. Scroll down under the LOGIN field and turn on the switch that says ‘Authenticate from server capabilities’
  8. Press left arrow at top of screen to save settings

CONCLUSION

Now, you should be in business sending and receiving emails from a Yunohost server, in your house, using Dekko email client on your Ubuntu Touch device.

Tags : , , , ,

detailed ubuntu ddclient and namecheap tutorial

I just wanted to log this great website that I found which offers a great copy and paste ddclient setup.  It’s much better than the out-of-the-box setup that comes with the software.  Thanks very much for this tutorial!

detailed ubuntu ddclient and namecheap tutorial

It was also interesting to learn that Namecheap simply uses a service called ‘freedns’ apparently…. good to know in case you need to change domain registrars and keep a free dynamic dns service going….

Tags : , , , ,

Getting an Ubuntu Server Up and Running from Start to Finish: 14.04

All I wanted to do was turn an unused computer into a web host in my house so I could run wordpress on my own domain/website.  I knew Ubuntu is the best so that was my plan.  There are a lot of tutorials out there but I found it to be fragmented all over the world wide webs.

This post is to bring it all together in the steps needed so you can come back to it if you forget pieces (which I did shortly after successfully doing it). Here we go!

1. Prepare a USB drive for getting Ubuntu Server put on

This link will give you everything you need to prepare the drive. The only thing you have to change is the .iso file which can be downloaded from www.ubuntu.com.  For this tutorial you want to download the appropriate 14.04 server version (32 bit or 64 bit).  But the method of doing this is the same:

2. Install Ubuntu Server

This step-by-step tutorial is a good one to get your base server install going on the machine.  Once you’ve done it a few times this part, by the way, is fast and easy.  A bit intimidating the first time but rest assured most of the default settings are pretty not scary

3. Configure static IP

I had a bit of an issue in that during one install it gave me the name of the hard-wired connection as the normal ‘eth0’ but then after reinstalling it on another computer it was called ‘p1p1’.  I still don’t know the reason for this but it turns out that p1p1 and eth0 seem to act and operate and configure the same way.  Just a heads up in case you encounter it.  In this tutorial it explains how to set up the

4. Setting up the DNS servers with ddclient so the world can find your machine and domain

Now, before you begin this part, make sure you have your Dynamic DNS service details in front of you as you probably have to do some stuff in the back end where you registered your domain before you do the next stuff.  I did all this next stuff and then couldn’t figure out why it wasn’t working and the reason was that I had to do stuff in my domain registrar (Namecheap in this case) first.  For the sake of a quick namecheap tutorial and to maybe trigger some help for your own registrar, I’ll just explain what I did:

a) log into namecheap admin

b) manage my domain

c) find my domain and click ‘all hosts”

d) type ‘what’s my ip’ in your favourite web search.  It’ll spit out your public facing ip address.

e) manually enter that into the ‘all hosts’ area in the @ record space and the www record space.

f) save those changes.

Now move on to do the ddclient stuff in Ubuntu and it should work…

This link should be your defacto starting point.  It may be all you need but I, of course, did other stuff and didn’t have patience…

https://help.ubuntu.com/community/DynamicDNS

This one is good, too.

http://sourceforge.net/p/ddclient/wiki/Home/#introduction

Before even reading any of that I just did:

sudo apt-get install ddclient

And that seemed to get it on my system.  As soon as it was installed a GUI showed up to help with the install of the ddclient update stuff which was cool…. except that it didn’t work for Namcheap… so I just hit ‘esc’ a bunch of times and it got me out and finished the install eventually.  Then I did a:

sudo nano /etc/ddclient.conf (it seems some may need sudo nano /etc/ddclient/ddclient.conf)

I’m using Namecheap (I try not to plug too much but these guys have nailed it so many times) and they have a dynamic dns service for free with the domain you buy (big plus).  This is the tutorial I’m using but you can buy (or search free?) a dynamic name service that updates itself so you don’t have to buy a static IP from your ISP (internet service provider).

https://www.namecheap.com/support/knowledgebase/article.aspx/583/11/

… just plug in the data, control ‘x’, and enter key.

This blog post is a super nice exhaustive post showing perhaps more stuff you’ll need for a namecheap / ubuntu server setup:

http://ubuntuforums.org/showthread.php?t=1941466

I’m not sure if I had to but I ran

sudo ddclient

.. and it seemed to ‘start’. I’m not sure if this will run on startup or not…

5. Ping it! Just Ping it, yeah!

go to another computer ideally outside of the local network you are on (ie. call your mom and ask her to open a terminal) and enter:

ping yourdomain.com (but make sure you tell her to replace that with your domain, lol?)

You should get a reply eventually showing your public IP address from your ISP followed by regular packets coming back at you.  If no reply, the update client may still be propagating the changes through the internet.  I’ve been told propagation can take 24 to 48 hours although I”ve never experienced more than about 5 hours wait.

 

6.  Administrate me, baby.  I love it.

Now you’ve got a server running and doing stuff. You’ve seen Great Eagle, Moose Jaw and Apache before your eyes.  Now it’s time to turn words into dreams…?? or something like that.
This tutorial was the most simple and Ubuntu friendly tutorial I could find for getting webmin set up.  I’m converted back after a failed attempt with EHCP… if you figure it out please send me a nice simple tutorial and I’ll try again.

Here is the link to the tutorial

Note that I had to adjust the wget URL to the correct one for ubuntu by first going here: http://sourceforge.net/projects/webadmin/files/webmin/

then choosing the .deb file name and replacing it in the wget command in the tutorial above.  So, as of February 2, 2015, your wget command would look like this until the next release:

wget http://sourceforge.net/projects/webadmin/files/webmin/1.730/webmin_1.730_all.deb

I also had issues with the last item in the tutorial where you change the webmin admin…. didn’t work.  skip it and when the login page comes up, just use your main root user/password and it works fine.  Maybe someone could write a comment below how to change password because it would be nice not to use root…

7. Install WordPress

Why? Because that’s what every wimp does when he thinks he’s a server rock star and gets his first false sense of pride.  That’s why.

maybe this one?  https://www.youtube.com/watch?v=iqLsTycO9aA

and then this one maybe if you need to ssh and wget it on the remote machine?

http://code.tutsplus.com/articles/download-and-install-wordpress-via-the-shell-over-ssh–wp-24403

 

Tags : , , , , , , , ,