About Me

I am a full time Systems Administrator by day and IT consultant by night, apart from my full time job to do IT consulting for companies with growing technology needs If you are a business that needs some technology help lets talk.

What makes you different than other information technology consultants?
A lot of IT consultants work off of a break/fix model, this means that when something breaks they show up to fix it. I don’t like this model and neither do you most of the time this model exists because of an old clunky system that break all the time that only certain people know how to fix. This situation is not typically a technology problem but a business one that IT consulting businesses capitalise on heavily claiming to have hidden or special knowledge that holds your systems uptime hostage.

So how do you fix the break/fix mentality/model? Our strategy for not ending up in a break/fix system is as follows.

  • Fix things once, for everyone, the first time and avoid bandaids like the plague.
  • Stop doing things that don’t work: This use to be the montra hanging on the wall at bell labs, its the hardest step most of the time.
  • Don’t build things that you think will break, if its likely to break don’t build it.
  • Documentation: as a customer you will have access to a full set of up to date documentation when something breaks we give you the fix, when we do patches, make changes, or update services you have all the notes. Our documentation should be so good that if at some point I get hit by a bus you have everything you need to go to the next guy.
  • Our Goal: The one driving force behind our work is we want the ability to step away, visits from us should be rare and hopefully friendly check ins to ask what other business technology needs we can meet if any.

IT as a Service Offerings
Server Design, configuration, installation and management.
Cloud Services, configuration, migration and management.
Network Design, configuration, Installation and management.

Advertisements

General Security Advice [updated 12/24/17]

I was in Starbucks the other day and overheard a local computer tech helping someone with reinstalling windows on their notebook, the tech left and I started a conversation with him giving him some advice around making a good backup of the computer after he had finished so if something were to happen he would be able to make a quick recovery next time.  That may not sound like security advice but it really was often the act of protecting data is done to protect our time and resources, if he had a backup of his new computer he would not have had to take the computer to a shop, spend his money on the time of the computer tech, wait in Starbucks whilst windows reinstalled onto a new hard drive.

Here is the collection of advice I wish I could have also given him but just did not have the time to, this is also advice I give to family members, coworkers, and people like you who stumble across my website.

A. Securing Online Accounts 

  1. Use a password manager and avoid reusing passwords across sites like the plague, side not it is the plague.  Lastpass is a great starting point don’t forget your master password.  If you don’t like the idea of storing your passwords online keepass is a good option, so is password safe by Bruce Schneier.
  2. Enable 2nd factor authentication on all your accounts including your password manager if your using an online one.
  3. Setup haveibeenpwned.com for the email account/s you use.
  4. Recognize the human error factor, humans make mistakes, when your using the web make sure your using an adblocker to avoid malicious advertisements that might lead you to a spoofed site.  Ublock origin is great for this.  Using a 3rd party DNS is also a great help using quad9 or OpenDNS Greatly increases your security at no cost and is fairly easy to setup.

B. Securing Personal Computers

  1. Don’t use an admin account for every day computing this applies to mac, linux and windows no exceptions.  Follow the Principle of least privilege.
  2. Data security is just as important as account security in most cases, having backups is the best way to secure your data from accidental deletion, loss, and ransomware. Veeam endpoint free is free and does a great job backing up your entire system.
  3. Run a up to date version of your operating system and ensure you have security updates installed.

C. Securing Data

  1. 3-2-1 Backups,  If your data is not following 3-2-1 backups it does not exist and likely wont be recoverable if you loose it.
  2. If your storing sensitive data in the cloud use some form of “pre-internet encryption” for windows and mac and Linux veracrypt is probably the golden standard but there are other encryption tools even having a encrypted zip file is better than nothing.  Note: password protected and encrypted are different things.
  3. If its unimportant data back it up, if its important data back it up again.  The number 1 reason important data cant be restored is that someone didn’t think it was important.  If you backup everything all the time this is an easy pitfall to avoid.

A note on antivirus: I did not mention antivirus here for the reason that consumer grade antivirus systems seem to change like the wind lately.  In general if your looking for an antivirus system I would recommend looking at reviews from IT people as they will spend a lot more time than you can imagine looking at antivirus solutions for their respective companies.  Nearing the end of 2017 I have begun to see a rise in malware that exploits antivirus systems to compromise the machine they were designed to protect, in general your best antivirus option is having an up to date computer with the most recent security patches installed and following best practices B.1 is your best bet.

Resource List

Setup Samba on CentOS-7 (on LXD)

