This article is about how to Install and Configure Active Directory Federation Services Windows 2016.
Now that we have Active Directory Install, we need to install ADFS so that we can login to the AWS console.
Linux, Windows, Software Tips, Articles and Hacks
This post will walk you through the setup of Active Directory Federation Services (ADFS) on Windows Server 2016 and configuring it to be your credentials for AWS.
Spin up a VM with Windows Server 2016.
After the install, Configure Networking.
Are you having trouble accessing your Windows Server 2012 machine using remote desktop, even after adding the user to the Remote Desktop Users group? Remote Desktop appears to accept the login credentials but then you receive the following error message:
“To sign in remotely, you need the right to sign in through Remote Desktop Services. By default members of the Administrators group have this right. If the group you’re in does not have the right, or if the right has been removed from the Administrators group, you need to be granted the right manually.”
With Server 2012 it seems that you now also need to grant the user remote access privileges though the Local Security Policy as well as the Remote Desktop Users group.
To grant this access, search for and open the Local Security Policy program.
Expand Local Policies and select User Rights Assignment. A list of polices will appear on the right hand side. Right click on the policy named “Allow log on through Remote Desktop Services” and select Properties.
You will now have the option to add users or groups to the policy.
Test the login…
Since i am logging into a domain as a domain user, I received the following error:
Login to the Computer as Administrator (not the domain controller or AD server).
Got to Start > Right Click on “This PC. Go to Remote Settings.
Go to Select users.
Click Add.
Type part of the name. In this example, lisa. Click “Check Names”. The name now appears as the domain username. Click OK and OK. Now login.
In checking Plesk Stats, the traffic is much lower that the actual traffic.
Plesk Web Stats button only links to now SSL traffic. See: https://support.plesk.com/hc/en-us/articles/213951505-Different-statistics-values-for-SSL-and-non-SSL-traffic
As a workaround, SSL traffic statistics can be accessed using the following link:
https://example.com/plesk-stat/webstat-ssl
FTP statistics can be accessed using the following link:
https://example.com/plesk-stat/ftpstat
https://example.co/plesk-stat/anon_ftpstat
In order to do private networking, ideally you would use Hyper-V virtual switches to bind an interface in each of the guest VM’s to the same logical switch. You can do so with any locally routed convention.
You can configure each VM to make use of an IP in the 192.168.0.x range such as:
VM1 192.168.0.10
VM2 192.168.0.11
VM3 192.168.0.12
If you leave 192.168.0.1 open it can be set as the gateway on the virtual switch for outbound traffic that would use Network Address Translation to a public IP bound to the primary network interface.
You can also use other private network allocations such as a 10. range of your choice with VM’s using 10.0.0.1, 10.0.0.2, etc. They would all be able to see and ping each other provided they are connected to the same Hyper-V virtual switch.
The specific steps tend to change with small updates over time but Microsoft has details on the setup available from documentation at:
https://social.technet.microsoft.com/wiki/contents/articles/3140.create-networks-with-vmm-2012.aspx and https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/quick-start/connect-to-network which is a general “Quick Start” for insight into the process.
If a single VM needs public access and local access it will need two interfaces. One will be bridged to the primary (public) interface on the physical host and the second can use the same local IP range as the other VM’s when connected to a local vSwitch.
Here it is:
https://support.google.com/mail/contact/msgdelivery
I recently moved a wordpress site to a different host and after all the files and database were updated kept getting the following error:
2018/01/31 12:10:11 [error] 1857#0: *165 FastCGI sent in stderr: "PHP message: PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0 PHP message: PHP Fatal error: Unknown: Failed opening required '/home/olddomain/public_html/wordfence-waf.php' (include_path='.:/usr/share/pear:/usr/share/php') in Unknown on line 0" while reading response header from upstream, client: 65.47.199.226, server: domain.com, request: "GET / HTTP/2.0", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm.sock:", host: "domain.com"
After reviewing the KB files here:
https://docs.wordfence.com/en/After_moving_a_site_or_deleting_some_files,_I_see:_PHP_Fatal_error:_Unknown:_Failed_opening_required_/var/www/html/wordfence-waf.php
https://docs.wordfence.com/en/Web_Application_Firewall_FAQ#How_can_I_remove_the_firewall_setup_manually.3F
I was able to modify the .user.ini file and the wordfence-waf.php file to set the correct path and all is well.
Here is the original /etc/my.cnf file for a default mariadb installation:
[mysqld] datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd [mysqld_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/mariadb.pid # # include all files from the config directory # !includedir /etc/my.cnf.d
Location of other .cnf files you can use:
/usr/share/mysql/my-huge.cnf /usr/share/mysql/my-innodb-heavy-4G.cnf /usr/share/mysql/my-large.cnf /usr/share/mysql/my-medium.cnf /usr/share/mysql/my-small.cnf
The basic formulas are:
Available RAM = Global Buffers + (Thread Buffers x max_connections)
max_connections = (Available RAM – Global Buffers) / Thread Buffers
To get the list of buffers and their values:
SHOW VARIABLES LIKE '%buffer%';
Here’s a list of the buffers and whether they’re Global or Thread:
Global Buffers: key_buffer_size, innodb_buffer_pool_size, innodb_log_buffer_size, innodb_additional_mem_pool_size, net_buffer_size, query_cache_size
Thread Buffers: sort_buffer_size, myisam_sort_buffer_size, read_buffer_size, join_buffer_size, read_rnd_buffer_size, thread_stack
MariaDB [(none)]> SHOW VARIABLES LIKE '%buffer%'; +---------------------------------------+-----------+ | Variable_name | Value | +---------------------------------------+-----------+ | aria_pagecache_buffer_size | 134217728 | | aria_sort_buffer_size | 134217728 | | bulk_insert_buffer_size | 8388608 | | innodb_blocking_buffer_pool_restore | OFF | | innodb_buffer_pool_instances | 1 | | innodb_buffer_pool_populate | OFF | | innodb_buffer_pool_restore_at_startup | 0 | | innodb_buffer_pool_shm_checksum | ON | | innodb_buffer_pool_shm_key | 0 | | innodb_buffer_pool_size | 134217728 | | innodb_change_buffering | all | | innodb_log_buffer_size | 8388608 | | join_buffer_size | 131072 | | join_buffer_space_limit | 2097152 | | key_buffer_size | 16777216 | | mrr_buffer_size | 262144 | | myisam_sort_buffer_size | 8388608 | | net_buffer_length | 8192 | | preload_buffer_size | 32768 | | read_buffer_size | 262144 | | read_rnd_buffer_size | 524288 | | sort_buffer_size | 524288 | | sql_buffer_result | OFF | +---------------------------------------+-----------+
Lets find out the RAM:
# free -b total used free shared buff/cache available Mem: 3975184384 978608128 1691045888 9445376 1305530368 2661937152
Lets get our data together.
RAM = 3975184384
Global Buffers: key_buffer_size, innodb_buffer_pool_size, innodb_log_buffer_size, innodb_additional_mem_pool_size, net_buffer_length, query_cache_size
or, from above…
Global Buffers: 16777216 + 134217728 + 8388608 + 0 + 8192 + 0 = 159391744
Thread Buffers: sort_buffer_size, myisam_sort_buffer_size, read_buffer_size, join_buffer_size, read_rnd_buffer_size, thread_stack
or, from above…
Thread Buffers: 524288 + 8388608 + 262144 + 131072 + 524288 + 0 = 9830400
With this information, the following is the calculation:
max_connections = (Available RAM – Global Buffers) / Thread Buffers
max_connections = (3975184384 – 159391744) / 9830400
So the formula shows 378 Max Connections on this machine
Test info with mysqltuner
Log into your server with a root or sudo user via SSH.
Download MySQLTuner by executing the following command:
wget -O mysqltuner.pl https://raw.githubusercontent.com/major/MySQLTuner-perl/master/mysqltuner.pl --no-check-certificate
Give the script 775 permissions:
chmod 775 mysqltuner.pl
Run the script with the following command:
perl mysqltuner.pl
Resources:
Handy Calculator Download: https://journeyontux.wordpress.com/2011/12/22/calculate-number-of-connections-for-mysql-server/
Another Calculator: http://www.mysqlcalculator.com/
Here is how to add a second disk to linux. In this article, the OS is CentOS 7.
Check to see how many drives are installed: You can do this using the df and fdisk command:
# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos_plesk-root 14G 3.9G 10G 29% / devtmpfs 910M 0 910M 0% /dev tmpfs 920M 4.0K 920M 1% /dev/shm tmpfs 920M 8.6M 912M 1% /run tmpfs 920M 0 920M 0% /sys/fs/cgroup /dev/sda1 497M 215M 282M 44% /boot tmpfs 184M 0 184M 0% /run/user/1000
The above information show the primary disk as sda.
Use fdisk to identify the second drive:
# fdisk -l Disk /dev/sda: 17.2 GB, 17179869184 bytes, 33554432 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000ab095 Device Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 33554431 16264192 8e Linux LVM Disk /dev/sdb: 17.2 GB, 17179869184 bytes, 33554432 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
The sdb drive is the second drive and it has no information on the mount points.
Now we can partition the drive. To partition the disk – /dev/sdb, enter:
# fdisk /dev/sdb
For help using the partitioner, use the “m” command:
Command (m for help): m Command action a toggle a bootable flag b edit bsd disklabel c toggle the dos compatibility flag d delete a partition l list known partition types m print this menu n add a new partition o create a new empty DOS partition table p print the partition table q quit without saving changes s create a new empty Sun disklabel t change a partition's system id u change display/entry units v verify the partition table w write table to disk and exit x extra functionality (experts only) Command (m for help):
partitions using the command “p”:
Command (m for help): p Disk /dev/sdb: 50.0 GB, 50019202560 bytes 255 heads, 63 sectors/track, 6081 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System Command (m for help):
To create a new partition, issue the command “n” and then select “p” for primary and 1-4 depending on which partition on the drive this is (first, second, third, or fourth):
n(creates a new partition)
p(creates a primary partition)
1(the number 1 denotes the partition will be /dev/sdb1)
Command (m for help): n Command action e extended p primary partition (1-4) p Partition number (1-4): 1 First cylinder (1-6081, default 1): 1 Last cylinder or +size or +sizeM or +sizeK (1-6081, default 6081): 6081
To save the partition, use the “w” command:
Command (m for help): w The partition table has been altered! Calling ioctl() to re-read partition table. Syncing disks.
Now we can check to see if the partition is there:
# fdisk -l Disk /dev/sda: 17.2 GB, 17179869184 bytes, 33554432 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x000ab095 Device Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 33554431 16264192 8e Linux LVM Disk /dev/sdb: 17.2 GB, 17179869184 bytes, 33554432 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x884e64a3 Device Boot Start End Blocks Id System /dev/sdb1 2048 33554431 16776192 83 Linux
Format the new disk using mkfs.ext3 command:
To format Linux partions using ext3fs on the new disk, issue the following command:
# mkfs.ext3 /dev/sdb1
To format Linux partions using ext4fs on the new disk, issue the following command:
# mkfs.ext4 /dev/sdb1
Output (for using ext4):
# mkfs.ext4 /dev/sdb1 mke2fs 1.42.9 (28-Dec-2013) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) Stride=0 blocks, Stripe width=0 blocks 1048576 inodes, 4194048 blocks 209702 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=2151677952 128 block groups 32768 blocks per group, 32768 fragments per group 8192 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 4096000 Allocating group tables: done Writing inode tables: done Creating journal (32768 blocks): done Writing superblocks and filesystem accounting information: done
Mount the new disk using the mount command. First, you’ll need to create a mount point. We’ll use /disk2. This is where we’ll mount /dev/sdb1. Enter the following commands:
# cd / # mkdir disk2 # mount /dev/sdb1 /disk2 # df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos_plesk-root 14G 3.9G 10G 29% / devtmpfs 910M 0 910M 0% /dev tmpfs 920M 4.0K 920M 1% /dev/shm tmpfs 920M 8.6M 912M 1% /run tmpfs 920M 0 920M 0% /sys/fs/cgroup /dev/sdb1 16G 47M 15G 1% /disk2 /dev/sda1 497M 215M 282M 44% /boot tmpfs 184M 0 184M 0% /run/user/0
Edit /etc/fstab so the new drive will automatically mount to /disk1 on reboot. Add the following:
/dev/sdb1 /disk2 ext4 defaults 0 0
# nano /etc/fstab # Created by anaconda on Wed Dec 6 19:53:05 2017 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/centos_plesk-root / xfs defaults 0 0 UUID=f9b133be-f059-45e2-a296-ccddb4cebe06 /boot xfs defaults 0 0 /dev/mapper/centos_plesk-swap swap swap defaults 0 0 /dev/sdb1 /disk2 ext4 defaults 0 0
Mount the disk
# mount -a