Archive

Articles taggués ‘securite’

Filtrer les connexions ssh

02/05/2021 Aucun commentaire

Portier SSH

Si vous possédez un serveur avec ssh opérationnel, vous ne serez pas long à avoir des messages tels que ceux ci dans le fichier /var/log/auth.log:

...
Mar 11 12:48:21 serv sshd[12956]: Failed password for invalid user root from 64.71.148.162 port 47270 ssh2
Mar 11 15:45:04 serv sshd[6954]: Did not receive identification string from 210.21.30.72
Mar 11 15:46:48 serv sshd[7041]: Did not receive identification string from 81.93.188.5
Mar 11 15:47:50 serv sshd[7106]: User root from 210.21.30.72 not allowed because none of user s groups are listed in AllowGroups
Mar 11 15:47:50 serv sshd[7106]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=210.21.30.72  user=root
Mar 11 15:47:52 serv sshd[7106]: Failed password for invalid user root from 210.21.30.72 port 54346 ssh2
Mar 11 15:49:33 serv sshd[7241]: User root from 81.93.188.5 not allowed because none of user s groups are listed in AllowGroups
Mar 11 15:49:33 serv sshd[7241]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=81.93.188.5  user=root
Mar 11 15:49:35 serv sshd[7241]: Failed password for invalid user root from 81.93.188.5 port 44663 ssh2
Mar 12 00:51:18 serv sshd[22229]: User root from host.ongamemarketing.com not allowed because none of user s groups are listed in AllowGroups
Mar 12 00:51:18 serv sshd[22229]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=host.ongamemarketing.com  user=root
Mar 12 00:51:20 serv sshd[22229]: Failed password for invalid user root from 174.133.12.130 port 48089 ssh2
Mar 12 00:51:22 serv sshd[22236]: User root from host.ongamemarketing.com not allowed because none of user s groups are listed in AllowGroups
Mar 12 00:51:22 serv sshd[22236]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=host.ongamemarketing.com  user=root
Mar 12 00:51:24 serv sshd[22236]: Failed password for invalid user root from 174.133.12.130 port 48521 ssh2
Mar 12 01:47:10 serv sshd[30827]: Did not receive identification string from 114.200.199.144
Mar 12 01:53:17 serv sshd[31227]: Invalid user staff from 114.200.199.144
Mar 12 01:53:17 serv sshd[31227]: pam_unix(sshd:auth): check pass; user unknown
Mar 12 01:53:17 serv sshd[31227]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=114.200.199.144
Mar 12 01:53:19 serv sshd[31227]: Failed password for invalid user staff from 114.200.199.144 port 35343 ssh2
Mar 12 01:53:27 serv sshd[31234]: Invalid user sales from 114.200.199.144
...

sshsessionforwardingVous avez besoin de pouvoir vous connecter en ssh depuis le réseau local, depuis l’extérieur, mais vous voulez limiter les risques. Il existe plusieurs solutions, qui peuvent être cumulées: Lire la suite…

Categories: Réseau Tags: , ,

Protect WordPress sites with .htaccess

28/04/2021 Comments off

Plug-ins

Our job as WordPress users (aside from contributing to the WordPress community) is keeping our installs safe from people we do not want to access our sites. There are numerous plug-ins to help shore up our WordPress defenses such as Login LockDown which records IP address and blocks them after a set number of login attempts which helps against brute force attacks. Lire la suite…

Basic .htaccess for New Projects

27/04/2021 Comments off
# allows php on html
 AddType application/x-httpd-php .html
# Using this code, instead of having to type in http://mysite.com/contact.php, you only need to enter http://mysite.com/contact to access that page.
# And the best part is, you can still access the page with .php on the end of it, so no old incoming links or bookmarks become orphaned as a result of this, and everyone is happy.
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME}\.htm -f
 RewriteRule ^(.*)$ $1.htm
# gzip compression.
# html, txt, css, js, json, xml, htc:
 AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
 AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
 AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
# ------------------------
# CACHING to speed up site
# MONTH
 <FilesMatch "\.(flv|gif|jpg|jpeg|png|ico|swf)$">
 Header set Cache-Control "max-age=2592000"
# WEEK
 <FilesMatch "\.(js|css|pdf|txt)$">
 Header set Cache-Control "max-age=604800"
# DAY
 <FilesMatch "\.(html|htm)$">
 Header set Cache-Control "max-age=43200"
# webfonts and svg:
 <FilesMatch "\.(ttf|otf|eot|svg)$" >
 SetOutputFilter DEFLATE
# use utf-8 encoding for anything served text/plain or text/html
 AddDefaultCharset utf-8
# force utf-8 for a number of file formats
 AddCharset utf-8 .html .css .js .xml .json .rss
# Custom 400 errors
 ErrorDocument 400 /error.php
# Custom 401 errors
 ErrorDocument 401 /error.php
# Custom 403 errors
 ErrorDocument 403 /error.php
# Custom 404 errors
 ErrorDocument 404 /error.php
# Custom 500 errors
 ErrorDocument 500 /error.php
# Changes http://example.com to http://www.example.com
 RewriteEngine on
 RewriteCond %{HTTP_HOST} !^www.your-domain.com$
 RewriteRule ^(.*)$ http://www.your-domain.com/$1 [R=301]
# Specifies what file will be the directory index
 DirectoryIndex index.php index.html index.htm
# Unhide the code below to turn on a Site Down Page
 # RewriteEngine On
 # RewriteBase /
 # RewriteCond %{REQUEST_URI} !^/your-domain\.php$
 # RewriteRule ^(.*)$ http://your-domain.com/site-down.php [R=307,L]
# redirect any variations of a specific character string to a specific address
 # RewriteEngine On
 # RewriteRule ^appsupport http://www.your-domain.com/ [R]
# ---- # The following will redirect to the new page permanently ----#
 # Redirect 301 /index.php http://www.your-domain.com/site-down.php
Categories: Système Tags: ,

A Standard .htaccess File with ExpressionEngine

27/04/2021 Comments off
.htaccess files can be a powerful tool for a developer, that is, as long as they are set up properly. What follows is a pretty simple .htaccess template that I use on the majority of my projects.

Secure .htaccess File

<Files .htaccess>
 order allow,deny
 deny from all
</Files>

This first set of lines essentially prevents others from viewing your htaccess file (and learning all about your crazy redirects).
Lire la suite…

Categories: Système Tags: ,

WordPress: Se protéger des spams sur les commentaires via un fichier .htaccess

22/04/2021 Comments off
Si vous autorisez vos visiteurs à poster des commentaires sur les articles de votre blog, vous avez certainement fait face aux robots spammeurs. Pour aider Askimet à lutter et réduire les attaques des spammeurs, il existe une astuce qui consiste à bloquer l’accès au fichier wp-comments-post.php qui permet de traiter la soumission des commentaires. Le code qui suit est à placer dans un fichier .htaccess à la racine de votre site Internet.

## ******** Pour se protéger contre des commentaires de Spam **********
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !.*mon-site.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) http://www.mon-site.com [R=301,L]