AIX

 View Only

AIX and TE (Trusted Execution): an underestimated security feature? Part 2

By Christian Sonnemans posted Thu February 22, 2024 10:36 AM

  

In this part I like to share some technical details and dive into some more details.

To understand more how it works first lets explain the most important stanza based database: tsd.dat

Explanation of the tsd.dat:

TSD stands for Trusted Signature Database and in this stanza based formatted file that exist locally on a AIX system or can exist on a remote Ldap server.

During the installation, the tsd.dat file is filled with every AIX executable / library / script that IBM has signed for the specified fileset that is installed. The same is done during upgrading to a TL or SP.

Note: for efixes (emergency fixes) this not NOT the case. I will explain how to deal with this a bit further for those file(sets).

For every stanza in this tsd.dat the command is trusted. See below part of the security documentation of AIX 7.3:

A trusted file is a file that is critical from the security perspective of the system, and if compromised,

can jeopardize the security of the entire system. Typically the files that match this description are the

following:

• Kernel (operating system)

• All setuid root programs

• All setgid root programs

• Any program that is exclusively run by the root user or by a member of the system group

• Any program that must be run by the administrator while on the trusted communication path (for

example, the ls command)

• The configuration files that control system operation

• Any program that is run with the privilege or access rights to alter the kernel or the system configuration

files

Every trusted file should ideally have an associated stanza or a file definition stored in the Trusted

Signature Database (TSD).

For the impatient people you can read this part later and skip to active / passive mode:

Example stanza of cfgmgr in the databasefile tsd.dat

 /usr/sbin/cfgmgr:

        owner = root

        group = system

        mode = TCB,SUID,550

        type = FILE

        hardlinks =

        symlinks =

        size = 64980

        cert_tag = 49424d4149583a30344232302d30334233303a324b3a41

        signature 4947a123bb0cb96b591074df5f7a6d97c9be0b3a00902d373516b299cfaef7b7f16625ad0c5c9fed445cf473b9bf1dfe8dc66f6a11d68749c7b0f4239e4a09a0d1ba005a552d64377816d0a641221bd6b9ce58ae7facf7eecbdac19c9

9371db3423fb294dbf1622d164699170a15db82a6d484aec71f85c4579eb79052e006a8eaa5fb8fa44f0b5a771d0abb65e51c49e79d3678a0b36222c9a54a6b88eb21a384ba09bf3307efec5f165d79c5dff3550b43163beae5bdfd9a7ba575f93136cb17e8232

7eb71cb169add8a7387febe299be4fc06485420b1fd1523969a5901fa97232cb053f93640a66bb925d06cb95c50361596d758074a83beb65d13fe4d8

        hash_value = c42915237644858ce913c9930ab7d30f2f918d5e0b6f38431f3e39819eda55ff

        minslabel =

        maxslabel =

        intlabel =

        accessauths = aix.device.config

        innateprivs = PV_AU_ADD,PV_AU_PROC,PV_DAC_R,PV_DAC_W,PV_DAC_X,PV_DAC_O,PV_DEV_CONFIG

        inheritprivs = PV_DAC_R,PV_DAC_W,PV_DAC_X,PV_DEV_CONFIG,PV_DEV_LOAD,PV_DEV_QUERY,PV_KER_VARS,PV_ROOT

        authprivs =

        secflags = FSF_EPS

        egid = 0

For this first part of TE, I will only explain a few of the fields in this example, which are important for TE, other fields are important for another security feature of AIX: advanced RBAC.

For a complete documentation and explanation of all fields please refer the link below:

https://www.ibm.com/docs/en/aix/7.3?topic=management-trusted-signature-database

See below the explanation for the stanza fields that are used for TE:

owner

Owner of the file. This value is computed by the trustchk command when the file is being added to TSD.

group

Group of the file. This value is computed by the trustchk command.

mode

