You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

495 lines
19 KiB

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>Hagfi.sh</title>
<link>https://hagfi.sh/index.xml</link>
<description>Recent content on Hagfi.sh</description>
<generator>Hugo -- gohugo.io</generator>
<language>en-us</language>
<lastBuildDate>Sat, 25 Aug 2018 22:08:15 +0200</lastBuildDate>
<atom:link href="https://hagfi.sh/index.xml" rel="self" type="application/rss+xml" />
<item>
<title>Let&#39;s Encrypt</title>
<link>https://hagfi.sh/administration/letsencrypt/</link>
<pubDate>Sat, 25 Aug 2018 22:08:15 +0200</pubDate>
<guid>https://hagfi.sh/administration/letsencrypt/</guid>
<description>
&lt;h2 id=&#34;let-s-encrypt&#34;&gt;Let&amp;rsquo;s Encrypt:&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Aanmaken / vernieuwen certificaat:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;/opt/letsencrypt/letsencrypt-auto certonly
--expand
---email support@nucleus.be
--agree-tos
--webroot
-w /var/www/vhosts/WEB/ROOT
-d domain.tld
-d domainalias.tld
--dry-run
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code&gt;/bin/certbot
--text
--agree-tos
--non-interactive
certonly
-a webroot
--webroot-path /var/www/vhosts/WEB/ROOT
-d domain.tld
-d domainalias.tld
--dry-run
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;code&gt;--dry-run&lt;/code&gt; om het aanmaken te testen.&lt;/p&gt;
&lt;h3 id=&#34;apache-httpd&#34;&gt;Apache / httpd&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;(1) Voeg volgende regels toe aan de apache config:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;Alias /.well-known /var/www/vhosts/letsencrypt/.well-known
&amp;lt;Directory /var/www/vhosts/letsencrypt/.well-known&amp;gt;
order allow,deny
allow from all
satisfy any
&amp;lt;/Directory&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;Of (2) voeg volgende regels toe aan .htaccess:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;IfModule mod_rewrite.c&amp;gt;
RewriteEngine on
#Allow Let&#39;s Encrypt SSL renewal
RewriteRule ^.well-known/ - [L,NC]
RewriteCond %{REQUEST_URI} !^/.well-known/acme-challenge/
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R=301,L]
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;Combineer Basic Auth met Let&amp;rsquo;s Encrypt:&lt;br /&gt;
&lt;em&gt;Dit moet je bekijken ale een if/else. (Ofwel valid-user ofwel REQUEST_URI)&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt; &amp;lt;Directory /var/www/vhosts/WEB/ROOT&amp;gt;
AuthType Basic
AuthName protected
AuthUserFile /etc/httpd/passwd/phpmyadmin.htpasswd
require valid-user
Require expr %{REQUEST_URI} =~ m#^/.well-known/acme-challenge/.*#
&amp;lt;/Directory&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;nginx&#34;&gt;Nginx&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Voeg volgende regels toe aan Nginx&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt; location /.well-known {
root /var/www/vhosts/WEB/ROOT;
index index.html index.htm index.php;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;-&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Controleer DNS lijst domeinen:&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;while read LINE;
do
echo $LINE &amp;gt;&amp;gt; list_processed.txt &amp;amp;&amp;amp; dig +short @9.9.9.9 $LINE &amp;gt;&amp;gt; list_processed.txt;
done &amp;lt; list.txt
&lt;/code&gt;&lt;/pre&gt;
&lt;ul&gt;
&lt;li&gt;(WIP)
&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;pre&gt;&lt;code&gt;#!/bin/bash
#IP=&amp;lt;%= @default_ipadress %&amp;gt;
IP=$(dig +short @9.9.9.9 $(hostname))
FILE=$1
while read LINE
do
CHK=$(dig +short @9.9.9.9 $LINE)
if $IP -eq $CHK
echo &amp;quot;$LINE|$CHK&amp;quot; &amp;gt;&amp;gt; /tmp/le-ok
elif
echo &amp;quot;$LINE|$CHK&amp;quot; &amp;gt;&amp;gt; /tmp/le-nok
fi
done &amp;lt; $FILE
echo &amp;quot;Domains OK:&amp;quot;
echo /tmp/le-ok | column
echo &amp;quot;-------------------------------&amp;quot;
echo &amp;quot;Domains NOT OK:&amp;quot;
echo /tmp/le-nok | column
rm -rf /tmp/le-ok
rm -rf /tmp/le-nok
&lt;/code&gt;&lt;/pre&gt;
</description>
</item>
<item>
<title>MySQL Tuner</title>
<link>https://hagfi.sh/administration/mysql_tuner/</link>
<pubDate>Sat, 25 Aug 2018 22:08:15 +0200</pubDate>
<guid>https://hagfi.sh/administration/mysql_tuner/</guid>
<description>
&lt;h2 id=&#34;mysql-tuner&#34;&gt;MySQL Tuner&lt;/h2&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;WAARDE&lt;/th&gt;
&lt;th&gt;ACTIE&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;query_cache_size&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;AFBLIJVEN&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;table_cache&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;AFBLIJVEN &lt;em&gt;(maximumwaarde = 64)&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;table_open_cache&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;AFBLIJVEN&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;join_buffer_size&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Verhogen indien &lt;code&gt;Joins performed without indexes++&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;tmp_table_size&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Verhogen = &lt;code&gt;max_heap_table_size&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;max_heap_table_size&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Verhogen &lt;code&gt;= tmp_table_size&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;query_cache_type&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;=1&lt;/code&gt; indien &lt;code&gt;=0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;blockquote&gt;
&lt;p&gt;mysql tuning improvements
&lt;code&gt;table_cache&lt;/code&gt; NOOIT hoger dan 64
Sudo vim /etc/my.cnf
query_cache_size&amp;rsquo; =&amp;gt; &amp;lsquo;256M’,
It caches the select query along with the result set, which enables the identical selects to execute faster as the data fetches from the in memory.
Caching voor select queries en bijhorende result sets, wat het mogelijk maakt om identieke selects sneller op te vragen uit memory.
&amp;lsquo;open_files_limit&amp;rsquo; =&amp;gt; &amp;lsquo;4096&amp;rsquo;,
Changes the number of file descriptors available to mysqld. You should try increasing the value of this option if mysqld gives you the error Too many open files.
&amp;lsquo;join_buffer_size&amp;rsquo; =&amp;gt; &amp;lsquo;256K’,
The minimum size of the buffer that is used for plain index scans, range index scans, and joins that do not use indexes and thus perform full table scans. Normally, the best way to get fast joins is to add indexes. Increase the value of join_buffer_size to get a faster full join when adding indexes is not possible.
Minimumgrootte van buffer voor index en table scans.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr /&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;lsquo;max_heap_table_size&amp;rsquo; =&amp;gt; &amp;lsquo;32M’,
This variable sets the maximum size to which user-created MEMORY tables are permitted to grow.
Max grootte van user-created memory tables
These 2 need to be the same size!!!
&amp;lsquo;tmp_table_size&amp;rsquo; =&amp;gt; &amp;lsquo;32M’,
The maximum size of internal in-memory temporary tables.
Max grootte van interne in-memory tijdelijke tabellen&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr /&gt;
&lt;blockquote&gt;
&lt;p&gt;table_cache=64 (maximumwaarde!!)
Table_Cache should always - well mostly anyway - be significantly bigger than the total number of tables in the server. Otherwise it&amp;rsquo;ll keep opening and closing tables.
Maximumwaarde voor caching van geopende tabellen.
thread_cache_size=4
How many threads the server should cache for reuse.
Aantal threads dat de server kan cachen voor hergebruik.
&amp;lsquo;innodb_buffer_pool_size&amp;rsquo; =&amp;gt; &amp;lsquo;1G&amp;rsquo;,
The size in bytes of the buffer pool, the memory area where InnoDB caches table and index data. The default value is 128MB.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Sudo service mysql/mariadb reload (restart enkel onder toezicht)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;query_cache_*&lt;/code&gt;:&lt;/li&gt;
&lt;/ul&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;query_cache_type&lt;/code&gt;&lt;br /&gt;
Needs to be set to 1 to enable caching.&lt;br /&gt;
&lt;code&gt;query_cache_size&lt;/code&gt;&lt;br /&gt;
Is the size of the cache. This can be in bytes, or you can use a M suffix to specify the amount of megabytes.&lt;br /&gt;
&lt;code&gt;query_cache_limit&lt;/code&gt;&lt;br /&gt;
Is the maximum size of an individually cached query. Queries over this size won’t go into the cache. This is also in bytes, or megabytes with the M suffix. 1MB is a safe bet.&lt;br /&gt;
Maximumgrootte voor elke individuele gecachte query. Queries groter dan dit zullen niet gecacht worden.&lt;br /&gt;
&lt;code&gt;table_open_cache&lt;/code&gt;&lt;br /&gt;
Indicates the maximum number of tables the server keeps open&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;code&gt;innodb_buffer_pool_instances=2&lt;/code&gt;&lt;br /&gt;
&lt;em&gt;Enables the use of multiple threads for innodb.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;query_cache_type=1&lt;/code&gt;&lt;br /&gt;
&lt;em&gt;Enables query caching.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;join_buffer_size=1024K&lt;/code&gt;&lt;br /&gt;
&lt;em&gt;Increased the buffer size for non-indexed joins.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;tmp_table_size=64M &amp;amp;&amp;amp; max_heap_table_size=64M&lt;/code&gt;&lt;br /&gt;
&lt;em&gt;Increased the size for temporary tables.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;join_buffer_size&lt;/code&gt;&lt;br /&gt;
&lt;em&gt;Omwille van het aantal JOIN queries uitgevoerd zonder indexes, werd de minimumgrootte van de buffer voor index en table scans verhoogd.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;max_heap_table_size &amp;amp; tmp_table_size&lt;/code&gt;&lt;br /&gt;
&lt;em&gt;De maximale grootte van user-created memory tables en van interne in-memory tijdelijke tabellen werd verhoogd.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;thread_cache_size&lt;/code&gt;&lt;br /&gt;
&lt;em&gt;Het maximale aantal threads dat de server kan cachen voor hergebruik werd verhoogd.&lt;/em&gt;&lt;/p&gt;
</description>
</item>
<item>
<title>Windows troubleshooting</title>
<link>https://hagfi.sh/administration/windows_troubleshooting/</link>
<pubDate>Sat, 25 Aug 2018 22:08:15 +0200</pubDate>
<guid>https://hagfi.sh/administration/windows_troubleshooting/</guid>
<description>
&lt;h2 id=&#34;windows-troubleshooting&#34;&gt;Windows troubleshooting&lt;/h2&gt;
&lt;p&gt;VRAGEN:
+ openen vanuit ticketing, wachtwoord en gebruiker
+ custom even viewer view?
+ test server?&lt;/p&gt;
&lt;h3 id=&#34;eventviewer&#34;&gt;&lt;em&gt;EventViewer&lt;/em&gt;&lt;/h3&gt;
&lt;p&gt;run: eventvwr&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;custom views&lt;/li&gt;
&lt;li&gt;windows
&lt;ul&gt;
&lt;li&gt;application (non windows standard, puppet, vmware, mssql, &amp;hellip;)&lt;/li&gt;
&lt;li&gt;security, aan en afmelden&lt;/li&gt;
&lt;li&gt;set-up: updates en installatie verwijderen programma&amp;rsquo;s&lt;/li&gt;
&lt;li&gt;system: OS meldingen&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;application and services: diep graven
&lt;br /&gt;
&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;ndash;&amp;gt; Filter Log:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;logged (date range)&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;event level&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;event source&lt;br /&gt;&lt;/li&gt;
&lt;li&gt;event ID: 99,-1024,-4634&lt;br /&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;rechtsonderaan &amp;gt; event copy &amp;gt; copy as text&lt;/p&gt;
&lt;h3 id=&#34;powershell&#34;&gt;&lt;em&gt;PowerShell&lt;/em&gt;&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&#34;language-PowerShell&#34;&gt;$first =
$last =
get-eventlog -Logname system -
&lt;/code&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;code class=&#34;language-PowerShell&#34;&gt; `get-winevent -LogName &#39;Microsoft-Windows-TaskScheduler/Operational&#39; | Where-Object { $_.Message -like ‘*insta* }`
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&#34;task-viewer&#34;&gt;&lt;em&gt;Task Viewer&lt;/em&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;tasks&lt;/li&gt;
&lt;li&gt;users&lt;/li&gt;
&lt;li&gt;performance (indien gecrasht, bevestigen anders is het netwerk)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;resource-monitor&#34;&gt;&lt;em&gt;Resource monitor&lt;/em&gt;&lt;/h3&gt;
&lt;p&gt;(task manager &amp;gt; performance &amp;gt; open resouce monitor)&lt;/p&gt;
&lt;p&gt;Overview &amp;gt; CPU (ovenste tab) app aanvinken &amp;ndash;&amp;gt; filtert alles&lt;/p&gt;
&lt;h3 id=&#34;netstat&#34;&gt;&lt;em&gt;Netstat&lt;/em&gt;&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;netstat -abo &amp;gt; C:\temp\log.txt&lt;/code&gt;&lt;/p&gt;
&lt;h3 id=&#34;chocolate&#34;&gt;&lt;em&gt;Chocolate&lt;/em&gt;&lt;/h3&gt;
&lt;p&gt;C:\ProgramData\chocolatey\bin\Procmon.exe
&amp;ndash;&amp;gt; selecteer lijn+kolom &amp;gt; exclude &amp;lsquo;name&amp;rsquo; (=grep -v) / include &amp;lsquo;name&amp;rsquo; (=grep)&lt;/p&gt;
&lt;h3 id=&#34;usefull-programs&#34;&gt;&lt;em&gt;Usefull programs&lt;/em&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;TreeView&lt;/li&gt;
&lt;li&gt;VBluescreenviewer&lt;/li&gt;
&lt;li&gt;Sysinternals&lt;/li&gt;
&lt;li&gt;Zabbix&lt;/li&gt;
&lt;li&gt;VMware events&lt;/li&gt;
&lt;li&gt;BareTail&lt;/li&gt;
&lt;li&gt;choco install&lt;/li&gt;
&lt;li&gt;choco list -lo (view choco installed programs)&lt;/li&gt;
&lt;li&gt;telnet 12.34.56.78 900&lt;/li&gt;
&lt;li&gt;powershell: &lt;code&gt;stop service &#39;name&#39;&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;eventid-s&#34;&gt;&lt;em&gt;EventID&amp;rsquo;s&lt;/em&gt;&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Event ID 6005: “The event log service was started.” This is synonymous to system startup.&lt;/li&gt;
&lt;li&gt;Event ID 6006: “The event log service was stopped.” This is synonymous to system shutdown.&lt;/li&gt;
&lt;li&gt;Event ID 6008: &amp;ldquo;The previous system shutdown was unexpected.&amp;rdquo; Records that the system started after it was not shut down properly.&lt;/li&gt;
&lt;li&gt;Event ID 6009: Indicates the Windows product name, version, build number, service pack number, and operating system type detected at boot time.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Event ID 6013: Displays the uptime of the computer. There is no TechNet page for this id.
Add to that a couple more from the Server Fault answers listed in my OP:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Event ID 1074: &amp;ldquo;The process X has initiated the restart / shutdown of computer on behalf of user Y for the following reason: Z.&amp;rdquo; Indicates that an application or a user initiated a restart or shutdown.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Event ID 1076: &amp;ldquo;The reason supplied by user X for the last unexpected shutdown of this computer is: Y.&amp;rdquo; Records when the first user with shutdown privileges logs on to the computer after an unexpected restart or shutdown and supplies a reason for the occurrence.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&#34;powershell-1&#34;&gt;&lt;em&gt;PowerShell&lt;/em&gt;&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&#34;language-PowerShell&#34;&gt;$filter = &amp;quot;*abbix*&amp;quot;
get-winevent -logname &#39;Application&#39; | Where-Object { $_.Message -like $filter }
&lt;/code&gt;&lt;/pre&gt;
</description>
</item>
<item>
<title>Dont Let Your Application Interfere With Letsencrypt</title>
<link>https://hagfi.sh/administration/dont-let-your-application-interfere-with-letsencrypt/</link>
<pubDate>Thu, 23 Aug 2018 22:46:41 +0200</pubDate>
<guid>https://hagfi.sh/administration/dont-let-your-application-interfere-with-letsencrypt/</guid>
<description>
&lt;h2 id=&#34;tips-and-tricks-to-keep-letsencrypt-working&#34;&gt;Tips and tricks to keep letsencrypt working&lt;/h2&gt;
</description>
</item>
<item>
<title>Vue Js</title>
<link>https://hagfi.sh/development/vue-js/</link>
<pubDate>Thu, 23 Aug 2018 22:44:46 +0200</pubDate>
<guid>https://hagfi.sh/development/vue-js/</guid>
<description>
&lt;h2 id=&#34;awesomeness-about-vuejs&#34;&gt;Awesomeness about VueJS&lt;/h2&gt;
</description>
</item>
<item>
<title>Luks Encryption</title>
<link>https://hagfi.sh/administration/luks-encryption/</link>
<pubDate>Thu, 23 Aug 2018 22:08:15 +0200</pubDate>
<guid>https://hagfi.sh/administration/luks-encryption/</guid>
<description>
&lt;h2 id=&#34;add-a-new-disk-lvm&#34;&gt;Add a new disk (LVM)&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;root@server:/dev/centos # for i in /sys/class/scsi_host/host*; do echo &amp;quot;- - -&amp;quot; &amp;gt; $i/scan; done
root@server:/dev/centos # NEWDISK=$(dmesg|tail|grep &#39;Attached&#39;|awk &#39;{print $4}&#39;|tail -n1|cut -d &amp;quot;[&amp;quot; -f2|cut -d &amp;quot;]&amp;quot; -f1)
root@server:/dev/centos # VGROUP=$(vgdisplay|grep Name|head -n1|awk &#39;{print $3}&#39;)
root@server:/dev/centos # echo ${NEWDISK}
sdd
root@server:/dev/centos # echo ${VGROUP}
centos
root@server:/dev/centos # pvcreate /dev/${NEWDISK}
Physical volume &amp;quot;/dev/sdd&amp;quot; successfully created.
root@server:/dev/centos # vgextend ${VGROUP} /dev/${NEWDISK}
Volume group &amp;quot;centos&amp;quot; successfully extended
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;create-a-logical-volume-lvm&#34;&gt;Create a logical volume (LVM)&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;root@server:/dev/centos # lvcreate -L 15G -n encrypted centos
Logical volume &amp;quot;encrypted&amp;quot; created.
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;encrypt-the-partition&#34;&gt;Encrypt the partition&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;root@server:/dev/centos # cryptsetup -v --verify-passphrase luksFormat /dev/centos/encrypted
root@server:/dev/mapper # cryptsetup luksOpen /dev/centos/encrypted luks-encrypted
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;create-a-mountpoint&#34;&gt;Create a mountpoint&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;root@server:/dev/mapper # mkdir /encrypted
root@server:/dev/mapper # mount /dev/mapper/luks-encrypted /encrypted
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;create-a-key-to-auto-mount-the-encrypted-disk&#34;&gt;Create a key (to auto-mount the encrypted disk)&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;root@server:/dev/mapper # dd if=/dev/urandom of=/root/lukskey bs=1024 count=4
root@server:/dev/mapper # chmod 0400 /root/lukskey
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;unmount-and-add-the-key&#34;&gt;Unmount and add the key&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;root@server:/ # umount /encrypted
root@server:/ # cryptsetup luksClose luks-encrypted
root@server:/ # cryptsetup luksAddKey /dev/mapper/centos-encrypted /root/lukskey
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;get-uuid&#34;&gt;Get UUID&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;root@server:/ # blkid /dev/mapper/centos-encrypted
/dev/mapper/centos-encrypted: UUID=&amp;quot;0dab9a5c-1870-478d-8d74-226eeb512f78&amp;quot; TYPE=&amp;quot;crypto_LUKS&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id=&#34;auto-mount-luks-edit-etc-cypttab&#34;&gt;Auto-mount LUKS (edit /etc/cypttab)&lt;/h2&gt;
&lt;pre&gt;&lt;code&gt;luks-encrypted /dev/disk/by-uuid/0dab9a5c-1870-478d-8d74-226eeb512f78 /root/lukskey luks
&lt;/code&gt;&lt;/pre&gt;
</description>
</item>
</channel>
</rss>