Previously I had written an article about setting up a file server using FreeBSD and Samba I still think that FreeBSD is a great choice for a file server. That said I am now using LXC and LXD containers on Ubuntu and samba works very much the same way on CentOS-7 which I can run as a container on Ubuntu to get a very similar result. Setting Samba up on a base CentOS-7 install should work much the same way if you have a CentOS-7 server you can skip the Container Stuff.

I am assuming that your starting point is an up to date Ubuntu 16.04 server.

Networking Setup
for this use case we are assuming that our system is on a local network (not internet exposed) We want our container to have a LAN IP so that other computers on our LAN can talk to it there are a couple different ways to set this up. The way that I have found to be the easiest in my case has been to change the default container profile so that the nictype of the containers is set to macvlan.

run ifconfig which should give you something like this

ifconfig

enp0s25   Link encap:Ethernet  HWaddr d0:50:99:79:98:dd
          inet addr:192.168.88.2  Bcast:192.168.88.255  Mask:255.255.255.0
          inet6 addr: fe80::d250:99ff:fe79:98dd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1354182 errors:0 dropped:132 overruns:0 frame:0
          TX packets:704181 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1724747998 (1.7 GB)  TX bytes:598961741 (598.9 MB)
          Interrupt:20 Memory:efd00000-efd20000

You may have more adapters find the one that has the IP you ssh’d into and take note of its name in my case its enp0s25

Changing nictype to macvlan, lxc profile edit default will open the profile with nano.

Lxc profile edit default

#Change 
nictype: bridged To -> nictype: macvlan

#Change
parent: whatever To -> parent: your primary nic name (enp0s25 in my case)

Container Stuff: Build a CentOS-7 Container

lxc launch images:centos/7/amd64 smbserver

drop into the containers shell

lxc exec smbserver /bin/bash

Setting up SAMBA on CentOS-7
If your not using containers then you should be SSH’d into your server now regardless go ahead and install updates,  If you have an Active Directory environment you can also setup samba to use AD for authentication using my notes here if not continue on.

install samba

yum install samba

start samba

systemctl enable smb.service
systemctl start smb.service

Adding users (both to the system and to samba)

# adding a user with useradd (-m tells useradd to create a home directory)
useradd -m joe

# set the users password so they can login
passwd joe

# set the samba password so they can login using samba
smbpasswd -a joe

If all you wanted is for users to be able to store things in their home folder than your done the default smb.conf configuration shares out home folders by default. if you want to create a different file share you will need to edit your smb.conf file.

vi /etc/samba/smb.conf

A basic file share for users bob, joe and the group @sysadmins

[sysadmin_share]
comment = My shared folder
path = /path to the shared folder
public = no
writable = yes
guest ok = no
valid users = joe, bob, @sysadmins

Group Setup for the sysadmins group and sysadmins share

groupadd sysadmins
mkdir /opt/sysadmins
chgrp sysadmins /opt/sysadmins
chmod -R 770 /opt/sysadmins
sudo usermod -a -G sysadmins jeff

Now all that’s left to do is go to a client system and try to access the share.

Replacing Windows file servers with CentOS7, SSSD, and Samba

This is very much still a work in progress.

These are some misc notes on how I’v gotten CentOS to host smb shares over the network and use active directory to authenticate users to them.

Before going any further get yourself a CentOS minimal install on whatever system you plan on using for your file server run updates and configure networking (give your VM/Container/Server a hostname that makes sense) grab a cup of coffee and open your favorite terminal emulator/ssh client, login and su yourself to root.

Disable selinux by setting SELINUX=disabled in /etc/sysconfig/selinux

vi /etc/sysconfig/selinux
SELINUX=disabled

If you want to keep selinux enabled you’ll have to run 

chcon -t samba_share_t /your_smb_share_dir

on every share you make. 

Install Samba and its friends

yum install realmd samba samba-common oddjob oddjob-mkhomedir sssd ntpdate ntp

Make sure samba can talk threw the firewall

firewall-cmd --permanent --add-service=samba
firewall-cmd --reload

setup system time

systemctl enable ntpd.service
ntpdate yourdomaincontroller.yourdomain.tld
systemctl start ntpd.service

Some have noted that in order for things to work right you might need to add your DC as a server entry to /etc/ntp.conf, I have not yet needed to do this.

CentOS meet Windows active directory

realm join --user=domainadmin@yourdomain.tld yourdomain.tld

Confirm that things went well and CentOS is joined to AD

realm list

If everything went well you should see the output that lists your domain you can now use your favorite terminal emulator to ssh into your centos using your AD login, it should look something like this

ssh austin.janey@mydomain.com@your_centos_server

If that worked your good to go, if not google is your friend