Comma-separated list of values. The permissible values are SUID (SUID set bit), SGID (SGID set bit), SVTX (SVTX set bit), and TCB (Trusted Computing Base). The file permissions must be the last value and can be specified as an octal value. For example, for a file that is set with uid and has permission bits as rwxr-xr-x, the value for mode is SUID, 755. The value is computed by the trustchk command.

type

Type of the file. This value is computed by the trustchk command. The possible values are FILE, DIRECTORY, MPX_DEV, CHAR_DEV, BLK_DEV, and FIFO.

hardlinks

List of hardlinks to the file. This value cannot be computed by the trustchk command. It must be supplied by the user when adding a file to the database.

symlinks

List of symbolic links to the file. This value cannot be computed by the trustchk command. It must be supplied by the user when adding a file to the database.

size

Defines size of the file. The VOLATILE value means that the file gets changed frequently.

cert_tag

This field maps the digital signature of the file with the associated certificate that can be used to verify the signature of the file. This field stores the certificate ID and is computed by the trustchk command at the time of addition of the file to the TSD. The certificates are stored in /etc/security/certificates directory.

signature

Digital signature of the file. The VOLATILE value means that the file gets changed frequently. This field is computed by the trustchk command.

hash_value

Cryptographic hash of the file. The VOLATILE value means that the file gets changed frequently. This field is computed by the trustchk command.

Example of stanza /etc/security/tsd/lib/lib.tsd.dat

/usr/lib/libc.a/strcmp.o:

Type = OBJ

Size = 2345

Hash value

Signature =

Cert_tag =

Part of documentation that describes the lib.tsd.dat

In the /etc/security/tsd/tsd.dat file, the stanzas for the libraries are modified to reflect the type attribute as LIB and the size and signature attributes are empty. Currently the values for the dynamica attributes size, hash, signature are maintained as a VOLATILE value. Therefore, the library verification is skipped during system boot. Beginning with the release of AIX 6.1.0, the size, hash, and signature of the trusted library stanzas are computed with the .o files of a library. During installation, the tsd.dat database is populated to reflect the computed values and the corresponding .o file stanza for a trusted library is stored in the /etc/security/tsd/lib/lib.tsd.dat database.

Passive and Active mode of TE:

By default after installing AIX, TE is running in passive mode, and it will use the local stored tsd.dat file and no TE policy is enabled or defined, you can check this with the command trustchk -p

See picture below left scheme:

TE active passive

The TE passive form is always available and is a very good checkup for sanity your AIX system.

With this system integrity check you can always verify if your AIX binaries and Libraries are not tempered or corrupted, this with only one simple command:

trustchk -n all

Advice: always do this checkup first  before you enable the runtime mode.

This is the default mode and it’s always available also if the runtime policy is active (trustchk -p te=on).

Sometimes especially when efixes are applied it can be necessarily to modify / update the local tsd.dat file.

For efixes the signature is and hash do have old values, and you have to set them to VOLATILE into the tsd.dat.

After the efix becomes an official Apar, for example in a new SP or TL, it will have again a valid signature and hash, signed by IBM.

Another (dirty way) is remove the execuable lib or script form the tsd.dat with:

trustchk -d /complete/path/of/the/exec/script/file

Please use this as last resort first try to update the tsd.dat with the VOLATILE values.

This because even when used the VOLATILE settings, those files can be locked, and still verified for the right owner and groups.

When you have a nice consistent local tds.dat you can give it a try to enable the runtime TE.

Read the output of the command

 trustchk -n ALL

 gives no errors and gives on ouput.

Also TE in passive mode can be used to do a daily checkup for the sanity of your Lpar, but it can be cpu consuming, a nice option for this is running this process in a wpar see example below that I use in my daily checkup script:

/usr/sbin/wparexec -n trustchkexec -R CPU=2%-3%,3% /usr/sbin/trustchk -n all 2>> ${LOG}

Lets enable the runtime part of TE

First have a look at the scheme below:

