Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!

Ogłoszenie

Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.

#1  2015-04-14 18:39:19

  Novi-cjusz - Użytkownik

Novi-cjusz
Użytkownik
Zarejestrowany: 2013-03-05

IPtables log analyzer

Na moim Wheezzy uruchomilem restrykcyjny skrypt iptables z regula logowania. Skrypt dziala.
Problem jest w odczycie ktory w wersji natywnej jest absolutnie niefunkcjonalny.Sciagnolem z tej strony: http://www.mirrorservice.org/sites/downloads.sourceforge.net/l/li/lila/  plik  lila-1.0.tar.gz
Rozpakowalem a tam plik lila.pdf z procedura instalacji, ktora zmusza mnie do zwrocenia sie do Was o pomoc.
Jak tego log analizera zainstalowac?
Prosze o kilka slow pomocy, i kilka kolejnych krokow instalacji.
A moze jest inny program o podobnym dzialaniu?


------------------------------------------------------------------------------------
"Inveniam viam aut faciam" : I will either find a way, or I shall make one
"Złoto to pieniądz królów, srebro to pieniądz dżentelmenów, barter to pieniądz chłopów ale dług to pieniądz niewolników."

Offline

 

#2  2015-04-15 00:39:20

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/urandom
Zarejestrowany: 2008-01-07

Re: IPtables log analyzer

Ulogd (gada z bazami {My|Postgre}sql) + jakieś GUI - był kiedyś Nulog.

Poza tym szkoda tych logów czytać, jak cię coś interesuje, to zrób regułki, żeby dodawał pacjentów do tablic ipseta, wtedy zawsze będziesz miał listę pod ręką. D

Np:

Kod:

ipset list wypad
Name: wypad
Type: hash:net
Revision: 4
Header: family inet hashsize 1024 maxelem 65536 timeout 3600
Size in memory: 17984
References: 4
Members:
193.189.246.45/43 timeout 1603
58.215.228.188/40 timeout 31
122.141.251.42/37 timeout 81337
43.255.191.162/42 timeout 1209
222.186.51.165/45 timeout 2373
198.57.214.48/44 timeout 2316
196.201.241.34/34 timeout 80506
94.100.31.179/41 timeout 63

Sznurek:
https://forum.dug.net.pl/viewtopic.php?pid=269383#p269383

PS.
Jak chcesz na żywo, to łatwiej będzie śledzić aktywne połączenia, do tego jest [b]iptstate[/b].

Ostatnio edytowany przez Jacekalex (2015-08-09 13:55:07)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#3  2015-04-18 16:19:16

  Novi-cjusz - Użytkownik

Novi-cjusz
Użytkownik
Zarejestrowany: 2013-03-05

Re: IPtables log analyzer

ze wzgledu na czas zapoznalem sie z iptstate. Wrazenia mieszane poniewaz pozwala tylko na pasywne:
- biezaca obserwacje
- filtrowanie
- sortowanie
Brakuje mi zzutu do logu, narzedzi graficznej wizualizacji logow.
Przy tej okazji pojawil sie pomysl   "wszechstronnego narzedzia kontroli ruchu sieciowego" na ktore skladalo by sie:
- graficzna prezentacja aktualnych regol iptables - Google "iptables rules visualization"
- graficzna prezentacja aktualnego ruchu sieciowegonp na mapach Google
- logowanie wyniku dzialania okreslonych regol iptables np, DROP czy bogus czy okreslony kierunek.
- graficzna prezentacja logow iptables - Google " iptables logs + visual presentation"
Jaka to by byla frajda odpalic maszyne a tu ekran z aktualnymi polaczeniami na mapach Google, oraz adresy zrodlowy i docelowy, protokoly, porty.
Zmiana regol iptables i odpowiadajaca jej automatyczna zmiana grafu - wartosc edukacyjna ogromna.
Otwarcie vizualizacji logow i widac: ataki, niepozadanych gosci z USA, Niemiec czy Chin.
Gdybym umial to bym sam to zrobil, ale niepredko.
Na forum jest tylu wspanialych ludzi, moze ktorys z nich?

-

Ostatnio edytowany przez Novi-cjusz (2015-04-18 16:21:05)


------------------------------------------------------------------------------------
"Inveniam viam aut faciam" : I will either find a way, or I shall make one
"Złoto to pieniądz królów, srebro to pieniądz dżentelmenów, barter to pieniądz chłopów ale dług to pieniądz niewolników."

Offline

 

#4  2015-04-18 16:28:11

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/urandom
Zarejestrowany: 2008-01-07

Re: IPtables log analyzer

Logi Firewalla, wizualizacja?

Lubisz oglądać kilka tys komunikatów dziennie?

Ja wolę widzieć, co przepuszcza, a do oglądania i studiowania wolę pewną panią. ;)

Dlatego odpalam iptstate w trybie adresu docelowego, wchodzę na jakiś skaner portów, (w internecie jest kilka), da się też Nmapem czy Nessusem z innego kompa, i dokładnie widzę, co się dzieje.

Do tego mały skrycik do szybkiego podglądu na żywo (u mnie siedzi sobie jako [b]/usr/local/bin/dport[/b] ):

Kod:

#!/bin/bash

declare ROUTEIP=$(which ip);
declare GAWK=$(which awk);
declare ADRES=$(for karta in `$ROUTEIP r s | $GAWK '$1 == "default" {print $5}'`; do  $ROUTEIP r s |$GAWK -v DUPA=$karta '$3==DUPA {print $9}'; done;);
### sleep 1;
### echo "Moje IP to $ADRES";
/usr/bin/sudo  /usr/sbin/iptstate -f -d ${ADRES};

Do tego w [b]/etc/sudoers[/b] (edycja tylko poleceniem [b]visudo[/b]):

Kod:

(root) NOPASSWD: /usr/sbin/iptstate

i gotowe.


Jak koniecznie lubisz kolorowe wykresy, to [b]Psad[/b] potrafi rysować takowe przez [b]GNUPlota[/b], można też na necie znaleźć trochę skryptów do [b]MRTG[/b].

Pozdro
;-)

Ostatnio edytowany przez Jacekalex (2015-04-18 16:42:28)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#5  2015-04-18 17:02:31

  Novi-cjusz - Użytkownik

Novi-cjusz
Użytkownik
Zarejestrowany: 2013-03-05

Re: IPtables log analyzer

Skutecznie zorganizowales mi ten weekend ):)
Dziekuje.

Ps. Jestem szczegolnie zainteresowany wyproszeniem z domu "nieproszonych gosci" ktorzy sa bardzo nachalni. Przy standardowym uzytkowaniu kompa juz po 1 tyg przegladarka "puchnie" i musze przywracac.


------------------------------------------------------------------------------------
"Inveniam viam aut faciam" : I will either find a way, or I shall make one
"Złoto to pieniądz królów, srebro to pieniądz dżentelmenów, barter to pieniądz chłopów ale dług to pieniądz niewolników."

Offline

 

#6  2015-04-18 17:09:00

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/urandom
Zarejestrowany: 2008-01-07

Re: IPtables log analyzer