Before the nextstep you will need to login to one of your domain controllers and create a security group you’ll specify in your samba config members of this AD group will be able to access the files in the file share specified.

Configuring Samba to play well with windows file sharing
time to edit /etc/samba/smb.conf

sudo vi /etc/samba/smb.conf
[global]
workgroup = MYACTIVEDIRECTORYDOMAIN
server string = Samba Server Version %v
security = ads
encrypt passwords = yes
passdb backend = tdbsam
realm = MYDOMAIN.LOCAL

# in my test network I could not get AD authentication for smb shares to work 
# without adding "kerberos method = secrets and keytab"
kerberos method = secrets and keytab

# Add the IPs / network ranges / subnets allowed acces to the server in general.
# this is not a nesessary entry but in general a good idea.
# hosts allow = 127. your local network info

# log files split per-machine:
log file = /var/log/samba/log.%m

# enable the following line to debug:
# log level =3
# maximum size of 50KB per log file, then rotate:
max log size = 50

# Not interested in printers
load printers = no
cups options = raw

# This stops an annoying message from appearing in logs
printcap name = /dev/null

# File Shares under valid users I put a group if you create a group for samba in # active directory and add users to it those users will be able to access smb 
# shares from this server over the network.

[home directory]
comment = My shared folder
path = /home
public = no
writable = yes
guest ok = no
valid users = @"agroup@youraddomain.tld"

Make sure Samba is enabled

systemctl enable smb.service
systemctl start smb.service

Now that samba is setup to share /home you’ll need to edit permissions on /home so users can access their home folders, its also worth noting that in order for those home folders to be created you may need to su to them so the home folder is created or have another way to automatically create their home folders with the correct permissions.

chown root:adgroupyoumade@yourdomain.tld /home

This next part I feel could be tightened up permissions wise, in ubuntu the default permission for home is 755, in CentOS it seems to be 700 by default.

chmod 775 /home

After configuring my CentOS install and setting up samba to share out home folders this way my permissions look like

drwxrwxr-x.   6 root domain users@mydomain.com  177 Oct 11 14:33 home
drwx------   3 austin.janey@mydomain.com   domain users@mydomain.com   215 Oct 11 17:05 austin.janey@mydomain.com

If your concerned about the file permissions on a root directory being messed with its likely you have bigger issues. Since what samba is sharing is only modifiable by the owner this seems ok to me, this is not a server out on the internet it should be behind a firewall and being accessed by your users via a VPN or over the internal LAN. As such we are not hardening this server its in a trusted zone and if we really want to protect access we should do that with something like ZeroTier One.

All thats left to do is test, from your ssh session as root on your CentOS7 server log in as an ad user, this will create a home folder for them.

su someadname@yourdomain.tld

Then try and hit that smb share over the network if all went well you should see a home folder named the full AD username your domain and all, youll be able to see other network home folders as well but not access them, samba wont let you (which is perfect)

Something I’v not yet figured out is how to stop someone who’s authenticated from being able to write anything to the /home folder, I suspect that it has something to do with chmod 775 /home

This guide is my notes with some modifications that worked for me in my environment to get things working for me I found the guide at hexblot very helpful and some of the commands are direct copy and paste from their guide the credit for this post goes to them. http://www.hexblot.com/blog/centos-7-active-directory-and-samba

Backing up User Homes on Windows with Powershell

If you want to backup an entire windows system Veeam Endpoint free is your best friend, but if you want to Backup only the users actual data (their home folder) your options are a bit more limited there are lots of programs that do this but sometimes installing yet another program on a computer to do something seemingly small as this just seems redundant, for things like that scripts are awesome.

I wrote a quick script that works for me to do this, Robocopy is a great built in tool for windows that allows you to generate a report of what successfully copied.  The way I’v used it is to make a copy of a users home folder and copy it to an external source that that user has access to.  This script does not require admin rights and runs as the user which allows it to be run as a startup script and is super versatile.

### Azulpine User Home Folder Backup Script
### Changes in this version: target of backups was changed so that the backups now point to the users home directory
### Created by Austin Janey on 6/13/17
### This script is designed to backup the users home folder on logon and send the logs of the backup job to the backup location's log folder.

### Creating the file in the users shared folder so that we have a place to dump the log files
mkdir \\someDFSnamespaceorserver.com\DATA\U\$env:UserName\Backup
mkdir \\someDFSnamespaceorserver.com\DATA\U\$env:UserName\Backup\logs