Above the TE kernel logic is represented.

This scheme is in place for the runtime enabled TE and is executed for each stanza in the tsd.dat and lib.tsd.dat.

According the documentation:

To enable or disable the runtime integrity-verification function that is responsible for verifying of a file's cryptographic hash or signature before being started, use the trustchk command. To turn the Trusted Execution function on or off, use the TE -p flag.

In other words: You can enable the runtime by trustchk -p te=on

But before you execute this command let me first explain the second database file tepolicies.dat

As the name already expect, this database contains the TE policies that can be set

Both database files are stored localy on /etc/security/tsd/

For the libraries in /etc/security/tsd/lib

Table below describes each policy that can be set:

CHKEXEC

Checks the hash value or the signature of only the trusted executables before loading them in memory for execution.

CHKSHLIBS

Checks the hash value or the signature of only the trusted shared libraries before loading them in memory for execution.

CHKSCRIPTS

Checks the hash value or the signature of only the trusted shell scripts before loading them in memory.

CHKKERNEXT

Checks the hash value or the signature of only the kernel extension before loading it in memory.

SIG_VER

Enables or disables the Runtime Signature Verification policy. When both the Runtime Signature Verification policy and the TE policy are enabled, the signature is used to verify the integrity of files instead of the hash value.

STOP_UNTRUSTD

Stops loading of files that are not trusted. Only files belonging to TSD are loaded. This policy only works in combination with any of the CHK* policies mentioned above. For example, if CHKEXEC=ON and STOP_UNTRUSTD=ON, then any executable binary that does not belong to TSD is blocked from execution.

STOP_ON_CHKFAIL

Stops loading of trusted files that fails the hash value check or the signature check. This policy also works in combination with CHK* policies. For example, if CHKSHLIBS=ON and STOP_ON_CHKFAIL=ON, then any shared library not belonging to the TSD is blocked from being loaded into memory for use.

TSD_LOCK

Locks TSD so it is not available for editing.

TSD_FILES_LOCK

Locks trusted files. This does not allow opening of trusted files in write mode.

TE

Enables/Disables Trusted Execution functionality. Only when this functionality is enabled, the above configuration policies are in effect.

Trusted Execution Path and Trusted Library Path
Trusted Execution Path (TEP) defines a list of directories that contain the trusted executables. Once TEP verification is enabled, the system loader allows only binaries in the specified paths to execute. Trusted Library Path (TLP) has the same functionality, except that it is used to define the directories that contain trusted libraries of the system.

Some extra notes for the above policy TSD_FILES_LOCK.

This is a very good policy to set, and when the runtime is enabled files, executables and scripts cannot be modified / or tampered with. But for some systems this must be allowed; one example is a NIM server when this policy is set to ON, it will stop some functions of NIM such as netboot.

For those severs you set this policy to EXVOL eg. TSD_FILES_LOCK=EXVOL

The following table gives the interaction between different CHK* policies and STOP* policies when enabled:

Policy

STOP_UNTRUSTD

STOP_ON_CHKFAIL

CHKEXEC

Stops loading of executables that do not belong to TSD.

Stops loading of executables whose hash values or signatures do not match the TSD values.

CHKSHLIBS

Stops loading of shared libraries that do not belong to TSD.

Stops loading of shared libraries whose hash values or signatures do not match the TSD values.

CHKSCRIPTS

Stops loading of shell scripts that do not belong to TSD.

Stops loading of shell scripts whose hash values or signatures do not match the TSD values.

CHKKERNEXT

Stops loading of kernel extensions that do not belong to TSD.

Stops loading of kernel extensions whose hash values or signatures do not match the TSD values.

Note: read in the above table, if a script does not exists into the tsd.dat then it will not be checked! And normal execution is allowed.

Best practices for a start with runtime enabled:

Please, always practice on a test environment first, in case you break something in the worst case you have to reboot.