W ogóle nie rozumiem, jakich "nieproszonych gości".

Mam  dwa firewalle w systemie  (zarządzane przez Iptables i  Nftabies),
Do tego, jakby była taka potrzeba, to mogę sobie naskrobać trzeciego Firewalla (Grsecurity RBAC - reguly bind i connect), ale mrówek w kompie nie mam, także na razie mi to nie potrzebne.

Do tego wyjście do neta filtruję przy pomocy modułu cgroup do Netfiltera (Iptables), także problemów z siecią i intruzami nie mam w ogóle.

Ostatnio edytowany przez Jacekalex (2015-04-18 17:09:34)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#7  2015-04-18 17:14:13

  Novi-cjusz - Użytkownik

Novi-cjusz
Użytkownik
Zarejestrowany: 2013-03-05

Re: IPtables log analyzer

Noo, tak daleko to jeszcze nie zaszedlem.
Wyskrobalem sobie restrykcyjne iptables z logowaniem, ale cos jest nie tak bo mnie odcielo od Sieci.

Kod:

iptables -F
iptables -N LOGGING
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
iptables -A OUTPUT -o eth0 -p tcp --dport 443 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --dport 33445 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --sport 33445 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -o eth0 -p tcp --dport 80 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
iptables -A OUTPUT -p udp -o eth0 --dport 53 -j ACCEPT
iptables -A INPUT -p udp -i eth0 --sport 53 -j ACCEPT
iptables -A INPUT -j LOGGING
iptables -A LOGGING -m limit --limit 2/min -j LOG --log-prefix "IPTables"
iptables -A LOGGING -j DROP
iptables -A INPUT -j LOG -m limit --limit 10/hour --log-prefix "PODEJRZANY INPUT: "
iptables -A FORWARD -j LOG -m limit --limit 10/hour --log-prefix "PODEJRZANY FORWARD: "

Ostatnio edytowany przez Novi-cjusz (2015-04-18 17:38:17)


------------------------------------------------------------------------------------
"Inveniam viam aut faciam" : I will either find a way, or I shall make one
"Złoto to pieniądz królów, srebro to pieniądz dżentelmenów, barter to pieniądz chłopów ale dług to pieniądz niewolników."

Offline

 

#8  2015-04-18 17:30:26

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/urandom
Zarejestrowany: 2008-01-07

Re: IPtables log analyzer

Wygląda na to, że w ogóle nie rozumiesz zasady działania Firewalla.

Kod:

iptables -A INPUT -i eth0 -p tcp --sport 80 -m state --state ESTABLISHED -j ACCEPT
iptables -A INPUT -i eth0 -p tcp --sport 443 -m state --state ESTABLISHED -j ACCEPT

Po co Ci takie reguły?

Przecież to już nie jest Ipchains z Linuxa 2.2, tylko Netfilter, Firewall z kontrolą stanu pakietu, który śledzi bieżące polączenia.

Kod:

iptables -F
iptables -X
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

Cały Firewall  na desktopa, który skutecznie zamyka wszystkie porty dla ruchu przychodzącego z sieci.

Jak wystawiasz jakiegoś demona, np SSH, WWW, Torrenta czy FTP do netu, to wtedy otwierasz dla niego port, nigdy wcześniej.

Zamiast tych bzdurnych inputów, masz moduł CONNTRACK, który odpowiada za śledzenie połączeń, tych samych, które pokazuje [b]iptstate[/b].

Ta reguła:

Kod:

iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

zastępuje te wszystkie durnowate inputy, bo po prostu w tablicy conntrack Netfiltera jest info o każdym połączeniu, wraz z informacją, skąd się wzięło, z sieci czy z lokalnego procesu na kompie.

Zawartość tablicy conntrack możesz zobaczyć na własne oczy:

Kod:

cat  /proc/net/ip_conntrack

Wyświetla ją też np [b]iptstate[/b], [b]netstat[/b], [b]ss[/b] -z pakietu [b]iproute2[/b], i diabli wiedzą, ile jeszcze programów.


Możesz się też pobawić Snortem, do niego jest ładny skrypt php BASE, tu masz dość świeży opis:
http://computer-outlines.over-blog.com/article-nids-snort-barnyard2-apache2-base-with-ubuntu-14-04-lts-123532107.html

To by było na tyle
;-)

Ostatnio edytowany przez Jacekalex (2015-04-18 18:39:21)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#9  2015-04-18 17:44:22

  Novi-cjusz - Użytkownik

Novi-cjusz
Użytkownik
Zarejestrowany: 2013-03-05

Re: IPtables log analyzer

Ucze sie (sam!) dopiero, a to juz cos.
Te ascetyczne zapisy regolek nie ulatwiaja nauki. Ludzie 70% wiedzy przyjmuja oczami, a zrozumialych graficznych tutoriali jak na lekarstwo. Sprawdzilem juz chyba caly Internet. Potrzebne jest cos :logicznego, skojarzeniowego,kolorowego - wtedy i skrypt bedzie inny
.
Tu jest druga propozycja firewalla

Kod:

#!/usr/bin/env bash

#############################
# SETUP
#############################

# Define your hostname
NEMO=123.456.789.012

# Clear all rules
/sbin/iptables -F

# Don't forward traffic
/sbin/iptables -P FORWARD DROP 

# Allow outgoing traffic
/sbin/iptables -P OUTPUT ACCEPT

# Allow established traffic
/sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT 

# Allow localhost traffic
/sbin/iptables -A INPUT -i lo -j ACCEPT

#############################
# MANAGEMENT RULES
#############################

# Allow SSH (alternate port)
/sbin/iptables -A INPUT -p tcp --dport 2222 -j LOG --log-level 7 --log-prefix "Accept 2222 alt-ssh"
/sbin/iptables -A INPUT -p tcp -d $NEMO --dport 2222 -j ACCEPT 

#############################
# ACCESS RULES
#############################

# Allow web server
/sbin/iptables -A INPUT -p tcp --dport 80 -j LOG --log-level 7 --log-prefix "Accept 80 HTTP"
/sbin/iptables -A INPUT -p tcp -d $NEMO --dport 80 -j ACCEPT 

# Allow two types of ICMP
/sbin/iptables -A INPUT -p icmp -d $NEMO --icmp-type 8/0 -j LOG --log-level 7 --log-prefix "Accept Ping"
/sbin/iptables -A INPUT -p icmp -d $NEMO --icmp-type 8/0 -j ACCEPT
/sbin/iptables -A INPUT -p icmp -d $NEMO --icmp-type 8/0 -j LOG --log-level 7 --log-prefix "Accept Time Exceeded"
/sbin/iptables -A INPUT -p icmp -d $NEMO --icmp-type 11/0 -j ACCEPT

#############################
# DEFAULT DENY
#############################

/sbin/iptables -A INPUT -d $NEMO -j LOG --log-level 7 --log-prefix "Default Deny"
/sbin/iptables -A INPUT -j DROP

Chcialbym rozbudowac funkcje logow (zeby bylo co ogladac)


Kod:

