Wednesday, September 11, 2019

Bareos Client Configuration

Bareos has changed the structure of the configuration files allowing for different sections of the configuration to be isolated in their own files. This improves readability and allows for third-party applications to be written to edit the Bareos configuration. 
If you are new to Bareos or Bareos installation, read the introduction in this article to get more information.
The new way to configure a client is done at the Bareos Client and the Bareos Server. Please take note which host is the following command is executed on.
To create and configure a new Baresos Client,  follow the steps below
1.       Generate a password and copy it somewhere
# < /dev/urandom tr -dc A-Za-z0-9 | head -c32; echo
8wstlW1xkTQmmt1mLdbKjIWSuoSy1F69
2.       Log into the Bareos Server
3.       execute the Bareos Console
# bconsole
4.       Create the client configuration. In this example the client name is prod-server and the IP address is 192.168.0.2. Replace it with the correct IP address and add the password generated above
* configure add client name=prod-server address=192.168.0.2 password=8wstlW1xkTQmmt1mLdbKjIWSuoSy1F69
A sample output is below
*configure add client name=prod-server address=192.168.0.2 password=8wstlW1xkTQmmt1mLdbKjIWSuoSy1F69
Exported resource file "/etc/bareos/bareos-dir-export/client/prod-server/bareos-fd.d/director/bareos-dir.conf":
Director {
 Name = bareos-dir
 Password = "[md5]f7180d44d3cad452f611e2dfdfd3b007"
}
Created resource config file "/etc/bareos/bareos-dir.d/client/prod-server.conf":
Client {
 Name = prod-server
 Address = 192.168.0.2
 Password = 8wstlW1xkTQmmt1mLdbKjIWSuoSy1F69
}
*exit
5.       Restart Bareos Director
# systemctl restart bareos-dir
# systemctl status bareos-dir

The configuration information for the bareos client is the Resource Config File. This must be copied to the Bareos client host in the following steps.

A. On the Bareos server:
The Bareos Client requires information from the Bareos server. The information is in the resource file created when the client configuration was created on the Bareos Server.
Install the configuration for the bareos client using the commands below to copy the configuration file to the bareos client (e.g. prod-server with the IP address 192.168.0.2). On the Bareos Server, from the prompt

# scp /etc/bareos/bareos-dir-export/client/prod-server/bareos-fd.d/director/bareos-dir.conf root@192.168.0.2:/etc/bareos/bareos-fd.d/director/

B. On the Bareos Client
Log into the Bareos Client host (where the Bareos Client is installed), in this example, prod-server (IP 192.168.0.2).
1.       Edit the client configuration file
# cd /etc/bareos/bareos-fd.d/client
# vi myself.conf