Before changing anything into the /etc/security/tsd/tsd.dat files or /etc/security/tsd/lib/lib.tsd.dat make a copy to a save directory.

It’s always a good practice to clone your rootvg with alt_disk_copy -Bd diskx.

Below a good starting point for some policy settings

TE=ON

SIG_VER=OFF

CHKEXEC=ON

CHKSHLIB=OFF

CHKSCRIPT=ON

CHKKERNEXT=OFF

STOP_UNTRUSTD=OFF

STOP_ON_CHKFAIL=ON

LOCK_KERN_POLICIES=OFF

TSD_FILES_LOCK=ON

TSD_LOCK=OFF

TEP=OFF

TLP=OFF

After turning on (trustchk -p te=on) you can verify youre executable and scripts or config files, for example /etc/inittab with trustchk -n /complete path/file/exec/script

If your syslog.conf is right configured you can monitor the runtime behavior, and check on errors

How to configure syslog or rsyslog I will not cover in this blog. But sending it to a central syslog server with the right triggers set on it you have an a central monitoring tool to monitor all your Lpars.

Below a sample rsyslog output of a tampered script

2024-01-22T13:43:53.363+01:00 test_host kernel: unix: Trusted Execution: pid=19661188, euid=1244, ruid=1244: Crypto hash verification failed: /somepath/bin/script_exe_te.sh

Adding your own sets to the tsd.dat

Now I have explained a bit how the runtime works, you maybe like to add your own set of executables and files to the tsd.dat database.

Note these step are only needed to add your own sets.

Prerequisites for this are: clic.rte filesets, a valid singed or self-singed certificate stored in /etc/security/certificates

trustchk command to add the files to the tsd.dat with your own certificate.

-1 Check clic.rte:

On AIX you need the fileset CryptoLite for C library (CLiC) and the kernel extentions loaded

lslpp -l |grep clic

  clic.rte.kernext          4.10.1.0  COMMITTED  CryptoLite for C Kernel

  clic.rte.lib              4.10.1.0  COMMITTED  CryptoLite for C Library

  clic.rte.kernext          4.10.1.0  COMMITTED  CryptoLite for C Kernel

  clic.rte.lib              4.10.1.0  COMMITTED  CryptoLite for C Library

check kernel extension loaded with:

This can be checked with:

# /usr/lib/methods/loadkclic -q

/usr/lib/drivers/crypto/clickext is loaded, ID = -1609080832

Version number is 5.0

If kernel extention is not loaded then run command:

/usr/lib/methods/loadkclic –l

-2 Before you can add and sign your set to the tsd.dat you have to create a valid certificate self-signed or an official signed certificate. For now I explain how to create an self-signed.

The next step is to create a certificate, in this example I create a self-singed cert

Please follow the following steps:

use the example script or create your own certificate, but make sure that you have a private and a n public cert in .der format.

Below a simple script to create a self-signed key:

#!/bin/ksh93

# set -x

# below is old for RSA key not so save anymore!

# openssl genrsa -out privkey.pem 2048

# openssl req -new -x509 -key privkey.pem -outform DER -out cert.der -days 7300

# openssl pkcs8 -inform PEM -in privkey.pem -topk8 -nocrypt -outform DER -out privkey.der

# below method for Elliptic Curve Keys

# openssl ecparam -list_curves

# generate a private key for a curve

openssl ecparam -name prime256v1 -genkey -noout -out private-key.pem

# generate corresponding public key

openssl ec -in private-key.pem -pubout -out public-key.pem

# create a self-signed certificate

openssl req -new -x509 -key private-key.pem -outform DER -out cert.der -days 7300

openssl pkcs8 -inform PEM -in private-key.pem -topk8 -nocrypt -outform DER -out privkey.der

# copy the cert.der to /etc/security/certificates

Now that you have a valid certificate you can add your own set to the /etc/security/tsd/tsd.dat

Please make a copy before you start of the current tsd.dat database.