root@debian:/home/lucas# cat  /proc/net/ip_conntrack
cat: /proc/net/ip_conntrack: No such file or directory
root@debian:/home/lucas#

Ostatnio edytowany przez Novi-cjusz (2015-04-18 18:21:59)


------------------------------------------------------------------------------------
"Inveniam viam aut faciam" : I will either find a way, or I shall make one
"Złoto to pieniądz królów, srebro to pieniądz dżentelmenów, barter to pieniądz chłopów ale dług to pieniądz niewolników."

Offline

 

#10  2015-04-18 18:42:30

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/urandom
Zarejestrowany: 2008-01-07

Re: IPtables log analyzer

Nie masz pliczku /proc/net/ip_conntrack? dziwne.

Kod:

ls -l   /proc/net/ip_conntrack
-r--r----- 1 root proc 0 04-18 18:40 /proc/net/ip_conntrack

PS.
I nie wiem, czy zauważyłeś, ale ten drugi skrypt dotyczy serwera WWW,
a nie dektopa.
Na desktopach bez powodu nie otwiera się portów SSH czy WWW,
nie ma też potrzeby wpuszczania żadnych pakietów ICMP.

A do oglądania lepsza byłaby jakaś Asia, Kasia, Zosia albo Gosia. ;)

SOA#1

Ostatnio edytowany przez Jacekalex (2015-04-18 18:47:09)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#11  2015-04-18 18:55:20

  Novi-cjusz - Użytkownik

Novi-cjusz
Użytkownik
Zarejestrowany: 2013-03-05

Re: IPtables log analyzer

Juz jest

Kod:

root@debian:/home/lucas# cat  /proc/net/ip_conntrack
udp      17 112 src=192.168.0.182 dst=192.168.0.1 sport=47261 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=47261 [ASSURED] mark=0 use=2
udp      17 112 src=192.168.0.182 dst=192.168.0.1 sport=32907 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=32907 [ASSURED] mark=0 use=2
udp      17 112 src=192.168.0.182 dst=192.168.0.1 sport=55822 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=55822 [ASSURED] mark=0 use=2
udp      17 112 src=192.168.0.182 dst=192.168.0.1 sport=49031 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=49031 [ASSURED] mark=0 use=2
udp      17 112 src=192.168.0.182 dst=192.168.0.1 sport=55522 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=55522 [ASSURED] mark=0 use=2
udp      17 111 src=192.168.0.182 dst=192.168.0.1 sport=38500 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=38500 [ASSURED] mark=0 use=2
udp      17 133 src=192.168.0.182 dst=192.168.0.1 sport=37833 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=37833 [ASSURED] mark=0 use=2
udp      17 111 src=192.168.0.182 dst=192.168.0.1 sport=45707 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=45707 [ASSURED] mark=0 use=2
unknown  2 348 src=192.168.0.182 dst=224.0.0.22 [UNREPLIED] src=224.0.0.22 dst=192.168.0.182 mark=0 use=2
udp      17 141 src=192.168.0.182 dst=192.168.0.1 sport=46191 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=46191 [ASSURED] mark=0 use=2
udp      17 142 src=192.168.0.182 dst=192.168.0.1 sport=50581 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=50581 [ASSURED] mark=0 use=2
udp      17 133 src=192.168.0.182 dst=192.168.0.1 sport=59178 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=59178 [ASSURED] mark=0 use=2
udp      17 111 src=192.168.0.182 dst=192.168.0.1 sport=41835 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=41835 [ASSURED] mark=0 use=2
udp      17 142 src=192.168.0.182 dst=192.168.0.1 sport=55263 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=55263 [ASSURED] mark=0 use=2
udp      17 112 src=192.168.0.182 dst=192.168.0.1 sport=49891 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=49891 [ASSURED] mark=0 use=2
tcp      6 431992 ESTABLISHED src=192.168.0.182 dst=88.221.222.88 sport=51295 dport=80 src=88.221.222.88 dst=192.168.0.182 sport=80 dport=51295 [ASSURED] mark=0 use=2
udp      17 133 src=192.168.0.182 dst=192.168.0.1 sport=51047 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=51047 [ASSURED] mark=0 use=2
tcp      6 87 TIME_WAIT src=192.168.0.182 dst=46.105.189.254 sport=49314 dport=443 src=46.105.189.254 dst=192.168.0.182 sport=443 dport=49314 [ASSURED] mark=0 use=2
udp      17 112 src=192.168.0.182 dst=192.168.0.1 sport=44197 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=44197 [ASSURED] mark=0 use=2
udp      17 133 src=192.168.0.182 dst=192.168.0.1 sport=44597 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=44597 [ASSURED] mark=0 use=2
udp      17 29 src=192.168.0.8 dst=224.0.0.251 sport=5353 dport=5353 [UNREPLIED] src=224.0.0.251 dst=192.168.0.8 sport=5353 dport=5353 mark=0 use=2
udp      17 112 src=192.168.0.182 dst=192.168.0.1 sport=52682 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=52682 [ASSURED] mark=0 use=2
udp      17 112 src=192.168.0.182 dst=192.168.0.1 sport=49740 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=49740 [ASSURED] mark=0 use=2
udp      17 112 src=192.168.0.182 dst=192.168.0.1 sport=45176 dport=53 src=192.168.0.1 dst=192.168.0.182 sport=53 dport=45176 [ASSURED] mark=0 use=2
root@debian:/home/lucas#

Na desktopach bez powodu nie otwiera się portów SSH czy WWW,
nie ma też potrzeby wpuszczania żadnych pakietów ICMP[/quote]
Usune te regolki ze skryptu i bedzie O,k

A do oglądania lepsza byłaby jakaś Asia, Kasia, Zosia albo Gosia. ;)[/quote]
Juz sie naoogladalem, iptables ciekawsze...

Ostatnio edytowany przez Novi-cjusz (2015-04-18 18:58:31)


------------------------------------------------------------------------------------
"Inveniam viam aut faciam" : I will either find a way, or I shall make one
"Złoto to pieniądz królów, srebro to pieniądz dżentelmenów, barter to pieniądz chłopów ale dług to pieniądz niewolników."

Offline

 

#12  2015-04-18 19:01:46

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/urandom
Zarejestrowany: 2008-01-07

Re: IPtables log analyzer

[quote=Novi-cjusz]Juz jest
.....

A do oglądania lepsza byłaby jakaś Asia, Kasia, Zosia albo Gosia. ;)[/quote]
Juz sie naoogladalem, iptables ciekawsze...[/quote]
Orientacje hetero znam osobiście, homo kojarzę z telewizora, ale o orientacji iptables to pierwszy raz słyszę. xD

Ostatnio edytowany przez Jacekalex (2015-04-18 19:39:43)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#13  2015-04-18 19:14:15

  Novi-cjusz - Użytkownik

Novi-cjusz
Użytkownik
Zarejestrowany: 2013-03-05

Re: IPtables log analyzer

To takie wspolczesne trendy.
A z regulkami dla serwera jak je usune to bedzie O,k?


