SELinux Survival Guide 
Wednesday, 10 October 2018, 12:56 - Linux Stuff, RedHat Stuff
Posted by Administrator
On SELinux enabled systems (default on CentosOS/RHEL 6.x and higher), it may deny access when system utilities are called from a daemon's context used for automation or monitoring purposes.

You will see some deny messages within /var/log/audit.log that indicate SELinux is blocking access.

So follow this procedure for simply allow things denied by SELinux policies:

Build SELinux Policy

1. Set concerning context to permissive (will still log whitn audit.log:
semanage permissive -a zabbix_agent_t
2. Allow logging even rules are set to dontaudit:
semodule -DB
3. Now let the programme or script do its intended job.

Important: If the programme is doing things that wouldn't be done at every run, like caching (e.g. yum), try to clean programme's cache before running so you catch everything it may do!

4. Search for log entries and build a policy module & package out of it, analysis beginning from date today" (and optionally a time spec):
ausearch -r -m avc -ts today [HH:MM] | audit2allow -M zabbix_megacli

5. Import policy package:
semodule -i zabbix_megacli.pp

6. Disable permissive mode for context again:
semanage permissive -d zabbix_agent_t

7. Disable logging of rules defined as dontaudit:
semodule -B

8. Test if intended stuff works now!

Adjust policy

When you still see some single denials within audit.log, and quickly what to complete the policy with the rules seen, you may:

1. Edit zabbix_megacli.te and add missing operations like write, lock, etc. to the allow rules - don't forget to also specify those ops within concerning class!

2. Compile module file:
checkmodule -M -m -o zabbix_megacli.mod zabbix_megacli.te
3. (Re-)create the module package from module file:
semodule_package -o zabbix_megacli.pp -m zabbix_megacli.mod

For more info, see here:
3. Import policy package:
semodule -i zabbix_megacli.pp

Apply Policy to other hosts

1. Copy the policy package (<policy>.pp) to the host you want to apply policy

2. Run the following command on every machine to load the package:
semodule -i zabbix_megacli.pp

add comment ( 556 views )   |  permalink   |  related link   |  $star_image$star_image$star_image$star_image$star_image ( 3.1 / 255 )
Windows always fails on installing monthly security rollup update 
Monday, 14 May 2018, 02:00 - Windows Stuff, Linux Stuff
Posted by Administrator
When trying to install Windows security rollup update on computer with dual boot, Windows Update always fails.


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.


1. Get Windows to boot using its native boot loader

Windows will then boot the active partition from MBR, temporarily remove the boot loader!. So make sure that partition where Windows is installed is the active partition (e.g. using Disk Management)!

Start Ubuntu (either installed one or from a USB Stick) and run following commands:
sudo apt-get install mbr
sudo install-mbr -i n -p D -t 0 /dev/sdX
(replace sdX with the disk where Windows is installed!)

Attention: This makes your linux installation unbootable if you run mbr command on the disk you normally boot Linux from, so ensure:
- you have a current backup of your value data
- have a USB stick at hand with Ubuntu ISO Image

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).

2. Install Security Rollup Update

On subsequent reboots, your computer will now boot directly into Windows (without showing GRUB menu anymore).

Start Security Rollup Update again:
* Go to Windows Update (Control Panel -> Sytem and Security -> Windows Update)
* Choose "Check for updates"
* Make sure Security Rollup is selected
* Choose "Install Updates"

This time, after 2-3 reboots, update should succeed.

3. Make Linux bootable again

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 before the HD containing Windows installation.

b) When installed "original" MBR to the disk where GRUB was installed, you have to repair the Linux Bootloader:
* boot using a USB Stick containing e.g. Ubuntu Linux ISO image
* mount your root and boot Linux partitions, e.g.
mkdir -p /mnt/root && mount /dev/sda6 /mnt/root && mount /dev/sda5 /mnt/root/boot
(replace with device where your linux partitions resides, if in doubt, first run fdisk -l /dev/sda)

* chroot your Linux installation:
chroot /mnt/root /bin/bash
* install grub again to Master Boot Record, e.g.
grub-install /dev/sda
(grub configuration should be available on /boot)

* Exit chroot environment
* Unmount Linux partitions:
umount /mnt/root/boot /mnt/root
* reboot your system

You now should see GRUB boot menu again, where you can boot either Linux or Windows...

add comment ( 670 views )   |  permalink   |  related link   |  $star_image$star_image$star_image$star_image$star_image ( 3 / 239 )
Reverse Proxy mit HTTP Auth im Backend 
Friday, 5 May 2017, 15:27 - General, Knowledge, Apache Stuff, Linux Stuff, Nginx
Posted by Administrator
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.

Dazu muss zuerst Benutzername und Passwort in eine Base64-Zeichenkette encodiert werden:
echo -n "User:Pass" | base64
(auch wenn kein Benutzername benutzt wird, muss das Doppelpunkt im zu encodierenden String enthalten sein!)

Danach in der Konfiguration des als Reverse-Proxy verwendeten Frontend-Servers folgendes z.B. in einen Location-Abschnitt hinzufügen.

RequestHeader set Authorization "Basic VXNlcjpQYXNz"

proxy_set_header Authorization "Basic VXNlcjpQYXNz";

Technischer Hintergrund:

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.

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 -> Ein Zugriff würde so also nie funktionieren!
add comment ( 916 views )   |  permalink   |  $star_image$star_image$star_image$star_image$star_image ( 3 / 1533 )
Test SMTP Auth 
Thursday, 24 September 2015, 19:07 - Mail stuff
Posted by Administrator
Sometimes, you need to test SMTP auth (for sending e-mails) is working properly and you don't want (or can't) test with an ordinary email client.

One can test using a telnet session. But first, you must encode username and password using this command snipplet:
echo -en "testlogin" | openssl enc -base64
echo -en "testpass" | openssl enc -base64

telnet <your_server_address> 25 (or 587)

Now you do the same as an e-mail client:
HELO mybox.mydomain.tld
250 host.domain.tld
334 VXNlcm5hbWU6
334 UGFzc3dvcmQ6
235 2.7.0 Authentication successful
221 2.0.0 Bye

If something with "Authentication successful" appears, login was able to authenticate against the mail server for sending e-mail.

REMARK: There are some other sites with examples in perl that don't work with full e-mail address usernames (user@domain.tld) because of lack of escaping the "@" sign that designates a perl array.
add comment ( 990 views )   |  permalink   |  $star_image$star_image$star_image$star_image$star_image ( 3 / 245 )
Turning SSLv3 off on Apache Server to mitigate "POODLE" attack (CVE-2014-3566) 
Thursday, 16 October 2014, 10:22 - Apache Stuff, OpenSSL
Posted by Administrator
Add the following to your SSL configuration section:

# Disable SSLv2 & SSLv3 against POODLE issue (CVE-2014-3566)
SSLProtocol All -SSLv2 -SSLv3

Note to insert this to all VirtualHost sections where SSL is enabled!

Check your config:
apachectl configtest

Then restart apache server:
sudo service apache2 restart

To check if SSLv3 is turned off:
openssl s_client -connect server.domain.tld:443 -ssl3

Then you shold see a message like this:
error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure:s3_pkt.c:1260:SSL alert number 40

To disable SSLv3 within other services:
see this post
add comment ( 1480 views )   |  permalink   |  related link   |  $star_image$star_image$star_image$star_image$star_image ( 3 / 2430 )

| 1 | 2 | 3 | 4 | 5 | 6 | Next> Last>>