Go to the directory where you saved both the cert.der and the private key privkey.der

Form there you can run:

trustchk -s privkey.der -v cert.der -a /user/local/example/test.ksh93

After this command you wil notice that the /etc/security/tsd.dat is changed.

You can have a look with view /etc/security/tsd/tsd.dat and lookup your stanza you just add.

Also if everything went well you, you can verify your action with:

trustchk -n /path/to/file/just/added/test.ksh93

Note: you do not have to disable the runtime if you add new sets to the tsd.dat.

Policies can be changed with:

trustchk -p policy_name for example:

trustchk -p TSD_FILES_LOCK=ON

trustchk -p STOP_ON_CHKFAIL=ON

To lean how your set is added to the tsd.dat you can simply open it with a editor such as vi 

vi /etc/security/tsd/tsd.dat

If TE runtime is enabled with the policy TSD_FILES_LOCK=ON you will notice that you cannot write the tsd.dat file because it’s locked by this policy.

You will get a write error -1.

To unlock it you have to disable either the policy or disable the runtime completely with trustchk -p te=off

for now this was part2, please let me know it this was interesting any comments are appreciated.

In the next part, I will explain how to store the databases on an LDAP server, and what are the benefits of this.

16 comments
129 views

Permalink

Comments

Wed April 03, 2024 02:01 PM

Thanks AIX_USER for you kind words, this motivates me to go on with my blogs, more than happy to share this with the community! And I really hope that TE is more used in a secure environments.

Greetings Christian Sonnemans

P.s. There part 4 is coming in a few weeks, this will be the last part for this TE series. This will cover practical stuff such as how to maintain TE in a proper way.

Tue April 02, 2024 02:07 PM

Thanks Christian,

Your blog is very informative.  Also, I really appreciate your comments answering my questions.

Sat March 23, 2024 05:17 AM

Hello again AIXUSER and other readers of my blog

First thanks again for all your reactions I really appreciate this! 

Answer on message AIXUSER

It depends how you define real-time logging:

The runtime version of TE, examens each time if an object (exec, lib, script) is pre-fetched if it's is not tampered. For example if the mode is changed it detects this and logs this near real-time when the object is tried to load by the kernel.

If I interpret you answers right:

What you expected is that TE “monitors” every object that is the database and if some of those is tampered it should report this read-time.

When you think about this, this would imply that the kernel is busy with examine thousands of objects simultaneously and reporting those real time, this would be very cpu and memory consuming. Also not necessary, execution should only stop when something is wrong (tampered).  

This is exactly why I mentioned in my blog about TE that you like to have use both options:

System integrity check and runtime.

Runtime: for every object that is tried to execute checks near real-time if the object is valid and not tampered à logging via syslog.

System integrity check: In my case we made a script that runs in a command in a wpar so that it will not take to much cpu load, script boils down to the command trustchk -n all. The output we send again to a log file and to syslog via the logger command. We run this command one a day for a complete system integrity check, on every Lpar. Our monitoring system give an alarm if it finds abnormalities.

Thank you again for your reactions this helps me to explain more about TE. TE is my humble opinion fantastic security part of AIX 😊 And it should be used more!

Fri March 22, 2024 03:06 PM

hi Christian,

thank you for the explanation.  I had thought that the output from your blog part 2 was a real-time logging.  It seems that is not possible.  I just needed to know for sure.

I will try your syslog suggestions and see what type of logs they produce.  If you have any other suggestions, please let me know.

Thank you.

Thu March 21, 2024 02:57 PM

>> So, I guess the only time that you see something like this is when you  actually use the script/command not when something gets changed like permissions in this case, am I understanding this correctly?

Yes that’s correct, see also my blog where I tried to exeplain this behavior,  see also the right picture. Only if a scipt, executable, or library is pre-fetched by the kernel it compares it’s integrity, depending with TE policy is defined it’s reports it or even stops the execution.