------------------------------------------------------------------------------------
"Inveniam viam aut faciam" : I will either find a way, or I shall make one
"Złoto to pieniądz królów, srebro to pieniądz dżentelmenów, barter to pieniądz chłopów ale dług to pieniądz niewolników."

Offline

 

#14  2015-04-18 19:30:05

  uzytkownikubunt - Zbanowany

uzytkownikubunt
Zbanowany
Zarejestrowany: 2012-04-25

Re: IPtables log analyzer

1862

Ostatnio edytowany przez uzytkownikubunt (2016-12-01 01:16:14)

Offline

 

#15  2015-04-18 19:36:21

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/urandom
Zarejestrowany: 2008-01-07

Re: IPtables log analyzer

[quote=uzytkownikubunt][quote=Jacekalex]Na desktopach (..)  nie ma też potrzeby wpuszczania żadnych pakietów ICMP.[/quote]
W przypadku ruchu po UDP (komunikatory wideo, gry sieciowe) są często używane. Przykład: gdy serwer CS zmienia mapę, a klient wysyła pakiety, to w odpowiedzi dostaje się dużo pakietów ICMP 3/3 i czasem 3/10. Conntrack potrafi wyłapać pakiety, które są prymitywnie podszywające się pod inne IP.[/quote]
Nigdy nie wpuszczam ICMP d kompa, i nigdy nie widziałem, żeby coś nie działało.

Faktem jest, że są specjalne moduły do różnych protokołów sieciowych,
np:

Kod:

CONFIG_NF_CONNTRACK_SNMP=m
CONFIG_NF_CONNTRACK_PPTP=m
CONFIG_NF_CONNTRACK_SANE=m
CONFIG_NF_CONNTRACK_SIP=y
CONFIG_NF_CONNTRACK_FTP=y
CONFIG_NF_CONNTRACK_H323=y
CONFIG_NF_CONNTRACK_IRC=y
CONFIG_NF_CONNTRACK_TFTP=m

które rozwiązuję takie problemy, wynikające głównie z konieczności użycia portów pasywnych.


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#16  2015-04-19 08:41:14

  morfik - Cenzor wirtualnego świata

morfik
Cenzor wirtualnego świata
Skąd: ze WSI
Zarejestrowany: 2011-09-15
Serwis

Re: IPtables log analyzer

Ja u siebie też mam zablokowane pakiety icmp z netu (stan NEW) ale nawet na logikę, masz szereg komputerów za NAT i te nie mogą dostawać pakietów w stanie NEW i jak sieć w ich przypadku może działać poprawnie? No przez regułę ESTABLISHED,RELATED i tutaj trafia sporo pakietów icmp. U mnie na routerze po prawie 30dniach uptime, tych icmp w stanie NEW to mam niecałe 200, choć i one nie powinny do mnie powędrować, a ten kto to wysłał obskoczył bana z automatu na dłuższy czas i to nie tylko na słanie pakietów icmp. xD

A co do tablicy conntracka jeszcze, to są dwa pliki: /proc/net/ip_conntrack i /proc/net/nf_conntrack i mój router też nie ma już tego pierwszego ale na debianie wciąż są oba.

Ostatnio edytowany przez morfik (2015-04-19 08:43:46)

Offline

 

#17  2015-04-19 11:53:50

  Novi-cjusz - Użytkownik

Novi-cjusz
Użytkownik
Zarejestrowany: 2013-03-05

Re: IPtables log analyzer

Wracam do konfigu Jacekalex

Kod:

iptables -F
iptables -X
iptables -P INPUT DROP
iptables -P OUTPUT ACCEPT
iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT

Bardzo "niezdrowe" sa zarowno niewlasciwe polaczenia IN jak rowniez "OUT"

Jaka jest Twoja propozycja korekcji ww konfiguracji firewalla:

1 - o kontrole ruchu OUTPUT
2 - logowanie pakietow: DROP,bogus,defragmentowanych

Jak wygladalby wtedy zmodyfikowany skrypt?


------------------------------------------------------------------------------------
"Inveniam viam aut faciam" : I will either find a way, or I shall make one
"Złoto to pieniądz królów, srebro to pieniądz dżentelmenów, barter to pieniądz chłopów ale dług to pieniądz niewolników."

Offline

 

#18  2015-04-19 12:11:13

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/urandom
Zarejestrowany: 2008-01-07

Re: IPtables log analyzer

Z OUTPUTem na Debianie na razie jest mały problem:

Kod:

 iptables -m cgroup --help
iptables v1.4.21: Couldn't load match `cgroup':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.

W Gentusiu mam niby tego samego Iptables, ale:

Kod:

iptables v1.4.21
......
cgroup match options:
[!] --cgroup fwid  Match cgroup fwid

Moduł Cgroup już siedzi na serwerze Git Netfiltera, ale trzeba ręcznie ściągnąć odpowiednie pliki, dorzucić do źródeł Iptables i skompilować ze źródełka.
W Gentoo to nie jest problem, ale Debian to nie Gentuś, tutaj zabawa jest troszkę trudniejsza.

Przez system cgroup można każdemu praktycznie programowi ustalić limity procka, ramu, i przy pomocy netfiltera także dostęp do sieci.
Ale kernel iptables musi mieć to wsparcie, to ta łatka:
https://git.netfilter.org/iptables/commit/?id=6465867eb48506687872b838b1ddfee61d1a0aeb

A to są pliki:
https://git.netfilter.org/iptables/plain/extensions/libxt_cgroup.c
https://git.netfilter.org/iptables/plain/extensions/libxt_cgroup.man

Potem sprawa jest banalnie prosta, chociaż troszkę gimnastyki jest.

Reguły logowania możesz sobie ustalić dowolnie, pamiętaj tylko, żeby reguła logowania była przez regułą akceptującą lub odrzucającą pakiet, i żeby logować nawiązane połączenia, a nie przepływające pakiety, bo się przez przypadek możesz dorobić miliona logów za dwa dni. :D
Dlatego reguły logowania używaj z modułem conntrack, np:

Kod:

iptables -I OUTPUT -m conntrack --ctstate NEW,INVALID -j LOG --log-prefix "OUTPUT"

Pozdro
;-)

Ostatnio edytowany przez Jacekalex (2015-04-19 12:29:11)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#19  2015-04-19 12:33:15

  Novi-cjusz - Użytkownik

Novi-cjusz
Użytkownik
Zarejestrowany: 2013-03-05

Re: IPtables log analyzer

Chapeau bas dla Jacekalex.
Dziekuje.

Chyba dzis nie bedzie spaceru (:(

Z Git jeszcze nie mialem do czynienia.

Zainstalowalem.
Skonfigurowalem.

Gdyby ktos podal linka do tutoriala z Git potrzebnego w aktualnej sytuacji.

Kod:

root@debian:/home/lucas# git clone git.netfilter.org/iptables
fatal: repository 'git.netfilter.org/iptables' does not exist
root@debian:/home/lucas#

???

Kod:

root@debian:/home/lucas# git clone git:netfilter.org/iptables
Cloning into 'iptables'...
ssh: Could not resolve hostname git: Name or service not known
fatal: The remote end hung up unexpectedly
root@debian:/home/lucas#

????

Samemu ciezko.

Kod:

root@debian:/home/lucas# git clone git://git.netfilter.org/iptables.git
fatal: destination path 'iptables' already exists and is not an empty directory.
root@debian:/home/lucas#

????

Maly krok do przodu:

Kod:

root@debian:/home/lucas# git clone git://netfilter.org/iptables
Cloning into 'iptables'...
remote: Counting objects: 15733, done.
remote: Compressing objects: 100% (4323/4323), done.
remote: Total 15733 (delta 12043), reused 14785 (delta 11356)
Receiving objects: 100% (15733/15733), 2.99 MiB | 1.43 MiB/s, done.
Resolving deltas: 100% (12043/12043), done.
root@debian:/home/lucas#

Dwa pozostale linki

Kod:

root@debian:/home/lucas# git clone git://git.netfilter.org/iptables/plain/extensions/libxt_cgroup.c
Cloning into 'libxt_cgroup.c'...
fatal: remote error: access denied or repository not exported: /iptables/plain/extensions/libxt_cgroup.c
root@debian:/home/lucas# git clone git://git.netfilter.org/iptables/plain/extensions/libxt_cgroup.man
Cloning into 'libxt_cgroup.man'...
fatal: remote error: access denied or repository not exported: /iptables/plain/extensions/libxt_cgroup.man
root@debian:/home/lucas#

Ostatnio edytowany przez Novi-cjusz (2015-04-19 19:39:59)


------------------------------------------------------------------------------------
"Inveniam viam aut faciam" : I will either find a way, or I shall make one
"Złoto to pieniądz królów, srebro to pieniądz dżentelmenów, barter to pieniądz chłopów ale dług to pieniądz niewolników."

Offline

 

#20  2015-08-09 13:00:44

  Novi-cjusz - Użytkownik

Novi-cjusz
Użytkownik
Zarejestrowany: 2013-03-05

Re: IPtables log analyzer

Po przerwie wracam do tematu.
Jacekalex:

Moduł Cgroup już siedzi na serwerze Git Netfiltera, ale trzeba ręcznie ściągnąć odpowiednie pliki, dorzucić do źródeł Iptables i skompilować ze źródełka.[/quote]
Na bazie tej strony:http://users.wowway.com/~zlinuxman/Kernel.htm
Zrobilem tak:

Kod:

Kernel compilation (kolejne kroki)

Introduction ( # jako root;  $  jako uzytkownik z grupy src)
Dodajemy uzytkownika adam do gupy src (adam =userid dla wszystkich operacji ktore nie musza  byc wykonane przez root-a)

     # adduser adam src                   (zamiast adam – nazwa uzytkownika)

Sprawdzamy czy adam jest w grupie src (zwykle trzeba sie wylogowac/zalogowac zanim widoczne zmiany)

# groups adam

Sprawdzamy prawa do katalogu /usr/src (grupa->src z prawami rws)

     $ ls -ld /usr/src
     drwxrwsr-x 3 root src 4096 Aug 24 13:52 /usr/src

zmieniamy w razie potrzeby grupe i prawa dostepu do katalogu /usr/src

# chmod g+s /usr/src
# chmod g+w /usr/src
#chgrp src /usr/src

Step 1: Update Your sources.list File

The retrieval of packages in Debian is controlled by a file called /etc/apt/sources.list.
Dodajemy instalacyjne DVD do /etc/apt/sources.list
Dla kazdego krazka powtarzamy:

# apt-cdrom add


Jesli automount sprawia problem mozna chwilowo zablokowac (udisks-daemon)  w osobnym terminalu uruchamiamy (komenda ma “wisiec” jak dlugo jest potrzebna)
# udisks --inhibit-polling /dev/sr0
Przerwanie powyzszej komendy (CTRL-C)

full list of Debian mirrors, see http://www.debian.org/mirror/list
.
sample sources.list file for a system running the current stable release, jessie (8.x):
# deb cdrom:[Debian GNU/Linux 8 _Jessie_ - Official Snapshot amd64 LIVE/INSTALL Binary 20150425-14:07]/ jessie main

deb cdrom:[Debian GNU/Linux 8.0.0 _Jessie_ - Official amd64 DVD Binary-3 20150425-12:54]/ jessie contrib main
deb cdrom:[Debian GNU/Linux 8.0.0 _Jessie_ - Official amd64 DVD Binary-2 20150425-12:54]/ jessie contrib main
deb cdrom:[Debian GNU/Linux 8 _Jessie_ - Official Snapshot amd64 LIVE/INSTALL Binary 20150425-14:07]/ jessie main

deb ftp://carroll.aset.psu.edu/pub/linux/distributions/debian jessie main non-free contrib
deb-src ftp://carroll.aset.psu.edu/pub/linux/distributions/debian jessie main non-free contrib
deb ftp://carroll.aset.psu.edu/pub/linux/distributions/debian jessie-updates main non-free contrib
deb-src ftp://carroll.aset.psu.edu/pub/linux/distributions/debian jessie-updates main non-free contrib

deb http://security.debian.org/ jessie/updates main
deb-src http://security.debian.org/ jessie/updates main

Note: always use a release code name, such as jessie, stretch, ect
Here is a sample sources.list file for a system which is running the current testing release (stretch) but that also needs one or more packages from the unstable release (sid) or experimental:
.
     . (possible CD/DVD/Blu-ray entries added by apt-cdrom)
     .
     deb ftp://carroll.aset.psu.edu/pub/linux/distributions/debian stretch main non-free contrib
     deb-src ftp://carroll.aset.psu.edu/pub/linux/distributions/debian stretch main non-free contrib
     deb ftp://carroll.aset.psu.edu/pub/linux/distributions/debian sid main non-free contrib
     deb-src ftp://carroll.aset.psu.edu/pub/linux/distributions/debian sid main non-free contrib
     deb ftp://carroll.aset.psu.edu/pub/linux/distributions/debian experimental main non-free contrib
     deb-src ftp://carroll.aset.psu.edu/pub/linux/distributions/debian experimental main non-free contrib
When mixing releases in the same system, it is important to define the default release.  You do this in /etc/apt/apt.conf.  Put a line such as the following in the above-named file: 
 
     APT::Default-Release "stretch";
With the exception of the security site, which must use HTTP, you have a choice, for most of the Debian mirrors, whether to use HTTP or FTP as the file transfer protocol.
Make sure that the internet sources are listed after the CD/DVD/Blu-ray sources, and make sure that the security source is listed last.



Step 2: Update the List of Available Packages

# apt-get update

Step 3: Apply Pending Updates

   #  apt-get upgrade
   #  apt-get clean
   #  apt-get --purge dist-upgrade
  #   apt-get clean
  #   apt-get --purge autoremove
  #   aptitude forget-new
  #   aptitude keep-all

rebuild their initial RAM file system image files (dla kazdej uzywanej wersji kernela po instalacji update dobrze jest dla pewosci zrobic to recznie ):
If you apply maintenance and it causes the initial RAM file system image file for your running kernel to be re-built, shutdown and boot the other installed kernel images in turn and rebuild their initial RAM file system image files with 

  #   update-initramfs -u -k $(uname -r)

Continue the process until all the initial RAM file system image files have been rebuilt while running the corresponding kernel


Step 4: Install the Kernel Source Package

Sprawdzamy  wersje kernel
# uname -r
Listujemy dostepne wersje kernel Source Package
# apt-cache -n search linux-source-
Instalacja Kernel Source Package
# apt-get install linux-source-3.16
------------------------------
When manually downloading a pristine kernel source tarball, do so as the non-root user and download to directory /usr/src.
If you have out-of-kernel-source-tree kernel module source packages to install, do that at this time also.
------------------------------
Po instalacji na koncu usuwamy zbedne (.deb files) from the package cache:
# apt-get clean

Step 5: Unpack the Kernel Sources

Jako user  adam (non-root) rozpakowujemy plik tar
$ cd /usr/src
$ tar -xJ -f linux-source-3.16.tar.xz
Usuwamy juz zbedny plik tar
$ rm -f linux-source-3.16.tar.xz

(file name ending in ".tar.bz2  "-j" switch zamiast “-J” w tar command)
--------------------------
Dla wheezy (7.x)
Official Debian Linux kernel source packages for wheezy (7.x) install another file in /usr/src besides the source tarball.  Package linux-source-3.2 installs fileslinux-source-3.2.tar.bz2 and linux-patch-3.2-rt.patch.bz2.  The first file is the standard source tarball; the second is a compressed patch file which you can apply to the kernel source if you want your custom kernel to be capable of real-time preemption.  (These patches have historically been published only for even-numbered kernel releases, such as 3.0.x, 3.2.x, 3.4.x, etc.  Real-time preemption is supported only for the i386 (686-pae) and amd64 architectures.)  If you want to incorporate the patch file into your kernel source, then issue the following sequence of commands after unpacking your kernel source code:
$ cd /usr/src
$ bunzip2 linux-patch-3.2-rt.patch.bz2
$ cd linux-source-3.2
$ patch -p1 <../linux-patch-3.2-rt.patch
$ cd ..
$ rm linux-patch-3.2-rt.patch
---------------------------
Note: at the time of this writing, real-time preemption patches for kernel version 3.16, used by jessie, are not yet available.  It appears that funding problems are responsible for the delay.  The real time preemption patch file, if present, may be decompressed by using the unxz command.  If you receive an error message from unxz about not being able to set the group, ignore it.
If you have installed out-of-kernel-source-tree kernel module source packages, their tar files will also be present in /usr/src.  Unpack them also in a similar manner and then delete the tar files once they have been successfully unpacked.  These tar files will be extracted to a directory under /usr/src/modules.



Step 6: Install kernel-package

Upewniamy sie czy kernel-package jest zainstalowany

# dpkg-query -l kernel-package|grep ii
Jesli nie to instalujemy
# apt-get --no-install-recommends install kernel-package

Read the README file for kernel-package. 
 
# zless /usr/share/doc/kernel-package/README.gz

At the time of this writing, the following packages will be required for the menuconfig method under Debian wheezy (7.x) and later releases: 
 
     gcc 
     libc6-dev
     libncurses5-dev
     binutils
     make
     kmod 
     mawk 
     gzip
     coreutils
     grep
     zlib1g-dev 
     fakeroot 


To check to see if these packages are installed:

#  dpkg-query -l gcc|grep ii

Instalacja brakujacych pakietow np

# apt-get install libncurses5-dev zlib1g-dev
# apt-get install libpam-cgroup
# apt-get install cgroup-bin

# apt-get clean

.......................
# apt-get install git git-core
# cd /usr/src
# git clone git://git.netfilter.org/iptables

$ ./configure
    $ make
    # make install

....
# git config --global user.name "NewUser"
# git config --global user.email newuser@example.com
....

....................................


Instalacja patch-y
to fix the s390x support in the jessie (8.x) version of kernel-package, use this patch    ……..  .  As root, copy the applicable patch to the /usr/share/kernel-package directory, then apply the patch.  For example,
#  cd /usr/share/kernel-package

   [download the patch with your browser]

# patch -p1 <fix-s390x.patch



Step 7: Patch the Kernel

Jako adam (non-root user)
Instalacja przykladowego patcha (plik o nazwie edid_strict.diff w katalogu /usr/src):

$ cd /usr/src/linux-source-3.16
$  patch -p1 <../edid_strict.diff

Now create a file in /etc/modprobe.d called local.conf.  (You'll have to create this file as root.)  Put the following line in it: 
 
     options drm edid_strict=0



Step 8: Configure the Kernel

as a non-root user (adam)

$  cd /usr/src/linux-source-3.16

Sprawdzic nazwe pliku /boot/config-3.16….. w zainstalowanej wersji Debiana np:

$ ls /boot | grep config

$ cp /boot/config-3.16.0-4-686-pae   .config
…………………..
Also, if you have applied the patches for real-time pre-emption  has "-rt" in its package name as config-3.16.0-4-rt-686-pae
…………………..
Starting with Debian package linux-source-3.10, installing the kernel source package now creates a new directory in /usr/src called linux-config-3.xx, which contains xz-compressed config files for each architecture supported by the Linux kernel.  This means that you don't have to install the stock kernel which corresponds to the source package in order to get a copy of its config file.  Instead, you just have to copy the right file from the linux-config-3.xx directory.  For example, 
 
     cd /usr/src
     cp linux-config-3.16/config.i386_none_686-pae.xz .
     unxz config.i386_none_686-pae.xz
     cp config.i386_none_686-pae linux-source-3.16/.config
     rm config.i386_none_686-pae
     cd linux-source-3.16
………………………………..
configure the kernel:

$ make menuconfig
: In the process of configuring your kernel, make sure that you leave CONFIG_BLK_DEV_INITRD set to Y, which is the default

Note: Newer kernel config files contain some settings that you should not use.  These include CONFIG_LOCALVERSION (Local version - append to kernel release) and CONFIG_LOCALVERSION_AUTO
If you don't wish to change anything, immediately select "Exit" when the initial screen is displayed.
starting with kernel version 2.6.32, a new kernel configuration option is available called "make localmodconfig".  First, initialize the .config file, as documented above, then run the "make localmodconfig" command.  It runs "lsmod" to find all the modules loaded on the currently running system.  It will then read all the "Makefile" files to map which CONFIG_* option enables which module.  It will then read the Kconfig files to find the dependencies and selects that may be needed to support a CONFIG_* option.  Finally, it reads the .config file and removes any module ("=m") that is not needed to enable the currently loaded modules.  With this tool, you can strip the .config file of all drivers which are not useful in your machine; and it will take much less time to build the kernel.  80% compile time reduction seems to be typical, depending on the architecture.  Architectures with more drivers available obviously yield more compile time savings.


Step 9: Create the Kernel Image Package
as a non-root user (adam)
……………………………..
when the package file gets installed, the kernel revision name does not become part of the package name. It also does not become part of the kernel image file name or the initial RAM file system image file name that gets created in the/boot directory.  Similarly, the directory in which the kernel modules get installed (/lib/modules/...) does not contain the kernel revision name either.  Since you want to retain your existing kernel image file, initial RAM file system image file, and kernel modules unaltered as a backout, you must make the kernel version name different from the stock kernel version name in some way. This is accomplished by means of the "--append-to-version" flag of make-kpkg.  I usually include the word "custom" in the name to distinguish it from the stock kernel of the same version. In this example, the stock kernel has an "--append-to-version" value of "-4-686-pae".  (In other words, "uname -r" reports"3.16.0-4-686-pae".  The version proper is "3.16.0" and the "--append-to-version" value is "-4-686-pae".)  My first cut at a custom kernel would probably have an"--append-to-version" value of "-4custom01-686-pae".  For subsequent custom versions of the same kernel I would probably use "-4custom02-686-pae","-4custom03-686-pae", etc.
 For example, at the time of this writing, the current "--revision" value is "3.16.7-ckt7-1", which corresponds to Debian base release 8.0.  I obtain this value from the version reported by "dpkg-query -W linux-source-3.16" or "dpkg-query -W linux-image-3.16.0-4-686-pae"
  If the kernel source package and the stock kernel image package are in sync, their versions will match.  In case of a discrepancy, use the version from the source package, since that is what you are actually compiling.  It's confusing that the package "version" matches the kernel "revision", but that is the gist of it.
………………………
starting with wheezy (7.x).  The kernel's "internal version" is no longer consistent with the version implied by the package name for stock kernel image packages.  The three parts of the kernel version are known as "VERSION", "PATCHLEVEL", and "SUBLEVEL", from left to right, and the "SUBLEVEL" for a stock kernel image package in wheezy (7.x) and later releases is always set to 0, regardless of the actual SUBLEVEL value of the kernel source code.
………………………..
 For example, at the time of this writing, the stock kernel image package name in jessie (8.x) for modern machines of the i386 architecture is"linux-image-3.16.0-4-686-pae".  This package name implies that the kernel version proper is "3.16.0" and the "--append-to-version" value is "-4-686-pae". However, the internal version proper, at the time of this writing, is actually "3.16.7".  This is reflected in the package version, which is, at the time of this writing,"3.16.7-ckt7-1".  (This corresponds to the "--revision" option of make-kpkg.)  The corresponding kernel source package name is "linux-source-3.16".  It also has a package version of "3.16.7-ckt7-1" at the time of this writing.
…………………….
When you build a kernel image package with make-kpkg, it always uses the internal version name, which in this example is 3.16.7, when constructing a package name.
So if you download kernel source package "linux-source-3.16" and build a custom kernel from it using make-kpkg, the package name will start out with"linux-image-3.16.7" (at the time of this writing), instead of "linux-image-3.16.0", as it would be for a stock kernel.  This will be followed by the value of EXTRAVERSION, followed by whatever you specify with the "--append-to-version" option
………………………………………..

    $ make-kpkg --append-to-version -4custom01-686-pae \
      --revision 3.16.7-ckt7-1 --initrd --rootcmd fakeroot \
      kernel_image modules_image

………………………………………
If you don't have any out-of-kernel-source-tree kernel module source packages installed, you can omit the modules_image target.  The "--initrd" flag indicates that a kernel which uses an initial RAM file system image file is to be built.  The actual initial RAM file system image file, however, is not built at this time. If you are intentionally building a kernel image package which contains no initial RAM file system support, omit this option.  The"--rootcmd fakeroot" option tells make-kpkg what command to issue in order to become root.  (In this case, it only simulates becoming root; but that is good enough for package-building purposes.)
By using the "getconf" command, you can set CONCURRENCY_LEVEL to the number of processors currently online, which, assuming that you have sufficient memory (RAM), will be the optimum value for compiling the kernel in the shortest possible time.  For example, 
 
 $ CONCURRENCY_LEVEL=$(getconf _NPROCESSORS_ONLN) make-kpkg ...


For example, ifsl-modem-dkms is the only out-of-kernel-source-tree kernel module source package that you have to deal with, your command would look like this: 
 
   $  make-kpkg --append-to-version -4custom01-686-pae \
       --revision 3.16.7-ckt7-1 --initrd --rootcmd fakeroot \
       kernel_image kernel_headers
.  If you have a mixture of out-of-kernel-source-tree kernel module source packages to deal with, some of which are designed for use with kernel-package and some of which are not, you will need to use all three targets: kernel_image, kernel_headers, and modules_image.



Step 10: Customize the Kernel Installation Environment
   
As root

…………………..
The Debian kernel team used to use kernel-package (make-kpkg) to create official Debian stock kernel image packages
configuration file, if it is present, called /etc/kernel-img.conf, which can be used to "tune" the kernel installation environment.
  (Note: starting with jessie (8.x), the man page for kernel-img.conf(5) now resides in thekernel-common package.)
For users who only use official Debian stock kernel image packages, they must install kernel-package (and all of its dependencies) in order to get the man page for kernel-img.conf(5)

Customizing the wheezy (7.x) Environment , jessie (8.x) and The stretch (9.x) Environment

The maintainer scripts no longer perform most post-installation tasks, such as building an initial RAM file system image file, updating symbolic links, or running the boot loader installer
maintainer scripts rely on "hook scripts
After a kernel image package is installed, any executable files found in /etc/kernel/postinst.d will be invoked. One of the post-installation scripts in this directory is initramfs-tools
For completeness' sake, I should mention that there are three other directories where hook scripts can be installed: /etc/kernel/preinst.d, /etc/kernel/prerm.d, and/etc/initramfs/post-update.d.  

In summary, this is what I recommend for /etc/kernel-img.conf for squeeze (6.0) and later releases when the proper hook scripts are used: If you have the zy-symlinks hook scripts installed
 
     do_symlinks = no
Regardless of whether you are running wheezy (7.x), jessie (8.x), or stretch (9.x), the customization of the kernel installation environment only needs to be done the first time you prepare to install a kernel image package created by make-kpkg or "make deb-pkg".  Once you've done it, you can create as many kernel image packages with make-kpkg or "make deb-pkg" as needed and install them, skipping this step



Step 11: Install the Kernel Image Package

as root
use the low-level package tool dpkg:

  #   cd /usr/src
   #  dpkg -i linux-image-3.16.7-ckt7-4custom01-686-pae_3.16.7-ckt7-1_i386.deb

Step 12: Shutdown and Reboot
#  shutdown -r now;exit

Step 13: Clean Up
  $   cd /usr/src
   $  rm linux-image-3.16.7-ckt7-4custom01-686-pae_3.16.7-ckt7-1_i386.deb

Step 13a: Clean Up (Part Two)
For example, if my system now depends on a kernel module that did not exist in the old kernel, there's not much point in keeping the old kernel around. 
 
   #     apt-get purge linux-image-3.16.0-4-686-pae
This will de-install the old kernel image package and save some more disk space

Step 14: Maintenance

     $ cd /usr/src/linux-source-3.16
     $ make-kpkg --rootcmd fakeroot modules_clean
     $ make-kpkg clean
     $ make menuconfig
     $ make-kpkg --append-to-version -4custom02-686-pae \
     > --revision 3.16.7-ckt7-1 --initrd --rootcmd fakeroot \
     > kernel_image modules_image
     $ cd ..
     $ su
     # dpkg -i linux-image-3.16.7-ckt7-4custom02-686-pae_3.16.7-ckt7-1_i386.deb
     .
     . ("dpkg -i" commands to install the modules image package files)
     .
     # exit
     .
     . ("rm" commands to remove the modules image package files)
     .
     $ rm linux-image-3.16.7-ckt7-4custom02-686-pae_3.16.7-ckt7-1_i386.deb
     $ su
     # shutdown -r now;exit

Czy to jest dobrze???
Co dalej?

Ostatnio edytowany przez Novi-cjusz (2015-08-09 13:02:05)


------------------------------------------------------------------------------------
"Inveniam viam aut faciam" : I will either find a way, or I shall make one
"Złoto to pieniądz królów, srebro to pieniądz dżentelmenów, barter to pieniądz chłopów ale dług to pieniądz niewolników."

Offline

 

#21  2015-08-09 13:25:49

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/urandom
Zarejestrowany: 2008-01-07

Re: IPtables log analyzer

Po co tak kombinujesz?

Kod:

aptitude install dpkg-dev
apt-get build-dep iptables
apt-get source iptables

Ściągasz ręcznie łatki, wypakowujesz w źródłach [b]iptables[/b] w folderze [b]extensions[/b], potem w folderze że  źródłami odpalasz:

Kod:

 dpkg-buildpackage

i powinien zbudować paczkę z załatanym iptables.

EDIT:
Była spora gimnastyka dpkg-buildpackage nie chciał tego zbudować, musiałem zbudować z palca i zbudowałem paczki [b]checkinstall[/b]em,
potem musiałem wywalić oryginalny  [b]iptables[/b] i [b]libxtables10[/b] i zainstalować te paczki zbudowane przez [b]checkinstall[/b]a, ale moduł już jest na swoim miejscu.

Kod:

root ~> iptables -V
iptables v1.4.21

root ~> iptables -m cgroup --help | tail -n 2
cgroup match options:
[!] --cgroup fwid  Match cgroup fwid

Radziłbym napisać na bugzilli Debiana, żeby dodali tą łatkę Developerzy,
zamiast się gimnastykować z dpkg.

W jaju moduł już jest, trzeba go tylko załadować.

Ostatnio edytowany przez Jacekalex (2015-08-09 14:03:40)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#22  2015-08-10 17:54:33

  Novi-cjusz - Użytkownik

Novi-cjusz
Użytkownik
Zarejestrowany: 2013-03-05

Re: IPtables log analyzer

@Jacekalex
Mozna prosic o linka do tej paczki, ktora zbudowales checkinstallem ;-)


------------------------------------------------------------------------------------
"Inveniam viam aut faciam" : I will either find a way, or I shall make one
"Złoto to pieniądz królów, srebro to pieniądz dżentelmenów, barter to pieniądz chłopów ale dług to pieniądz niewolników."

Offline

 

#23  2015-08-10 18:24:57

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/urandom
Zarejestrowany: 2008-01-07

Re: IPtables log analyzer

[quote=Novi-cjusz]@Jacekalex
Mozna prosic o linka do tej paczki, ktora zbudowales checkinstallem ;-)[/quote]
W tej chwili tylko taki, masz tam pliczek SHA512.txt z sumami kontrolnymi SHA512:
https://drive.google.com/folderview?id=0BxnxcErK-vmSfnh0MHFVWnZXb2lTYThnb21sQUx4a2o1bEVZS3dQTEd2ckRTQ1dHVFUtMEE&usp=sharing

Budowane na testingu:

Kod:

Debian GNU/Linux stretch/sid  x86_64 
gcc version 4.9.3 (Debian 4.9.3-3)

przez chroota z systemu:

Kod:

Linux version 4.1.4-gr1 (root@localhost) (gcc version 4.8.4 (Gentoo Hardened 4.8.4 p1.4, pie-0.6.1) ) #1 SMP PREEMPT Wed Aug 5 19:08:53 CEST 2015

Sprawdzanie sum kontrolnych:

Kod:

sha512sum -c SHA512.txt 
iptables_1.4.21-2_amd64.deb: DOBRZE
libxtables10_1.4.21-2_amd64.deb: DOBRZE

Pozdro
;-)

Ostatnio edytowany przez Jacekalex (2015-08-10 19:13:04)


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

#24  2015-08-10 19:11:36

  Novi-cjusz - Użytkownik

Novi-cjusz
Użytkownik
Zarejestrowany: 2013-03-05

Re: IPtables log analyzer

Chapeau bas dla Jacekalex ;-)


------------------------------------------------------------------------------------
"Inveniam viam aut faciam" : I will either find a way, or I shall make one
"Złoto to pieniądz królów, srebro to pieniądz dżentelmenów, barter to pieniądz chłopów ale dług to pieniądz niewolników."

Offline

 

#25  2015-08-10 19:30:46

  Jacekalex - Podobno człowiek...;)