### Editing this determines what is backed up
robocopy "C:\Users\$env:UserName" "\\somedfsnamespaceorserver.com\DATA\U\$env:UserName\Backup" /E /XA:SH /XD /log:\\someDFSnamespaceorserver.com\DATA\U\$env:UserName\Backup\logs\newlogfile.txt "Appdata" "My Music" "PrintHood" "MY Pictures" "My Documents" "Recent" "Searches" "Saved Games" "Templates" "SendTo" "NetHood" "Local Settings" "My Videos" "Cookies" "Application Data" "Dropbox" "Start Menu" /XF /R:1 /W:5 *.pst *.vir *.js *.jar *.jse *.lnk *.LOG1 *.exe *.msi *.DAT

### Timestamps the log file produced by robocopy by renaming it with the timestamp
Rename-Item \\someDFSnamespaceorserver.com\DATA\U\$env:UserName\Backup\logs\newlogfile.txt "$env:UserName-$((get-date).toString('backup_dd-MM-yyyy')).txt"

### moves the log to the logs folder in the U drive
Move-Item \\someDFSnamespaceorserver.com\DATA\U\$env:UserName\Backup\logs\"$env:UserName-$((get-date).toString('backup_dd-MM-yyyy')).txt" \\someDFSnamespaceorserver.com\DATA\U\logs

Hashing Files

File hashes are awesome,

A hash is a one way algorithm that when data is put into spits out changed data.

Hash rules…
1. Hashes are one way, you cant feasibly take a hash and convert it back into what it was before it got hashed.
2. A hash will always give you the same length of characters as a result if you hash a 1TB file with MD5 it will spit out 32 characters, if you hash a single letter string it will still give you 32 characters.
3. Hashes are not fool proof, it is possible that 2 files could have the same hash but it is extremely unlikely.
4. Changing any part of a file will result in a completely different file hash, if you change 1 byte of a 1PB file it will give you a completely different set of 32 characters.

So with that being said hashing a file is a great way to…
– figure out if the file you downloaded is identical the file the server on the other end of the connection was trying to send you.
– find out if a file has changed over time (assuming that you had a hash of it).

getting a hash, There are lots of different types of hashes one can get, MD5 is very common for file verification and although one could argue that its not cryptographically strong as it once was forging a file to get an identical hash is still beyond the capabilities of anyone on earth.

Some of the tools hosted here and on other sites have hashes those hashes may be MD5 or SHA1 by confirming the hash after downloading the file you can be reasonably certain that you have a bit for bit copy of the original which can help diagnose issues with installers or verify the security of the linux ISO you downloaded, keep in mind if a site is compromised that the attacker could easily upload his own file and hash in which case the hash would match the new malicious file.  It is best to google the hash string after hashing the file to see if any mirrors or other people have gotten it before you. somebody may have found that a certain hash is malicious.  In some cases verifying the hash of the file over time is useful and if your lucky the wayback machine can help with that.

Powershell: Get-FileHash pathtofile -Algorithm MD5

Screen Shot 2017-04-27 at 10.08.45 AM.png

Bash: MD5 pathtofile

Screen Shot 2017-04-27 at 10.14.36 AM.png

Creating a Windows 10 bootable VHDX

So Windows 10 is kind of a disaster we have known that for some time, This is a guide to make windows 10 a little bit less of a disaster by enabling your windows 10 system to boot directly from a VHDX file doing so has the fallowing advantages. Or in short it lets you make an easily transportable windows 10 image

– you get to have windows 10 in a file, easy to back up or transport to another machine.
– might make imaging systems very easy
– allows you to do seemingly risky things in windows without fear of totally bricking your OS
– would allow you to have different bootable windows files for different people or rather for different uses

disadvantages
– may not be stable, its designed for developers Microsoft recommends not using this in production.
– you wont be able to use bitlocker

So with that out of the way heres how this works

You’ll need a windows 10 iso, mount it and extract the sources file to your desktop

use the windows disk management utilities to create a blank VHDX
Note: microsoft seems to recommend making your VHDX file a static not dynamic vhdx file, I have run into some trouble booting in to dynamic files with errors about there not being enough drive space, consider yourself warned.
– initialize the vhdx file format as gpt and ntfs name it whatever you would like.
– mount your new vhdx file

open a admin powershell to the sources directory

dism /apply-image /imagefile:install.esd /index:1 /ApplyDir:vhdxdriveletter:\

Wait for windows to write all the files to the VHDX…

once thats done all that needs to be done is to add the VHDX to the boot record like so

bcdboot driveletterofmountedvhdx:\Windows

Reboot and your good to go just select your vhdx on boot, worth noting that you can edit the description of the VHDX file using this little gem the visual bccd editor