Selinux problemi

Linux, poslužitelj, mreže i sigurnost

Moderator/ica: Moderatori/ce

Avatar
drade
Postovi: 910
Pridružen/a: 12 svi 2010, 07:57
OS: linux

Re: Selinux problemi

Post Postao/la drade »

Imas li instaliran paket ?
selinux-policy-src
Ako je odgovor "Ne", instaliraj ga.

Ako je vec instaliran, onda bi samo make naredba u navedenom direktoriju trebala raditi (unutar navedenog direktorija bi se takodjer trebale nalaziti example.te, example.if i example.fc datoteke (na RH based sustavima je tako, izlistaj sadrzaj paketa da vidis unutar koje putanje ih sprema debian).

Nakon sto make naredba zavrsi trebao bi dobiti example.pp i wtf.pp module koje mozes loadati semodule naredbom.
When you're a kid and you wanna go "Weee !", but you ain't got drugs yet ... You hold out for your life, hold on to your little GONADS ... and STRIFE.
Avatar
shrike
Moderator
Postovi: 10322
Pridružen/a: 07 pro 2007, 18:07
Spol: Y
OS: utuntu 19.10
Kontakt:

Re: Selinux problemi

Post Postao/la shrike »

Instaliran je i ne radi. Postoji li još koji način da promijenim make i udevd kontekst? Možeš li ti kompilirati *.pp datoteke za ta dva čuda pa mi ih poslati?
Es gibt keinen Gott, kein Universum, keine menschliche Rasse, kein irdisches Leben, keinen Himmel, keine Hölle. Es ist alles ein Traum - ein grotesker und dummer Traum. Nichts existiert außer dir. Und du bist nur ein Gedanke - ein vagabundierender Gedanke, ein nutzloser Gedanke, ein heimatloser Gedanke, der verloren in der leeren Ewigkeit wandelt!
Avatar
drade
Postovi: 910
Pridružen/a: 12 svi 2010, 07:57
OS: linux

Re: Selinux problemi

Post Postao/la drade »

shrike je napisao/la:Instaliran je i ne radi. Postoji li još koji način da promijenim make i udevd kontekst? Možeš li ti kompilirati *.pp datoteke za ta dva čuda pa mi ih poslati?
Ah, sto ce ti to koristiti kada je ono sto sam ti dao samo example na kojemu mozes raditi. Opet ces morati editirati source i buildati modul ako ti ovo sto sam ti dao ne prodje.

Pokusaj (nad wtf.te datotekom koji si napunio onim primjerom):

Kod: Označi sve

checkmodule -M -m wtf.te -o wtf.pp
When you're a kid and you wanna go "Weee !", but you ain't got drugs yet ... You hold out for your life, hold on to your little GONADS ... and STRIFE.
Avatar
shrike
Moderator
Postovi: 10322
Pridružen/a: 07 pro 2007, 18:07
Spol: Y
OS: utuntu 19.10
Kontakt:

Re: Selinux problemi

Post Postao/la shrike »

drade je napisao/la: checkmodule -M -m wtf.te -o wtf.pp
Dobio sam ovo:

Kod: Označi sve

checkmodule:  loading policy configuration from wtf.te
wtf.te:10:ERROR 'unknown class chr_file used in rule' at token ';' on line 10:

allow fsadm_t device_t:chr_file { add_name  };
checkmodule:  error(s) encountered while parsing configuration

Ako stavim setenforce 1 onda se sve stravično uspori i počnu padati goleme greške. Ako pokrenem sustav sa enforce onda se ne može niti logirati u grafiku, tj. kdm krepa sa greškom da se ne može spojti na /var/run/dbus/system_bus_socket jer ne postoji. Također ne rade miš ili tastatura i moram isključiti laptop pritiskom na gumb (što pokrene normalni shutdown -hP now).
Es gibt keinen Gott, kein Universum, keine menschliche Rasse, kein irdisches Leben, keinen Himmel, keine Hölle. Es ist alles ein Traum - ein grotesker und dummer Traum. Nichts existiert außer dir. Und du bist nur ein Gedanke - ein vagabundierender Gedanke, ein nutzloser Gedanke, ein heimatloser Gedanke, der verloren in der leeren Ewigkeit wandelt!
Avatar
drade
Postovi: 910
Pridružen/a: 12 svi 2010, 07:57
OS: linux

Re: Selinux problemi

Post Postao/la drade »

Jesi li nesto prcako po selinux politikama prije nego sto se sve ovo dogodilo ?

Daj output komande

Kod: Označi sve

sestatus
Evo mali ispravak za wtf.te datoteku (pokusaj ponovno kompilirati):

Kod: Označi sve

module wtf 1.0;

require {
   type mount_t;
   type device_t;
   type fsadm_t;
   type var_r;
   class chr_file add_name;
};

allow fsadm_t device_t:chr_file add_name;
allow mount_t var_t:file { read ioctl getattr };
allow mount_t device_t:dir { write };
When you're a kid and you wanna go "Weee !", but you ain't got drugs yet ... You hold out for your life, hold on to your little GONADS ... and STRIFE.
Avatar
shrike
Moderator
Postovi: 10322
Pridružen/a: 07 pro 2007, 18:07
Spol: Y
OS: utuntu 19.10
Kontakt:

Re: Selinux problemi

Post Postao/la shrike »

Kod: Označi sve

SELinux status:                 enabled
SELinuxfs mount:                /selinux
Current mode:                   permissive
Mode from config file:          permissive
Policy version:                 25
Policy from config file:        default

Kod: Označi sve

Policy booleans:
allow_cvs_read_shadow              off
allow_execheap                     off
allow_execmem                      on
allow_execmod                      on
allow_execstack                    off
allow_ftpd_anon_write              off
allow_ftpd_full_access             off
allow_ftpd_use_cifs                off
allow_ftpd_use_nfs                 off
allow_gssd_read_tmp                on
allow_httpd_anon_write             off
allow_httpd_cvs_script_anon_write  off
allow_httpd_git_script_anon_write  off
allow_httpd_mod_auth_pam           off
allow_httpd_sys_script_anon_write  off
allow_httpd_user_script_anon_write off
allow_java_execstack               off
allow_mount_anyfile                on
allow_mplayer_execstack            on
allow_nfsd_anon_write              off
allow_polyinstantiation            off
allow_ptrace                       off
allow_rsync_anon_write             off
allow_smbd_anon_write              off
allow_ssh_keysign                  off
allow_user_mysql_connect           off
allow_user_postgresql_connect      off
allow_write_xshm                   off
allow_ypbind                       off
cdrecord_read_content              off
cron_can_relabel                   on
daemon_access_unconfined_home      on
exim_can_connect_db                on
exim_manage_user_files             on
exim_read_user_files               on
fcron_crond                        off
ftp_home_dir                       off
global_ssp                         off
gpg_agent_env_file                 off
httpd_builtin_scripting            off
httpd_can_network_connect          off
httpd_can_network_connect_db       off
httpd_can_network_relay            off
httpd_can_sendmail                 off
httpd_dbus_avahi                   off
httpd_enable_cgi                   off
httpd_enable_ftp_server            off
httpd_enable_homedirs              off
httpd_ssi_exec                     off
httpd_tty_comm                     off
httpd_unified                      off
httpd_use_cifs                     off
httpd_use_gpg                      off
httpd_use_nfs                      off
init_upstart                       on
mail_read_content                  off
mozilla_read_content               off
mysql_connect_any                  off
nfs_export_all_ro                  off
nfs_export_all_rw                  off
openvpn_enable_homedirs            off
pppd_can_insmod                    off
pppd_for_user                      off
rsync_export_all_ro                off
samba_create_home_dirs             off
samba_domain_controller            off
samba_enable_home_dirs             off
samba_export_all_ro                off
samba_export_all_rw                off
samba_run_unconfined               off
samba_share_fusefs                 off
samba_share_nfs                    off
secure_mode                        off
secure_mode_insmod                 off
secure_mode_policyload             off
sftpd_anon_write                   off
sftpd_enable_homedirs              off
sftpd_full_access                  off
ssh_sysadm_login                   off
use_lpd_server                     off
use_nfs_home_dirs                  on
use_samba_home_dirs                off
user_direct_mouse                  on
user_dmesg                         on
user_ping                          off
user_rw_noexattrfile               off
user_tcp_server                    off
user_ttyfile_stat                  off
xdm_sysadm_login                   on
xserver_object_manager             on
NIsam radio nikakve modifikacije, čak sam purge napravio i reinstalirao sve. Make i dalje ne radi.
Es gibt keinen Gott, kein Universum, keine menschliche Rasse, kein irdisches Leben, keinen Himmel, keine Hölle. Es ist alles ein Traum - ein grotesker und dummer Traum. Nichts existiert außer dir. Und du bist nur ein Gedanke - ein vagabundierender Gedanke, ein nutzloser Gedanke, ein heimatloser Gedanke, der verloren in der leeren Ewigkeit wandelt!
Avatar
drade
Postovi: 910
Pridružen/a: 12 svi 2010, 07:57
OS: linux

Re: Selinux problemi

Post Postao/la drade »

Ne make komanda, checkmodule komanda, ako i dalje puca, postaj output iz konzole.

Ajde postaj output:

Kod: Označi sve

cat /etc/selinux/config
When you're a kid and you wanna go "Weee !", but you ain't got drugs yet ... You hold out for your life, hold on to your little GONADS ... and STRIFE.
Avatar
shrike
Moderator
Postovi: 10322
Pridružen/a: 07 pro 2007, 18:07
Spol: Y
OS: utuntu 19.10
Kontakt:

Re: Selinux problemi

Post Postao/la shrike »

drade je napisao/la:Ne make komanda, checkmodule komanda, ako i dalje puca, postaj output iz konzole.

Ajde postaj output:

Kod: Označi sve

cat /etc/selinux/config

Kod: Označi sve

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:                                                                                                                
# enforcing - SELinux security policy is enforced.                                                                                                            
# permissive - SELinux prints warnings instead of enforcing.                                                                                                  
# disabled - No SELinux policy is loaded.                                                                                                                     
SELINUX=permissive                                                                                                                                            
# SELINUXTYPE= can take one of these two values:                                                                                                              
# default - equivalent to the old strict and targeted policies                                                                                                
# mls     - Multi-Level Security (for military and educational use)                                                                                           
# src     - Custom policy built from source                                                                                                                   
SELINUXTYPE=default                                                                                                                                           
                                                                                                                                                              
# SETLOCALDEFS= Check local definition changes                                                                                                                
SETLOCALDEFS=0                          
checkmodule daje ovo:

Kod: Označi sve

checkmodule:  loading policy configuration from policy.conf
checkmodule:  unable to open policy.conf      
checkmodule -b wtf.te

Kod: Označi sve

checkmodule:  loading policy configuration from wtf.te
libsepol.policydb_read: policydb magic number 0x75646f6d does not match expected magic number 0xf97cff8c or 0xf97cff8d
checkmodule:  error(s) encountered while parsing configuration
a checkmodule wtf.te

Kod: Označi sve

checkmodule:  loading policy configuration from wtf.te
wtf.te:1:ERROR 'Module specification found while not building a policy module.
' at token ';' on line 1:


checkmodule:  error(s) encountered while parsing configuration
Es gibt keinen Gott, kein Universum, keine menschliche Rasse, kein irdisches Leben, keinen Himmel, keine Hölle. Es ist alles ein Traum - ein grotesker und dummer Traum. Nichts existiert außer dir. Und du bist nur ein Gedanke - ein vagabundierender Gedanke, ein nutzloser Gedanke, ein heimatloser Gedanke, der verloren in der leeren Ewigkeit wandelt!
Avatar
drade
Postovi: 910
Pridružen/a: 12 svi 2010, 07:57
OS: linux

Re: Selinux problemi

Post Postao/la drade »

Kod: Označi sve

checkmodule -M -m wtf.te -o wtf.pp
Output toga.

Evo jos mala izmjena, pokusaj s gore navedenom komandom:

Kod: Označi sve

policy_module(wtf, 1.0)

require {
   type mount_t;
   type device_t;
   type fsadm_t;
   type var_r;
   class chr_file add_name;
}

allow fsadm_t device_t:chr_file add_name;
allow mount_t var_t:file { read ioctl getattr };
allow mount_t device_t:dir { write };
Uvidio sam gresku, stavio sam ';' na mjesto gdje mu nije mjesto.
When you're a kid and you wanna go "Weee !", but you ain't got drugs yet ... You hold out for your life, hold on to your little GONADS ... and STRIFE.
Avatar
shrike
Moderator
Postovi: 10322
Pridružen/a: 07 pro 2007, 18:07
Spol: Y
OS: utuntu 19.10
Kontakt:

Re: Selinux problemi

Post Postao/la shrike »

Evo što je dao:

Kod: Označi sve

checkmodule:  loading policy configuration from wtf.te
wtf.te:1:ERROR 'Building a policy module, but no module specification found.
' at token 'policy_module' on line 1:


checkmodule:  error(s) encountered while parsing configuration
Es gibt keinen Gott, kein Universum, keine menschliche Rasse, kein irdisches Leben, keinen Himmel, keine Hölle. Es ist alles ein Traum - ein grotesker und dummer Traum. Nichts existiert außer dir. Und du bist nur ein Gedanke - ein vagabundierender Gedanke, ein nutzloser Gedanke, ein heimatloser Gedanke, der verloren in der leeren Ewigkeit wandelt!
Odgovori