Maybe I have to explain this better?

Greetings Christian Sonnemans

Thu March 21, 2024 02:49 PM

Hello AIXUSER: I am not sure if I understand what you are looking for.

First question is do you get in kern_err.log the message that the mode is wrong as soon if you try to execute the script or executable when you change the mode or group? 

Further syslog has the following options:

*.emerg;*.alert;*.crit;*.err;*.warning;*.notice;*.info;*.debug

for each * you can replace the keyword kern.

So please try something like this: 

kern.emerg      /var/log/kern_emerg      rotate time 1d

kern.alert      /var/log/kern_allert      rotate time 1d

kern.crit       /var/log/kern_crit        rotate time 1d

kern.err        /var/log/kern_err         rotate time 1d

kern.waring     /var/log/kern_warn        rotate time 1d

kern.notice     /var/log/kern_notice      rotate time 1d

kern.info       /var/log/kern_info        rotate time 1d

kern.debug      /var/log/kern_debug       rotate time 1d

We do not use syslog but syslog-ng so our syntax is complete different, but with this configuration you can test in which log the right message appears, that you can choose in which log you would like to see it.

Hopefuly this will help?

Greetings Christian Sonnemans.

 

Thu March 21, 2024 02:48 PM

quick update.

Added the following line to /etc/syslog.conf:

*.crit;*.alert;*.err;kern.err;kern.crit;kern.info /var/log/systemlog.log rotate time 1d

I changed the permission on the script from 755 to 700,then ran the script and saw below entry:

Mar 21 12:45:01 myhost kern:err|error unix: Trusted Execution: pid=18219334, euid=0, ruid=0: owner/group/mode comparision failed: /path/to/my/script

So, I guess the only time that you see something like this is when you actually use the script/command not when something gets changed like permissions in this case, am I understanding this correctly?

Thu March 21, 2024 01:32 PM

hi Christian,

Can you please help with the syslog issues as I can not replicate your sample output:

2024-01-22T13:43:53.363+01:00 test_host kernel: unix: Trusted Execution: pid=19661188, euid=1244, ruid=1244: Crypto hash verification failed: /somepath/bin/script_exe_te.sh

I've read the syslog man page but honestly does not give enough info for this purpose.  

Thank you

Mon March 18, 2024 04:50 PM

Sorry to ask what seems like basic question but I'm not getting what I need.  here are the lines added to syslog.conf:

kern.err   /var/log/kern_err.log  rotate time 1d
kern.crit  /var/log/kern_crit.log rotate time 1d
kern.info /var/log.kern_info.log rotate time 1d

here are the new log files:

-rw-r--r-- 1 root system        0 Mar 18 11:12 kern_crit.log
-rw-r--r-- 1 root system    34368 Mar 18 15:25 kern_err.log
-rw-r--r-- 1 root system        0 Mar 18 11:12 kern_info.log

I refreshed the syslogd but I am only getting entries on kern_err.log.  What do I need to setup to get similar output like you showed.

2024-03-15T07:39:44.080+01:00 lparname kernel: unix: Trusted Execution: pid=13173166, euid=1244, ruid=1244: owner/group/mode comparision failed: /apps/local/bin/testscript

I actually do have a script in tsd.dat where I changed the mode from 755 to 644 but I am not seeing any error, only when I run trustchk -n do I see the verification of attributes failed: mode

tks.

Mon March 18, 2024 03:04 PM

Hello AIX USER:

Please read also the man pages on AIX (man syslog.conf)

But to give an example lines like:

kern.err /var/log/kern_err.log  rotate size 100k files 4
kern.crit /var/log/kern_crit.log  rotate size 100k files 4
kern.info /var/log/kern_info.log  rotate size 100k files 4

touch /var/log/kern_err.log

touch /var/log/kern_crit.log

touch /var/log/kern.info.log

