Search This Blog

Showing posts with label CentOS. Show all posts
Showing posts with label CentOS. Show all posts

Friday, September 06, 2019

Copy files around in CentOS with SELinux (e.g. Nginx)

Imagine that you want to enable https traffic on a site served by Nginx. Sounds simple. A series of command like these should work:

scp example.com.* your_remote_server:
ssh your_remote_server
sudo mkdir /etc/nginx/ssl
sudo cp example.com.* /etc/nginx/ssl

Edit appropriate configuration file(s). Finally, run:

sudo systemctl restart nginx

and nothing, or rather an error message with information that nginx cannot access ssl certificate files. You check and files exists, so what's the problem?

The problem is a SELinux security context, diffrent for /etc/ngnix and /home/X

To change it you need to run chcon. For example:

chcon --reference /etc/nginx/nginx.conf /etc/nginx/ssl/example.com.*

More info at: https://www.cyberciti.biz/faq/rhel-centos-feora-linux-change-copy-selinux-context/

Thursday, August 21, 2014

(w)dstat

wdstat

In my .profile (on CentOS 5, just in case there were some changes in dstat) I have following alias to dstat (wdstat stands for Wawrzek's dstat):

alias wdstat="dstat -lcpymsgdn 5"

Where the options stands for:
  • -l  - UNIX load (1m   5m  15m) load average in 1, 5 and 15 minutes, respectively;
  • -c - cpu stats (usr sys idl wai hiq siq) percent of time spent in user and system space, idle, waiting on resource,  serving interrupts and softirqs (software interrupts);
  • -p - process stats (run blk new) number of running, blocked and newly created processes;
  • -y - system stats (int   csw) - number of interrupts and context switches;
  • -m - memory stats (used  buff  cach  free) amount of memory used by processes, disk buffers, disk cache and free;
  • -s - swap stats (used  free) - amount of used and free swap space;
  • -g - page stats (in   out) number of page put in and out from swap;
  • -d -disk stats (read  writ) - number of reads and writes from all disks;
  • -n -network stats (recv  send) number of received and send network packages;

Further reading:

Saturday, May 25, 2013

CPU affinity, interrupts and old kernel bug

This is an old story and AFAIK were address ages ago in Linux kernel, but there are still plenty of CentOS/RHEL 5 running and you still might be hit by the problem with kernel not properly balancing interrupts from hardware, so the that below list of the links my be helpful. In bug report network card are mentioned, but it might affect other components (i.e. raid controllers from HP - cciss drivers).

If you would like to learn more there is a set of good links:

  1. https://bugzilla.redhat.com/show_bug.cgi?id=432451
  2. http://docs.oracle.com/cd/E24290_01/coh.371/e22838/tune_perftune.htm
  3. http://www.alexonlinux.com/smp-affinity-and-proper-interrupt-handling-in-linux
  4. http://www.alexonlinux.com/msi-x-the-right-way-to-spread-interrupt-load
  5. http://www.alexonlinux.com/why-interrupt-affinity-with-multiple-cores-is-not-such-a-good-thing