<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ref="http://purl.org/rss/1.0/modules/reference/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns="http://purl.org/rss/1.0/">
	<channel rdf:about="https://cyberbyte.ch/blog/rss.rdf">
		<title>Sysadmin Blog</title>
		<link>https://cyberbyte.ch/blog/index.php</link>
		<description><![CDATA[Copyright Cyberbyte Networks]]></description>
		<items>
			<rdf:Seq>
				<rdf:li resource="https://cyberbyte.ch/blog/index.php?entry=entry240414-122546" />
				<rdf:li resource="https://cyberbyte.ch/blog/index.php?entry=entry220211-124756" />
				<rdf:li resource="https://cyberbyte.ch/blog/index.php?entry=entry220115-142316" />
				<rdf:li resource="https://cyberbyte.ch/blog/index.php?entry=entry211212-141439" />
				<rdf:li resource="https://cyberbyte.ch/blog/index.php?entry=entry181010-125639" />
				<rdf:li resource="https://cyberbyte.ch/blog/index.php?entry=entry180514-020007" />
				<rdf:li resource="https://cyberbyte.ch/blog/index.php?entry=entry170505-152715" />
				<rdf:li resource="https://cyberbyte.ch/blog/index.php?entry=entry150924-190707" />
				<rdf:li resource="https://cyberbyte.ch/blog/index.php?entry=entry141016-102212" />
				<rdf:li resource="https://cyberbyte.ch/blog/index.php?entry=entry140604-182616" />
			</rdf:Seq>
		</items>
	</channel>
	<item rdf:about="https://cyberbyte.ch/blog/index.php?entry=entry240414-122546">
		<title>How to remove Private Key Password from pkcs12 container?</title>
		<link>https://cyberbyte.ch/blog/index.php?entry=entry240414-122546</link>
		<description><![CDATA[- Export to temporary pem file<br /><pre>openssl pkcs12 -in protected.p12 -nodes -out temp.pem<br />#  -&gt; Enter password<br /></pre><br /><br />- Convert pem back to p12<br /><pre>openssl pkcs12 -export -in temp.pem  -out unprotected.p12<br /># -&gt; Just press [return] twice for no password<br /></pre><br /><br />- Remove temporary certificate<br /><pre>rm temp.pem<br /></pre><br />]]></description>
	</item>
	<item rdf:about="https://cyberbyte.ch/blog/index.php?entry=entry220211-124756">
		<title>How do I verify that a private key matches a certificate?</title>
		<link>https://cyberbyte.ch/blog/index.php?entry=entry220211-124756</link>
		<description><![CDATA[To verify that an RSA private key matches the RSA public key in a certificate you need to i) verify the consistency of the private key and ii) compare the modulus of the public key in the certificate against the modulus of the private key.<br /><br />To verify the consistency of the RSA private key:<br /><pre>openssl rsa -check -noout -in myserver.key<br />RSA Key is ok</pre><br />If it doesn&#039;t say &#039;RSA key ok&#039;, it isn&#039;t OK!&quot;<br /><br />To view its modulus:<br /><pre>openssl rsa -modulus -noout -in myserver.key | openssl md5</pre><br />To view the modulus of the RSA public key in a certificate:<br /><pre>openssl x509 -modulus -noout -in myserver.crt | openssl md5</pre><br />If the first commands shows any errors, or if the modulus of the public key in the certificate and the modulus of the private key do not exactly match, then you&#039;re not using the correct private key.]]></description>
	</item>
	<item rdf:about="https://cyberbyte.ch/blog/index.php?entry=entry220115-142316">
		<title>Check CRL for revoked certificates and valitity of CRL itself</title>
		<link>https://cyberbyte.ch/blog/index.php?entry=entry220115-142316</link>
		<description><![CDATA[To find out if a client certificate was rejected or if the Certificate Revocation List itself is still valid (not older than &quot;Next Update&quot; attribute defined):<br /><pre>openssl crl -inform DER -text -noout -in mycrl.crl</pre><br />Most CRLs are DER encoded, but you can use -inform PEM if your CRL is not binary. If you’re unsure if it is DER or PEM open it with a text editor. If you see —–BEGIN X509 CRL—– then it’s PEM and if you see strange binary-looking garbage characters it’s DER.]]></description>
	</item>
	<item rdf:about="https://cyberbyte.ch/blog/index.php?entry=entry211212-141439">
		<title>i-mscp certbot fix</title>
		<link>https://cyberbyte.ch/blog/index.php?entry=entry211212-141439</link>
		<description><![CDATA[The current let&#039;s encrypt plugin won&#039;t work any more, it throws an error about expired certificate when verifing after issuance, and removes SSL/TLS encryption for the site. This is caused because one of the LE root certificates has been expired.<br /><br />So I searched for a quick fix so that newly issued certificates will work again, and have written a small patch for the certbot client you can find <a href="http://www.cyberbyte.ch/Linux/certbot_fix_chain.tar.gz" >here</a>. This will remove the expired root CA cert within the certificate chain, resulting in verification done by i-mscp won&#039;t fail any more.]]></description>
	</item>
	<item rdf:about="https://cyberbyte.ch/blog/index.php?entry=entry181010-125639">
		<title>SELinux Survival Guide</title>
		<link>https://cyberbyte.ch/blog/index.php?entry=entry181010-125639</link>
		<description><![CDATA[On SELinux enabled systems (default on CentosOS/RHEL 6.x and higher), it may deny access when system utilities are called from a daemon&#039;s context used for automation or monitoring purposes.<br /><br />You will see some deny messages within <em>/var/log/audit.log</em> that indicate SELinux is blocking access.<br /><br />So follow this procedure for simply allow things denied by SELinux policies:<br /><br /><h2>Build SELinux Policy</h2><br />1. Set concerning context to permissive (will still log whitn audit.log:<br /><pre>semanage permissive -a zabbix_agent_t</pre>2. Allow logging even rules are set to <em>dontaudit</em>:<br /><pre>semodule -DB</pre>3. Now let the programme or script do its intended job.<br /><br /><strong>Important:</strong> If the programme is doing things that wouldn&#039;t be done at every run, like caching (e.g. yum), try to clean programme&#039;s cache before running so you catch everything it may do!<br /><br />4. Search for log entries and build a policy module &amp; package out of it, analysis beginning from date today&quot; (and optionally a time spec):<br /><pre>ausearch -r -m avc -ts today [HH:MM] | audit2allow -M zabbix_megacli<br /></pre><br />5. Import policy package:<br /><pre>semodule -i zabbix_megacli.pp</pre><br />6. Disable permissive mode for context again:<br /><pre>semanage permissive -d zabbix_agent_t</pre><br />7. Disable logging of rules defined as <em>dontaudit</em>:<br /><pre>semodule -B</pre><br />8. Test if intended stuff works now!<br /><br /><h2>Adjust policy</h2><br />When you still see some single denials within <em>audit.log</em>, and quickly what to complete the policy with the rules seen, you may:<br /><br />1. Edit zabbix_megacli.te and add missing operations like write, lock, etc. to the allow rules - don&#039;t forget to also specify those ops within concerning class!<br /><br />2. Compile  module file:<br /><pre>checkmodule -M -m -o zabbix_megacli.mod zabbix_megacli.te<br /></pre>3. (Re-)create the module package from module file:<br /><pre>semodule_package -o zabbix_megacli.pp -m zabbix_megacli.mod</pre><br />For more info, see here:<br /><a href="https://www.centos.org/docs/5/html/Deployment_Guide-en-US/sec-sel-building-policy-module.html" >https://www.centos.org/docs/5/html/Deployment_Guide-en-US/sec-sel-building-policy-module.html</a><br />3. Import policy package:<br /><pre>semodule -i zabbix_megacli.pp</pre><br /><br /><h2>Apply Policy to other hosts </h2><br />1. Copy the policy package (&lt;policy&gt;.pp) to the host you want to apply policy<br /><br />2. Run the following command on every machine to load the package:<br /><pre>semodule -i zabbix_megacli.pp</pre>]]></description>
	</item>
	<item rdf:about="https://cyberbyte.ch/blog/index.php?entry=entry180514-020007">
		<title>Windows always fails on installing monthly security rollup update</title>
		<link>https://cyberbyte.ch/blog/index.php?entry=entry180514-020007</link>
		<description><![CDATA[When trying to install Windows security rollup update on computer with dual boot, Windows Update always fails. <br /><br /><h2>Symptom</h2><br />During shutdown, Windows starts preparing the update and during the next boot, it continues until around 80-100%. Then it fails, rolls back the upgrade and reboots again. After that, the update is still listed for installation and shows as failed attempt in the update log with error code 80004005.<br /><br /><h2>Solution</h2><br /><h3>1. Get Windows to boot using its native boot loader</h3><br />Windows will then boot the active partition from MBR, temporarily <strong>remove</strong> the boot loader!. So make sure that partition where Windows is installed is the active partition (e.g. using Disk Management)!<br /><br />Start Ubuntu (either installed one or from a USB Stick) and run following commands:<br /><pre>sudo apt-get install mbr<br />sudo install-mbr -i n -p D -t 0 /dev/sdX<br /></pre>(replace sdX with the disk where Windows is installed!)<br /><br /><strong>Attention:</strong> This makes your linux installation unbootable if you run mbr command on the disk you normally boot Linux from, so ensure:<br />- you have a current backup of your value data<br />- have a USB stick at hand with Ubuntu ISO Image<br /><br />If you have installed Windows on an other (second) harddisk, also go to BIOS Setup and change boot order so the disk containing Windows is in first order (before the one containing Linux).<br /><br /><h3>2. Install Security Rollup Update</h3><br />On subsequent reboots, your computer will now boot directly into Windows (without showing GRUB menu anymore). <br /><br />Start Security Rollup Update again:<br />* Go to Windows Update (Control Panel -&gt; Sytem and Security -&gt; Windows Update)<br />* Choose &quot;Check for updates&quot;<br />* Make sure Security Rollup is selected<br />* Choose &quot;Install Updates&quot;<br /><br />This time, after 2-3 reboots, update should succeed.<br /><br /><h3>3. Make Linux bootable again</h3><br />a) When changed boot order to start Windows directly from another disk, go to BIOS Setup again and switch order back, so the harddisk with GRUB installed will be ordered <strong>before</strong> the HD containing Windows installation.<br /><br />b) When installed &quot;original&quot; MBR to the disk where GRUB was installed,  you have to repair the Linux Bootloader:<br />* boot using a USB Stick containing e.g. Ubuntu Linux ISO image<br />* mount your root and boot Linux partitions, e.g.<br /><pre>mkdir -p /mnt/root &amp;&amp; mount /dev/sda6 /mnt/root &amp;&amp; mount /dev/sda5 /mnt/root/boot</pre>(replace with device where your linux partitions resides, if in doubt, first run fdisk -l /dev/sda)<br /><br />* chroot your Linux installation:<br /><pre>chroot /mnt/root /bin/bash</pre>* install grub again to Master Boot Record, e.g.<br /><pre>grub-install /dev/sda</pre>(grub configuration should be available on /boot)<br /><br />* Exit chroot environment<br /><pre>exit</pre>* Unmount Linux partitions:<br /><pre>umount /mnt/root/boot /mnt/root</pre>* reboot your system<br /><br />You now should see GRUB boot menu again, where you can boot either Linux or Windows...<br />]]></description>
	</item>
	<item rdf:about="https://cyberbyte.ch/blog/index.php?entry=entry170505-152715">
		<title>Reverse Proxy mit HTTP Auth im Backend</title>
		<link>https://cyberbyte.ch/blog/index.php?entry=entry170505-152715</link>
		<description><![CDATA[Damit man über einen Reverse-Proxy auf einen Web-Server zugreifen kann, welcher seinerseits wieder mit HTTP Basic Authentifizierung geschützt ist (und im Backend andere Login-Informationen als für die Anmeldung am Reverse Proxy erforderlich sind), muss die HTTP-Authentifizierung für den Backend-Server im Proxy-Abschnitt mitgegeben werden.<br /><br />Dazu muss zuerst Benutzername und Passwort in eine Base64-Zeichenkette encodiert werden:<br /><pre>echo -n &quot;User:Pass&quot; | base64<br />VXNlcjpQYXNz<br /></pre>(auch wenn kein Benutzername benutzt wird, muss das Doppelpunkt im zu encodierenden String enthalten sein!)<br /><br />Danach in der Konfiguration des als Reverse-Proxy verwendeten Frontend-Servers folgendes z.B. in einen Location-Abschnitt hinzufügen.<br /><br />Apache:<br /><pre>RequestHeader set Authorization &quot;Basic VXNlcjpQYXNz&quot;</pre><br />Nginx:<br /><pre>proxy_set_header Authorization &quot;Basic VXNlcjpQYXNz&quot;;</pre><br /><br /><strong>Technischer Hintergrund:</strong><br /><br />Sofern dieselben Anmelde-Informationen im Backend verwendet werden  wie im Frontend (Reverse-Proxy), sollte dieses bei der nachfolgenden HTTP-Auth Anfrage transparent vom Client Web-Browser weitergereicht werden, und obiger Parameter ist nicht notwendig.<br /><br />Wird hingegen versucht, sich mit unterschiedlichen HTTP-Auth Passwörter anzumelden (zuerst dasjenige für den Reverse-Proxy, dann dasjenige, welches der Backend-Webserver verlangt), ist darauf sofort die Anmeldung am Proxy nicht mehr gültig -&gt; Ein Zugriff würde so also nie funktionieren!]]></description>
	</item>
	<item rdf:about="https://cyberbyte.ch/blog/index.php?entry=entry150924-190707">
		<title>Test SMTP Auth</title>
		<link>https://cyberbyte.ch/blog/index.php?entry=entry150924-190707</link>
		<description><![CDATA[Sometimes, you need to test SMTP auth (for sending e-mails) is working properly and you don&#039;t want (or can&#039;t) test with an ordinary email client.<br /><br />One can test using a telnet session. But first, you must encode username and password using this command snipplet:<br /><pre>echo -en &quot;testlogin&quot; | openssl enc -base64<br />dGVzdGxvZ2lu<br />echo -en &quot;testpass&quot; | openssl enc -base64<br />dGVzdHBhc3M=</pre><br />Then:<br /><pre>telnet &lt;your_server_address&gt; 25 (or 587)<br /></pre><br />Now you do the same as an e-mail client:<br /><pre>HELO mybox.mydomain.tld<br />250 host.domain.tld<br />AUTH LOGIN<br />334 VXNlcm5hbWU6<br />dGVzdGxvZ2lu<br />334 UGFzc3dvcmQ6<br />dGVzdHBhc3M=<br />235 2.7.0 Authentication successful<br />quit<br />221 2.0.0 Bye</pre><br />If something with &quot;Authentication successful&quot; appears, login was able to authenticate against the mail server for sending e-mail.<br /><br />REMARK: There are some other sites with examples in perl that don&#039;t work with full e-mail address usernames (user@domain.tld) because of lack of escaping the &quot;@&quot; sign that designates a perl array.]]></description>
	</item>
	<item rdf:about="https://cyberbyte.ch/blog/index.php?entry=entry141016-102212">
		<title>Turning SSLv3 off on Apache Server to mitigate &quot;POODLE&quot; attack (CVE-2014-3566)</title>
		<link>https://cyberbyte.ch/blog/index.php?entry=entry141016-102212</link>
		<description><![CDATA[Add the following to your SSL configuration section:<br /><pre><br />   # Disable SSLv2 &amp; SSLv3 against POODLE issue (CVE-2014-3566)<br />    SSLProtocol All -SSLv2 -SSLv3<br /></pre><br />Note to insert this to <strong>all</strong> VirtualHost sections where SSL is enabled!<br /><br />Check your config:<br /><pre>apachectl configtest<br /></pre><br />Then restart apache server:<br /><pre>sudo service apache2 restart<br /></pre><br />To check if SSLv3 is turned off:<br /><pre>openssl s_client -connect <a href="http://www.ownspace.ch:443" >server.domain.tld:443</a> -ssl3<br /></pre><br />Then you shold see a message like this:<br /><pre>error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure:s3_pkt.c:1260:SSL alert number 40<br /></pre><br />To disable SSLv3 within other services:<br /><a href="http://askubuntu.com/questions/537196/how-do-i-patch-workaround-sslv3-poodle-vulnerability-cve-2014-3566" >see this post</a>]]></description>
	</item>
	<item rdf:about="https://cyberbyte.ch/blog/index.php?entry=entry140604-182616">
		<title>Check certificate on a server</title>
		<link>https://cyberbyte.ch/blog/index.php?entry=entry140604-182616</link>
		<description><![CDATA[Issue the following command:<br /><pre>openssl s_client -CApath /etc/ssl/certs/ -connect &lt;host.domian.tld&gt;:993</pre><br />For testing on a mail server supporting both non-encrypted and encrypted (TLS) connections using STARTTLS method:<br /><pre>openssl s_client -CApath /etc/ssl/certs/ -starttls smtp -connect &lt;host.domian.tld&gt;:25</pre><br /><br />There should be stated quite at end of command output:<br /><pre>    Verify return code: 0 (ok)</pre><br />before an eventual greeting message of the server.<br /><br />A bit above, you can check the certificate chain completeness:<br /><pre>Certificate chain<br /> 0 s:/description=3UwjnK9kRZ2wUo8e/C=CH/CN=domain1.ownspace.ch/emailAddress=hostmaster@ownspace.ch<br />   i:/C=IL/O=StartCom Ltd./OU=Secure Digital Certificate Signing/CN=StartCom Class 1 Primary Intermediate Server CA<br /> 1 s:/C=IL/O=StartCom Ltd./OU=Secure Digital Certificate Signing/CN=StartCom Class 1 Primary Intermediate Server CA<br />   i:/C=IL/O=StartCom Ltd./OU=Secure Digital Certificate Signing/CN=StartCom Certification Authority<br />---</pre><br />The last i(ssuer) is the root cert that most client will trust.]]></description>
	</item>
</rdf:RDF>
