Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gentoo Hardened Policy für Apache
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German)
View previous topic :: View next topic  
Author Message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1844
Location: Oranienburg/Germany

PostPosted: Mon Apr 12, 2010 12:12 pm    Post subject: Gentoo Hardened Policy für Apache Reply with quote

Hallo Leute,

ich versuche mich gerade an Gentoo Hardened. Jedoch ist es mir bis dato nicht gelungen über die diversen Howtos eine funktionierende Apache2 Policy zu kreieren. Vielleicht hat jemand von euch eine funktionierende, die ich testweise nutzen könnte. Ich bekomme im grsec.log nämlich egal was ich mache immer die folgenden Meldungen:

Code:

Apr 12 14:05:04 apollovm02 kernel: [ 8549.344973] grsec: From 192.168.23.250: (default:D:/) denied access to hidden file /var/www/localhost/htdocs/phpsysinfo/index.php by /usr/sbin/apache2[apache2:2958] uid/euid:81/81 gid/egid:81/81, parent /usr/sbin/apache2[apache2:2922] uid/euid:0/0 gid/egid:0/0
Apr 12 14:05:04 apollovm02 kernel: [ 8549.344994] grsec: From 192.168.23.250: (default:D:/) denied access to hidden file /var by /usr/sbin/apache2[apache2:2958] uid/euid:81/81 gid/egid:81/81, parent /usr/sbin/apache2[apache2:2922] uid/euid:0/0 gid/egid:0/0


Meine momentan Policy sieht so aus. Vielleicht hat auch einfach jemand von euch einen Tipp, wo es hakt:

Code:

subject /usr/sbin/apache2 o {
user_transition_allow apache root
group_transition_allow apache root

        /
        /bin                            h
        /bin/bash                       x
        /dev                            h
        /dev/log                        rw
        /dev/null                       rw
        /dev/ptmx                       rw
        /dev/pts                        rw
        /dev/tty                        rw
        /dev/urandom                    r
        /etc                            r
        /etc/grsec                      h
        /etc/shadow-                    h
        /etc/gshadow                    h
        /etc/gshadow-                   h
        /etc/ppp/chap-secrets           h
        /etc/ppp/pap-secrets            h
        /etc/samba/smbpasswd            h
        /usr                            h
        /usr/lib
        /usr/lib/libcrypto.so.0.9.8     rx
        /usr/lib/libssl.so.0.9.8        rx
        /usr/sbin/sshd                  x
        /usr/share/zoneinfo             r
        /var                            rx
        /var/empty
        /var/log
        /var/log/faillog                rw
        /var/log/lastlog                rw
        /var/log/wtmp                   w
        /var/log/apache2
        /var/log/apache2/error_log      rw
        /var/log/apache2/acces_log      rw
        /var/log/apache2/ssl_access_log rw
        /var/log/apache2/ssl_error_log  rw
        /var/log/apache2/ssl_request_log        rw
        /var/www
        /var/www/localhost
        /var/www/localhost/htdocs
        /var/www/localhost/htdocs/phpsysinfo

        /var/run
        /var/run/utmp                   rw
        /var/spool/mail
        /lib                            rx
        /lib/modules                    h
        /proc
        /proc/sys/kernel/ngroups_max    r
        /proc/kcore                     h
        /proc/bus                       h
        /proc/slabinfo                  h
        /proc/modules                   h
        /sys                            h
        /boot                           h
        -CAP_ALL
        +CAP_SETGID
        +CAP_SETUID
        +CAP_NET_ADMIN
        +CAP_SYS_CHROOT
        +CAP_SYS_TTY_CONFIG
        bind 0.0.0.0/32:22 stream dgram ip tcp
        bind 0.0.0.0/32:0 stream dgram ip tcp
        connect 192.168.23.20/32:53 dgram udp
}


Die Regeln hat mir "gradm -F -L" erstellt.

MfG. Stefan
_________________
Desktop: Ryzen 5 5600G, 32GB, 2TB, RX7600
Notebook: Dell XPS 13 9370, 16GB, 1TB
Server #1: Ryzen 5 Pro 4650G, 64GB, 16.5TB
Server #2: Ryzen 4800H, 32GB, 22TB
Back to top
View user's profile Send private message
Raze
n00b
n00b


Joined: 13 Jul 2009
Posts: 59
Location: Germany

PostPosted: Wed Apr 14, 2010 12:53 pm    Post subject: Reply with quote

Quote:
/var/www
/var/www/localhost
/var/www/localhost/htdocs
/var/www/localhost/htdocs/phpsysinfo


mal gesondert "r" hier vergeben?

In eigener Sache: funktioniert mit dem Set ein restart? Habe da aktuell auf amd64 Basis noch Probleme mit .. reload funktioniert problemlos, restart mag er aber nich. Hab irgendwann aufgehört es zu hinterforschen :roll:
Back to top
View user's profile Send private message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1844
Location: Oranienburg/Germany

PostPosted: Wed Apr 14, 2010 1:10 pm    Post subject: Reply with quote

Hi,

danke erstmal für die Antwort. Das mit dem r dahinter hatte ich auch schon versucht. Hatte nichts gebracht. Inzwischen hab ich aber eine funktionierende Policy zumindest für den Apache auf die Beine gestellt, dafür gehen andere Dinge nicht mehr. Restart hab ich noch nicht versucht. Man soll ja eh nichts mehr direkt unter root "machen dürfen". Dafür soll man ja in die admin-role wechseln. Da funktioniert das alles auch ganz gut.

MfG. Stefan
_________________
Desktop: Ryzen 5 5600G, 32GB, 2TB, RX7600
Notebook: Dell XPS 13 9370, 16GB, 1TB
Server #1: Ryzen 5 Pro 4650G, 64GB, 16.5TB
Server #2: Ryzen 4800H, 32GB, 22TB
Back to top
View user's profile Send private message
Raze
n00b
n00b


Joined: 13 Jul 2009
Posts: 59
Location: Germany

PostPosted: Wed Apr 14, 2010 1:19 pm    Post subject: Reply with quote

Soweit so klar, aber es gibt immer wieder Fälle in denen sowas um 4.30 Uhr in der Nacht mal verrafft wird :roll: Da wärs toll wenn der restart funktioniert, dann klingelt mich auch keiner wach :roll:

Wo lag denn das Problem bei dir?
Back to top
View user's profile Send private message
bbgermany
Veteran
Veteran


Joined: 21 Feb 2005
Posts: 1844
Location: Oranienburg/Germany

PostPosted: Wed Apr 14, 2010 1:49 pm    Post subject: Reply with quote

Wo direkt das Problem lag hab ich nicht so richtig begriffen. Bin noch recht neu im Hardened Bereich. Ich versuch grad mich da ein zu arbeiten.

MfG. Stefan
_________________
Desktop: Ryzen 5 5600G, 32GB, 2TB, RX7600
Notebook: Dell XPS 13 9370, 16GB, 1TB
Server #1: Ryzen 5 Pro 4650G, 64GB, 16.5TB
Server #2: Ryzen 4800H, 32GB, 22TB
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Deutsches Forum (German) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum