• Serveurs
  • [Discussion] : Sécurisation & Logs {nginx} {lighttpd}

Bonjour à tous,

J'ai suivi le tuto pour sécuriser mon install je remercie Ex_Rat pour le travail énorme de vulgarisation et simplification. Depuis quelques semaines j'ai modifié le niveau de détail de Logwatch à "mid" pour avoir un peut plus de détails sur le log journalier.

Ce week end, j'ai eu des alertes dans le log matinal dans la section Kernel avec de nombreuses tentatives depuis une IP inconnue. Quelqu'un sait-il de quoi il peut s'agir ?
1 Time(s): Peer xxx.xxx.xx.xxx:61345/40500 unexpectedly shrunk window 3838100951:3838104016 (repaired)
J'ai masqué l'IP d'origine.

Merci à vous
Merci ! J'avais pourtant fait une recherche mais pas avec les bons termes. Désolé
NP, le principal étant d'avoir trouvé ta solution
11 jours plus tard
un copy/paste une ligne trop longue dans la parti Logwatch
 /usr/share/logwatch/default.conf/logfiles/nginx.conf 
...
# vi: shiftwidth=3 tabstop=3 et
Salut
Je ne pige pas le soucis que tu veux me montrer, soit plus explicite
La ligne est ok, du coup je vois pas:
nano /usr/share/logwatch/default.conf/logfiles/nginx.conf
root@xxxxx:~# cd /usr/share/logwatch/default.conf/logfiles
root@xxxxx:/usr/share/logwatch/default.conf/logfiles# ls -l
total 216
-rw-r--r-- 1 root root  645 juin   1  2013 audit_log.conf
-rw-r--r-- 1 root root  624 nov.  28  2013 autorpm.conf
-rw-r--r-- 1 root root  520 nov.  28  2013 bfd.conf
-rw-r--r-- 1 root root 1008 nov.  28  2013 cisco.conf
-rw-r--r-- 1 root root  838 nov.  28  2013 citadel.conf
-rw-r--r-- 1 root root  840 août  13  2011 clamav.conf
-rw-r--r-- 1 root root 2344 août  13  2011 clam-update.conf
-rw-r--r-- 1 root root  880 nov.  28  2013 cron.conf
-rw-r--r-- 1 root root 1002 nov.  28  2013 daemon.conf
-rw-r--r-- 1 root root  519 nov.  28  2013 denyhosts.conf
-rw-r--r-- 1 root root  232 juil. 26  2014 dirsrv.conf
-rw-r--r-- 1 root root 2831 nov.  28  2013 dnssec.conf
-rw-r--r-- 1 root root  864 nov.  28  2013 dpkg.conf
-rw-r--r-- 1 root root  943 nov.  28  2013 emerge.conf
-rw-r--r-- 1 root root 1485 nov.  28  2013 eventlog.conf
-rw-r--r-- 1 root root 1190 nov.  28  2013 exim.conf
-rw-r--r-- 1 root root 1051 nov.  28  2013 extreme-networks.conf
-rw-r--r-- 1 root root  965 nov.  28  2013 fail2ban.conf
-rw-r--r-- 1 root root  665 mai    4  2012 freeradius.conf
-rw-r--r-- 1 root root 1317 juil. 26  2014 http.conf
-rw-r--r-- 1 root root 1317 mai    3  2013 http-error.conf
-rw-r--r-- 1 root root  871 nov.  28  2013 iptables.conf
-rw-r--r-- 1 root root  993 nov.  28  2013 kernel.conf
-rw-r--r-- 1 root root 1149 juil. 26  2014 maillog.conf
-rw-r--r-- 1 root root 1187 nov.  28  2013 messages.conf
-rw-r--r-- 1 root root  507 août  13  2011 mysql.conf
-rw-r--r-- 1 root root  738 nov.  28  2013 mysql-mmm.conf
-rw-r--r-- 1 root root 1065 nov.  28  2013 netopia.conf
-rw-r--r-- 1 root root 1073 nov.  28  2013 netscreen.conf
-rw-r--r-- 1 root root  731 sept.  2 20:52 nginx.conf
-rw-r--r-- 1 root root 1383 nov.  28  2013 php.conf
-rw-r--r-- 1 root root  488 nov.  28  2013 pix.conf
-rw-r--r-- 1 root root  988 mai    3  2013 postgresql.conf
-rw-r--r-- 1 root root  911 nov.  28  2013 pureftp.conf
-rw-r--r-- 1 root root  618 nov.  28  2013 qmail-pop3d-current.conf
-rw-r--r-- 1 root root  622 nov.  28  2013 qmail-pop3ds-current.conf
-rw-r--r-- 1 root root  604 nov.  28  2013 qmail-send-current.conf
-rw-r--r-- 1 root root  618 nov.  28  2013 qmail-smtpd-current.conf
-rw-r--r-- 1 root root 2889 nov.  28  2013 resolver.conf
-rw-r--r-- 1 root root  612 nov.  28  2013 rt314.conf
-rw-r--r-- 1 root root  671 nov.  28  2013 samba.conf
-rw-r--r-- 1 root root 1143 nov.  28  2013 secure.conf
-rw-r--r-- 1 root root 1080 nov.  28  2013 sonicwall.conf
-rw-r--r-- 1 root root 1240 oct.   6  2014 spamassassin.conf
-rw-r--r-- 1 root root 1229 nov.  28  2013 syslog.conf
-rw-r--r-- 1 root root  406 août  13  2011 tac_acc.conf
-rw-r--r-- 1 root root  833 nov.  28  2013 tivoli-smc.conf
-rw-r--r-- 1 root root  821 nov.  28  2013 up2date.conf
-rw-r--r-- 1 root root  674 nov.  28  2013 vdr.conf
-rw-r--r-- 1 root root  923 nov.   3  2014 vsftpd.conf
-rw-r--r-- 1 root root 1091 nov.  28  2013 windows.conf
-rw-r--r-- 1 root root  868 nov.  28  2013 xferlog.conf
-rw-r--r-- 1 root root  132 août  13  2011 yum.conf
-rw-r--r-- 1 root root  587 nov.  28  2013 zypp.conf
Ex.
Salut

Enfaite tu as copié la ligne d'action de vim : "# vi: shiftwidth=3 tabstop=3" dans le fichier /usr/share/logwatch/default.conf/logfiles/nginx.conf
et la balise de fermeture "code" devrait etre avant le "et"
~~~

###
Configuration pour Nginx
On va créer un premier fichier :
nano /usr/share/logwatch/default.conf/logfiles/nginx.conf
Et copier coller :
########################################################
# Define log file group for nginx
########################################################

# What actual file? Defaults to LogPath if not absolute path….
LogFile = nginx/*access.log
LogFile = nginx/*access.log.1
LogFile = nginx/*error.log
LogFile = nginx/*error.log.1

# If the archives are searched, here is one or more line
# (optionally containing wildcards) that tell where they are…
#If you use a “-” in naming add that as well -mgt
Archive = nginx/*access.log*
Archive = nginx/*error.log*

# Expand the repeats (actually just removes them now)
*ExpandRepeats

# Keep only the lines in the proper date range…
*ApplyhttpDate

# vi: shiftwidth=3 tabstop=3 et
On passe au deuxième fichier :
cp /usr/share/logwatch/default.conf/services/http.conf /usr/share/logwatch/default.conf/services/nginx.conf
###

devrait etre :

###
Configuration pour Nginx
On va créer un premier fichier :
nano /usr/share/logwatch/default.conf/logfiles/nginx.conf
Et copier coller :
########################################################
# Define log file group for nginx
########################################################

# What actual file? Defaults to LogPath if not absolute path….
LogFile = nginx/*access.log
LogFile = nginx/*access.log.1
LogFile = nginx/*error.log
LogFile = nginx/*error.log.1

# If the archives are searched, here is one or more line
# (optionally containing wildcards) that tell where they are…
#If you use a “-” in naming add that as well -mgt
Archive = nginx/*access.log*
Archive = nginx/*error.log*

# Expand the repeats (actually just removes them now)
*ExpandRepeats

# Keep only the lines in the proper date range…
*ApplyhttpDate
Et on passe au deuxième fichier :
cp /usr/share/logwatch/default.conf/services/http.conf /usr/share/logwatch/default.conf/services/nginx.conf
###

C'est de l'ordre du details on est d'accord, vu que la ligne en question est commentée 🙂
Ok, j'étais parti bien loin
Je te remercie, je vais corriger ça. Ce qui est marrant, c'est qu'on retrouve l'erreur un peu partout sur google dans les tuto logwatch.
Quand à savoir qui a pompé qui à l'origine pour la conf...
Ex.
2 mois plus tard
Taguy wrote:fait
apt-get remove --purge postfix mailutils
puis réinstalle les. puis
Lors de l'installation, laisser la configuration par défaut
aka No configuration je pense...

Toujours pas. Si qqun a une idée je suis prenneur ..
root@vps-19004:~# tail -f /var/log/mail.log
Oct 23 04:52:04 vps-19004 postfix/qmgr[4023]: 9142D396175A: removed
Oct 23 04:52:25 vps-19004 postfix/master[4021]: terminating on signal 15
Oct 23 04:52:43 vps-19004 postfix/master[4589]: daemon started -- version 2.11.3, configuration /etc/postfix
Oct 23 04:52:52 vps-19004 postfix/pickup[4590]: C377E3961757: uid=0 from=<root@vps-1XXX.fhnet.fr>
Oct 23 04:52:52 vps-19004 postfix/cleanup[4625]: C377E3961757: message-id=<20161023085252.C377E3961757@vps-1XXX.fhnet.fr>
Oct 23 04:52:52 vps-19004 postfix/qmgr[4591]: C377E3961757: from=<root@vps-1XXX.fhnet.fr>, size=374, nrcpt=1 (queue active)
Oct 23 04:52:52 vps-19004 postfix/smtp[4627]: warning: relayhost configuration problem
Oct 23 04:52:52 vps-19004 postfix/smtp[4627]: C377E3961757: to=<XXX@gmx.fr>, relay=none, delay=0.05, delays=0.04/0.01/0.01/0, dsn=4.3.5, status=deferred (Host or domain name not found. Name service error for name=smtp.fhnet.fr type=AAAA: Host not found)
Oct 23 04:53:05 vps-19004 postfix/master[4589]: terminating on signal 15
Oct 23 04:53:15 vps-19004 postfix/sendmail[4992]: fatal: open /etc/postfix/main.cf: No such file or directory
salut

non faut prendre "Site Internet"
https://mondedie.fr/d/5750

et si tu as pris "pas de conf" c'est normal qui trouve pas le fichier /etc/postfix/main.cf
Yep,

J'ai retesté justement comme il le faut, et même soucis.
root@vps-19004:~# tail -f /var/log/mail.log
Oct 23 18:05:52 vps-19004 postfix/local[15416]: 77D2F3960080: to=<cyprien??XXX@vps-XXX>, orig_to=<root@vps-19004.XXX>, relay=local, delay=0.08, delays=0.05/0/0/0.03, dsn=5.1.1, status=bounced (unknown user: "cyprien??dystopie.faith")
Oct 23 18:05:52 vps-19004 postfix/cleanup[15407]: 871DC3960083: message-id=<20161023220552.871DC3960083@vps-XXXX>
Oct 23 18:05:52 vps-19004 postfix/qmgr[15384]: 871DC3960083: from=<>, size=2327, nrcpt=1 (queue active)
Oct 23 18:05:52 vps-19004 postfix/bounce[15417]: 77D2F3960080: sender non-delivery notification: 871DC3960083
Oct 23 18:05:52 vps-19004 postfix/qmgr[15384]: 77D2F3960080: removed
Oct 23 18:05:52 vps-19004 postfix/local[15416]: 871DC3960083: to=<cyprien??XXX@vps-19004.XXX>, orig_to=<root@vps-XXXX>, relay=local, delay=0.07, delays=0.03/0/0/0.04, dsn=5.1.1, status=bounced (unknown user: "cyprien??XXX")
Oct 23 18:05:52 vps-19004 postfix/qmgr[15384]: 871DC3960083: removed
Oct 23 18:06:16 vps-19004 postfix/smtp[15409]: connect to mx00.gmx.net[212.227.15.10]:25: Connection timed out
Oct 23 18:06:46 vps-19004 postfix/smtp[15409]: connect to mx01.gmx.net[212.227.17.4]:25: Connection timed out
Oct 23 18:06:46 vps-19004 postfix/smtp[15409]: 29E5D396007E: to=<cyprien.XXXX@XXXX.fr>, relay=none, delay=60, delays=0.05/0/60/0, dsn=4.4.1, status=deferred (connect to mx01.gmx.net[212.227.17.4]:25: Connection timed out)
bon cette fois pas erreur de /etc/postfix/main.cf
mais on dirais quil te trouve pas user "unknown user: "cyprien"

sinon tu as ce tuto qui est tres bien pour les mails https://mondedie.fr/d/5750

bonne nuit
C'est surtout juste pour envoyer des logwatch ni plus ni moins ...

Bonjour à tous,

Je viens de faire la partie sur rkhunter, après le test j'ai 2 warning:

Performing Linux specific checks
Checking loaded kernel modules [ Warning ]
Checking kernel module names [ Warning ]

Est-ce important et si oui comment le regler?

Seconde question, la partie suivante est pour:
Surveillance de notre log d’accès à Rutorrent et bannissement

Faut peut-être que j'installe Ruttorent avant cet étape non?

Pour rkhunter, sur un serveur tout neuf comme ça tu t'en fiche c'est pas important les warning.
Pour la deuxième question, je pense que tu y as répondu tout seul
Ex.

Ça semblait logique mais bon étant novice j'ai préféré poser la question

Voila tout fini, ça fonctionne presque
Donc j'ai lancé rutorrent et j'ai ajouté un torrent, d'aprés les logs ça fonctionne:

Mais dans rutorrent rien ne se passe...

Et quand je lance rutorrent y a un message d'erreur qui s'affiche, j'sais pas trop ou j'ai merdouillé

Arf oui merci!
Mais pour le plaisir je vais tout recommencer histoire de bien comprendre ce que je fais sans suivre bêtement les instructions et je vais en profiter pour ajouter des utilisateurs sans avoir besoin d'y revenir.