2.       Change the Name from localhost to prod-server
Client {
      Name = localhost-fd prod-server
      Maximum Concurrent Jobs = 20

3.       Save the file and test whether this configuration is correct
# bareos-fd –t
The configuration is correct if there are no error messages.

4.       Apply the new configuration by restarting the client.
# systemctl restart bareos-fd
This can be verified with the command 
# systemctl status bareos-fd
Look for the line beginning with " Active " which should say " active (running) ".

Verify on the Bareos server:

# bconsole
* status  client=prod-server
Connecting to Client coders at 192.168.0.2:9102
prod-server Version: 17.2.4 (21 Sep 2017)  x86_64-redhat-linux-gnu redhat CentOS Linux release 7.4.1708 (Core)
Daemon started 09-Jan-19 18:24. Jobs: run=204 running=0.
 Heap: heap=36,864 smbytes=37,990 max_bytes=2,220,893 bufs=227 max_bufs=386
 Sizeof: boffset_t=8 size_t=8 debug=0 trace=0 bwlimit=0kB/s

Wednesday, August 14, 2019

Remove Boxes in Docx files after editing in Google Docs

Google recently introduced improved editing of DOCX or Microsoft Word Document 2007 files. Previously DOCX documents could be edited but need to be saved as Google Doc files or later exported to another format.If it did open DOCX files, the level of compatibility would be roughly equivalent to Libre Office opening a DOCX file.
But recently Google has improved this and made it so that DOCX documents could be saved in the same format. This makes it possible to edit Word files on Android devices without having to use the Microsoft Word Android app. The Word app famously wanted an upgrade to Office365 before it could connect to Google drive in the past. It's possible now but it's a hit or miss affair. It was fine connecting to Dropbox or Box.com and doing it without the upgrade.
But this improvement hasn't been without a cost. DOCX documents saved in Google Docs end up with a Control Box around every paragraph. This first time it happened, it sucked out whatever joy there was of being able to save to DOCX in Google Docs. It was even quite clear what the box around the paragraph was.
But getting rid of it is simple. Select All text and using Ctrl-A.  Then Right-Click on the selected text and from the menu choose "Remove Content Control". The boxes should be removed.
This is a pain when editing and sharing DOCX over Google Drive with someone who is using Microsoft Word to edit the file.
Google Docs get updated from time to time without much fanfare. Hope this will be fixed soon.
 

Wednesday, July 3, 2019

Configure iscsi quickly on CentOS 7

If you have a Network Attached Storage (NAS), the best way to connect it to other servers is using the iSCSI method. Most companies use a NAS to store files and have employees connect to it directly to share files. But that method is not suitable to connect to other servers. This can be done when disk space on the a server runs low. Some setup on the NAS is needed to setup iSCSI on the NAS. Basically, an iSCSI LUN is created and then connected to a newly created or existing iSCSI target (aka iSCSI server). Refer to the NAS's configuration manual for detail.
Before we configure a Linux server to connect to a NAS over iSCSI, some information is needed first. This will help us when it is needed in the setup process.
First note the IP address of the NAS. Second, well need to know the iSCSI Target Name. This identifies the disk assigned to be used. If everything has ben setup properly, an ISCSI LUN would have been created and assigned to an ISCSI Target. Finally, the mount point for the disk needs to be known, too. This is the directory where the applications on the Linux server writes files to.

First install the necessary software components. At the command line

sudo yum install iscsi-initiator-utils

This will install the iSCSI initiator aka client files. Edit the file /etc/iscsi/initiatorname.iscsi and
add the line below if it isn't already there

InitiatorName=iqn.2014-08.com.example:client

This is the name of the initiator or client. In the example above, it is  'iqn.2014-08.com.example:client' 

Note: if an access control list (ACL) was set in the NAS, set ACL on target (iSCSI server) to match this client name. This will allow the client to connect to the iSCSI server.
Now start the iSCSI system

# systemctl start iscsi

Next, discover the targets available on the NAS. In the example below the NAS IP address is 192.168.1.25

# iscsiadm -m discovery -t st -p 192.168.1.25
192.168.1.25:3260,0 iqn.2000-01.com.synology:backupecc
192.168.1.25:3260,0 iqn.2000-01.com.synology:diskstation.target-1.d87a5fcd9b
192.168.1.25:3260,0 iqn.2000-01.com.synology:diskstation.target-11.d87a5fcd9

Look at the list and see whether the iSCSI target assigned is in the list. If it is, it's time to connect to it.  Set the iSCSI server to start automatically every time the server starts. Then restart it.

# systemctl enable iscsid.service
# systemctl restart iscsid.service

Add the target to our initiator (or connect our client to the target/ iSCSI server).The format of the command is

iscsiadm -m node -T <discovered target iqd> -p <ip of target> -l

So the execute the command using the information gathered

# iscsiadm -m node -T iqn.2000-01.com.synology:diskstation.target-11.d87a5fcd9b -p 192.168.1.25 -l
Logging in to [iface: default, target: iqn.2000-01.com.synology:diskstation.target-11.d87a5fcd9b, portal: 192.168.1.25,3260] (multiple)
Login to [iface: default, target: iqn.2000-01.com.synology:diskstation.target-11.d87a5fcd9b, portal: 192.168.1.25,3260] successful.

Look for the device name created from the command above.

# lsblk --scsi
NAME HCTL       TYPE VENDOR   MODEL             REV TRAN
sda  2:0:0:0    disk SYNOLOGY iSCSI Storage    3.1  iscsi
sr0  0:0:1:0    rom  QEMU     QEMU DVD-ROM     1.5. ata


In the above example, the device name is /dev/sda .

Confirm that it is not connected in READONLY mode. The RO column should be 0

# lsblk | egrep "NAME|sda"
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    0  500G  0 disk


Connecting to the iSCSI target is like opening the server case and installing and connecting a new hard disk. Since the disk is connected, the disk has to be prepared. First, format the disk

# mkfs.ext4 /dev/sda
<output truncated>
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done


or a better option would be

# mkfs.xfs /dev/sda
<output truncated>
log      =internal log           bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0


Mount it to the mount point created or the directory where the system will store the files to the iSCSI disk to. In this example the mount point is /mnt/disk

# mount /dev/sda /mnt/disk

If everything is successful thus far, make it permanent by doing the following
1. Find UUID
2. insert into /etc/fstab

Finding the  UUID
# blkid /dev/sdb
/dev/sda: UUID="3d86fad7-1896-4538-acae-e78269b3a6a7" TYPE="ext4"

Make note of the UUID value. Edit /etc/fstab

# vi /etc/fstab

add the following line

UUID=3d86fad7-1896-4538-acae-e78269b3a6a7 /mnt              ext4           _netdev         0 0
                               

The format of the line is
<UUID>  <mount point> <what filesystem was created on it (ext4/xfs)> _netdev <this option waits for the network to start before connecting to the iSCSI disk> 0 0
The next time the Linux server restarts, it will connect to the new iSCI disk automatically. Test the disk anyway.

# mount /mnt/disk
# touch /mnt/disk/TestFile

The command above creates empty file called TestFile. If there are no errors in creating the file, the setup is complete. For more information, execute this command

# iscsiadm -m session -P 3

References
https://www.itzgeek.com/how-tos/linux/centos-how-tos/configure-iscsi-target-initiator-on-centos-7-rhel7.html
https://www2.linuxacademy.com/howtoguides/21208-how-to-share-your-storage-with-iscsi/
https://www.certdepot.net/rhel7-configure-iscsi-target-initiator-persistently/
https://www.thegeekdiary.com/complete-guide-to-configuring-iscsi-in-centos-rhel-7/