Wednesday, November 29, 2017

Error Description: 13801: IKE authentication credentials are unacceptable

Tried to connect Windows 7 client to the pfSense® with IKEv2 and native Windows IPSec VPN client. Everything was setup using IKEv2_with_EAP-MSCHAPv2 and every-time trying to connect I got "Error Description: 13801: IKE authentication credentials are unacceptable". After searching and troubleshooting it turned out that importing CA cert to the Windows 7 client PC must be done only via mmc console otherwise certificate is shown as installed but nothing works as expected.
PS to install CA certificates use this link: Import_Root_Cert_mmc

Friday, November 24, 2017

MySQL OUTFILE & INFILE

To write dump into file (by default this file will go to the /var/lib/mysql/DBNAME/test.sql). I use NULL for id column's values because it's AUTOINCREMENT and will be generated automatically (otherwise if I dump actual value duplicate values will be created):
SELECT
 NULL,time,callid,queuename,agent,event,data1,data2,data3,data4,data5
INTO OUTFILE 'test.sql'
FIELDS TERMINATED BY ','
OPTIONALLY
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
FROM
queue_log;

Files content is something like:
cat test.sql
\N,"2014-10-28 17:45:19.924148","NONE","NONE","NONE","QUEUESTART","","","","",""

To merge this file into an existent table:
LOAD DATA INFILE 'test.sql'
INTO TABLE queue_log
FIELDS TERMINATED BY ','
OPTIONALLY
ENCLOSED BY '"'
LINES TERMINATED BY '\n';

Monday, November 20, 2017

Accessing CentOS 7 via RDP 

Install needed packages:
$ yum install epel-release
$ yum install xrdp tigervnc-server tigervnc-server-module

Change SELinux context for xrdp:
$ chcon -t bin_t /usr/sbin/xrdp
$ chcon -t bin_t /usr/sbin/xrdp-sesman

Open rdp port in firewall:
$ firewall-cmd --zone=public --add-port=3389/tcp --permanent
$ firewall-cmd --zone=public --add-port=3389/udp --permanent
$ firewall-cmd --reload

Enable and start xrdp service:
$ systemctl enable xrdp
$ systemctl start xrdp

Modify GNOME Display Manager custom:
$ vi /etc/gdm/custom.conf
[security]
AllowRemoteRoot=true
DisallowTCP=false
[xdmcp]
Enable=true

Wednesday, November 8, 2017

Can't remove final physical volume  from volume group (Linux)

I have:
[root@localhost ~]# vgs
  VG       #PV #LV #SN Attr   VSize   VFree 
  VolGroup   1   0   0 wz--n- 279.36g 279.36g
  centos     1   3   0 wz--n-  <3.64t   3.04t
[root@localhost ~]# pvs
  PV         VG       Fmt  Attr PSize   PFree 
  /dev/sda3  centos   lvm2 a--   <3.64t   3.04t
  /dev/sdb1  VolGroup lvm2 a--  279.36g 279.36g
 and want to remove VolGroup and add /dev/sdb1 into centos VG:
[root@localhost ~]# pvremove /dev/sdb1
  PV /dev/sdb1 is used by VG VolGroup so please use vgreduce first.
  (If you are certain you need pvremove, then confirm by using --force twice.)
  /dev/sdb1: physical volume label not removed.
[root@localhost ~]# vgreduce VolGroup /dev/sdb1
  Can't remove final physical volume "/dev/sdb1" from volume group "VolGroup"

To overcome that issue we'll first inactivate "VolGroup" and then remove that VG:
[root@localhost ~]# vgchange -an VolGroup
  0 logical volume(s) in volume group "VolGroup" now active
[root@localhost ~]# vgremove VolGroup
  Volume group "VolGroup" successfully removed 

Verifying and adding PV to a VG:
[root@localhost ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  centos   1   3   0 wz--n- <3.64t 3.04t
[root@localhost ~]# pvs
  PV         VG     Fmt  Attr PSize   PFree 
  /dev/sda3  centos lvm2 a--   <3.64t   3.04t
  /dev/sdb1         lvm2 ---  279.36g 279.36g
[root@localhost ~]# vgextend centos /dev/sdb1
  Volume group "centos" successfully extended
[root@localhost ~]# vgs
  VG     #PV #LV #SN Attr   VSize VFree
  centos   2   3   0 wz--n- 3.91t 3.31t
[root@localhost ~]# pvs
  PV         VG     Fmt  Attr PSize   PFree 
  /dev/sda3  centos lvm2 a--   <3.64t   3.04t
  /dev/sdb1  centos lvm2 a--  279.36g 279.36g