Jacekalex
Podobno człowiek...;)
Skąd: /dev/urandom
Zarejestrowany: 2008-01-07

Re: IPtables log analyzer

[quote=Novi-cjusz]Chapeau bas dla Jacekalex ;-)[/quote]
Zamiast tu szapobasować, to lepiej napisz na bugzillę Debiana, żeby te łatki bez żadnej łaski wylądowały w stabilnym wydaniu iptables z repo. :D


W demokracji każdy naród ma taką władzę, na jaką zasługuje ;)
Si vis pacem  para bellum  ;)       |       Pozdrawiam :)

Offline

 

Stopka forum

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson
Nas ludzie lubią po prostu, a nie klikając w przyciski ;-)

[ Generated in 0.013 seconds, 9 queries executed ]

Informacje debugowania

Time (s) Query
0.00011 SET CHARSET latin2
0.00004 SET NAMES latin2
0.00108 SELECT u.*, g.*, o.logged FROM punbb_users AS u INNER JOIN punbb_groups AS g ON u.group_id=g.g_id LEFT JOIN punbb_online AS o ON o.ident='3.16.135.225' WHERE u.id=1
0.00077 REPLACE INTO punbb_online (user_id, ident, logged) VALUES(1, '3.16.135.225', 1728222522)
0.00054 SELECT * FROM punbb_online WHERE logged<1728222222
0.00064 SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM punbb_topics AS t INNER JOIN punbb_forums AS f ON f.id=t.forum_id LEFT JOIN punbb_forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id=27279 AND t.moved_to IS NULL
0.00022 SELECT search_for, replace_with FROM punbb_censoring
0.00388 SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM punbb_posts AS p INNER JOIN punbb_users AS u ON u.id=p.poster_id INNER JOIN punbb_groups AS g ON g.g_id=u.group_id LEFT JOIN punbb_online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id=27279 ORDER BY p.id LIMIT 0,25
0.00116 UPDATE punbb_topics SET num_views=num_views+1 WHERE id=27279
Total query time: 0.00844 s