what you suggest is *.crit  /var/log/syslog.log is everything not only kernel messages log into /var/log/syslog.log possible but most likely not wanted I think?

make sure that empty files exist and afterwards restart the syslog deamon with:

refresh -s syslogd

Mon March 18, 2024 09:41 AM

Thanks Christian,

So, add the 3 kern.* line in /etc/syslog.conf will produce the output:

2024-03-15T07:39:44.080+01:00 lparname kernel: unix: Trusted Execution: pid=13173166, euid=1244, ruid=1244: owner/group/mode comparision failed: /apps/local/bin/testscript

How do I use some thing like *.crit

Would that be *.crit     /var/log/syslog.log ?

Thanks agin.

Sat March 16, 2024 08:18 AM

Hello AIX USER:

Yes I think that I can guess what you need to add in your syslog.conf or rsyslog or whatever that controls your syslog. 

TE logs everything from the kernel perspective so you need to add:

kern.err   /var/log/kern_err.log  rotate time 1d

kern.crit  /var/log/kern_crit.log rotate time 1d

kern.info /var/log.kern_info.log rotate time 1d

Or something like this, just an example.

You can also use some thing like *.crit

Just let me know if this helps ? 

Greetings Christian Sonnemans.

Fri March 15, 2024 03:53 PM

hi Christian,

The line is syslog looks like it's what I am after.  my current TE looks like this:

TE=ON
SIG_VER=OFF
CHKEXEC=ON
CHKSHLIB=ON
CHKSCRIPT=ON
CHKKERNEXT=ON
STOP_UNTRUSTD=OFF
STOP_ON_CHKFAIL=OFF
LOCK_KERN_POLICIES=OFF
TSD_FILES_LOCK=OFF
TSD_LOCK=OFF
TEP=ON
TLP=ON

in my /etc/syslog.conf, I see line:

syslog.debug    /var/log/syslog.log

but I do not see syslog.log in /var/log and I can confirm syslogd is running so do I need to enable something else to get the line like you highlighted in your response.

Thank you.

Thu March 14, 2024 05:14 AM

Hello AIX user,

First of all thanks for reading my blog, and yes good question and maybe I have to explain more in detail the behavior, when the runtime TE checks is enabled (trustchechk te=on)

After this is enabled it depends what TE logs and how it acts on abnormalities.

You are telling me that you added a script to TE, I assume with own certificate?

To report and even stop execution of scripts you have to enable some more policies

For checking scripts CHKSCRIPT=ON and STOP_ON_CHKFAIL=ON  than the kernel part of TE will report those errors, even better is to prevent modification of scripts with the policy TSD_FILES_LOCK=ON.

>> Checked again only for scripts CHKSCRIPT=ON is sufficient, better is to prevent execution of the script so with policy CHKFAIL=ON but not needed only for logging via syslog. 

The line you get in syslog looks like something like this:

2024-03-15T07:39:44.080+01:00 lparname kernel: unix: Trusted Execution: pid=13173166, euid=1244, ruid=1244: owner/group/mode comparision failed: /apps/local/bin/testscript

Just let me know what TE policies your currently set, and please check also your syslog configuration if you log enough. Maybe an idea to look at debug.log and enable it for testing purpose.

Greeting Christian Sonnemans.

P.s don’t hesitate to ask.

Wed March 13, 2024 02:44 PM

hi Christian,

I am testing my TE implementation and had a question.  I have a script with mode 755 and it's in tsd.dat and I have CHKEXEC=ON.  When I changed the mode to 700 and ran the command, I didn't see TE complain but when I did the trustchk -q on the script, it said the verification attributes failed: mode.

I was looking at /var/log/kern.log to see if it would log the mode changed error but I didn't see it.  Is there a way to get notification if something like this happens in real-time and not wait for the check?. So, when the mode changed to 700, it should alert me of the change.  Anything like this possible?

thanks.

Mon March 04, 2024 12:35 PM

Nice and clear information! Thank you!