Archive

Archives pour 10/2022

System: fail2ban and iptables

31/10/2022 Comments off

source: http://www.the-art-of-web.com/system/fail2ban/

Around the beginning of 2005 we saw an increase in brute-force ssh attacks – people or robots trying different combinations of username and password to log into remote servers. A quick search on this topic returns many references to iptables and ipchains but noone really explained how they work.

Having just gone through this learning curve myself, and found a satisfactory solution in the fail2ban package, I’m going to try and explain how to achieve the simple goal of banning IP addresses that make repeated failed ssh login attempts.

If you want more technical information regarding firewalls and iptables in particular, see the References section at the bottom of this page. Lire la suite…

How do I Find Out Linux CPU Utilization?

31/10/2022 Comments off

Source: nixCraft

Whenever a Linux system CPU is occupied by a process, it is unavailable for processing other requests. Rest of pending requests must wait till CPU is free. This becomes a bottleneck in the system. Following command will help you to identify CPU utilization, so that you can troubleshoot CPU related performance problems.

Finding CPU utilization is one of the important tasks. Linux comes with various utilities to report CPU utilization. With these commands, you will be able to find out:

* CPU utilization
* Display the utilization of each CPU individually (SMP cpu)
* Find out your system’s average CPU utilization since the last reboot etc
* Determine which process is eating the CPU(s)

Old good top command to find out Linux cpu load

The top program provides a dynamic real-time view of a running system. It can display system summary information as well as a list of tasks currently being managed by the Linux kernel.
The top command monitors CPU utilization, process statistics, and memory utilization. The top section contains information related to overall system status – uptime, load average, process counts, CPU status, and utilization statistics for both memory and swap space.

Top command to find out Linux cpu usage

Type the top command:
$ top

Output:
linux-gui-info

You can see Linux CPU utilization under CPU stats. The task’s share of the elapsed CPU time since the last screen update, expressed as a percentage of total CPU time. In a true SMP environment (multiple CPUS), top will operate in number of CPUs. Please note that you need to type q key to exit the top command display.

The top command produces a frequently-updated list of processes. By default, the processes are ordered by percentage of CPU usage, with only the “top” CPU consumers shown. The top command shows how much processing power and memory are being used, as well as other information about the running processes.

Lire la suite…

Categories: Système Tags: ,

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

30/10/2022 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]

Aide-mémoire administrateur Linux

30/10/2022 Comments off

administrateur linuxCe document rappelle les commandes et les options les plus utilisées par l’administrateur d’un système Linux. Il s’agit surtout de commandes assez générales, dont tout administrateur aura besoin un jour ou l’autre. Les commandes pour l’utilisateur courant se trouvent dans un autre aide-mémoire. Pour plus d’informations, on consultera les pages de manuel ou les publications du Linux Documentation Project

Une version prête à l’impression recto-verso est disponible pour conserver cet aide-mémoire dans un format facile à ranger dans un tiroir ou sous un clavier.

Informations système

uname – Identification du système.

  • -a : toutes les informations.

dmesg – Messages du noyau (et ceux du boot).

uptime – Durée et charge du système.

free – Occupation de la mémoire.

vmstat – Détails sur l’utilisation de la mémoire.

ipcs – Utilisation des ressources IPC System V.

ipcrm – Suppression de ressources IPC System V.

ldconfig – Valider les bibliothèques dynamiques.

init – Changement de niveau de fonctionnement :

  • 0 : arrêt.
  • 1 : mono-utilisateur,
  • 3 : multi-utilisateurs mode texte,
  • 5 : multi-utilisateurs mode graphique,
  • 6 : redémarrer.

Utilisateurs

useradd – Ajout d’un utilisateur :

useradd -m -p "" linus

crée un compte linus, avec répertoire personnel et mot de passe vide.

Lire la suite…

Remove a Person From a Photo With Photoshop CS5’s Content Aware Feature

29/10/2022 Comments off

Source: tutsplus.com

Final Product What You’ll Be Creating

With the launch of the new Adobe Suite of programs comes the long awaited Adobe Photoshop CS5. Packed with new features to speed up your workflow it truly is the most advanced edition of Photoshop to date. One of the new features we will be looking at today is called Content Aware. This feature allows you to quickly fill in a selection with surrounding content making it look like a part of the original image. In this case we will choose to remove a person from a photo, this can be done in less than five minutes. With the additional image enhancements this tutorial will take you less than 10 minutes to complete.

 


Original Image

Before we begin, download the image that we will be working with. As you can see, there are two individuals in this photo. In today’s tutorial, we will use Photoshop CS5′s Content Aware Feature to remove the man on the left.


Step 1

Using the content aware tool on different images produces different results. An image with a gradient background such as the sky in this image is quite tricky to work with. Open beach.jpg in Photoshop.


Step 2

We are extracting the person on the left from this photo. Using the Pen Tool, (P) Begin by making a path around the subject. The nice thing about using content aware is that you do not have to be exact when making a selection. In fact, do your best not to cut too close to the subject.

Notice in the image below how far I am drawing the path from the subject. Try to keep this distance all the way around. If you go too close, Content Aware will take pixels from the subject. If you cut too far it will take pixels from the woman on the right.


Step 3

Once you complete the path around the subject, turn it into a selection. This can be done by right clicking on the path and selecting Make Selection.

A dialog box will pop-up, make sure the feathering is set to 0px. Leave all other options as they are. Click OK.


Step 4

Now we have an active selection around our subject. In this step we will make the subject disappear from the image using Content Aware Fill. To do this, go to Edit > Fill.

A dialog box will pop-up, make sure the Content Aware option is selected. Blending mode is set to normal and the opacity is at 100%. Hit OK.

You can cancel the selection at any time by making another selection or just clicking anywhere else on the page with any selection tool.


Step 5

In this step we will remove some of the other artifacts in the image using the same process. The content aware tool did miss a spot where the subject’s foot originally was. To do this, draw a rectangle around the area using the rectangle selection tool. And use the content aware fill as we have done in the previous steps.

Now let’s remove the people towards the right of the image. Create a rectangle selection around them and use the steps we just demonstrated to remove them.


Step 6 (Optional)

Using the Crop Tool (C) lets crop the image so that the focus is drawn to the woman jumping. To do this, just crop out an area of the image that you would like to keep. Beware of the shadow that is left behind from the person that we have removed. You can use the Content Aware feature to remove this shadow but I have decided to crop it out altogether.

Click the checkmark at the top to keep this area. Photoshop will discard the content that is outside of your crop area.


Step 7 (Optional)

In this step we will enhance the photo by giving it a more vibrant look. The colors currently appear somewhat dull. There are many ways to accomplish this but we will use Color Curves. To do this, go to Image > Adjustments > Curves, (Cmd + M). A dialog box will pop-up and we will select each of the channels, R, G, B and work on them separately. Select the Red channel from the dropdown menu.

We are going to make two points on the graph. One in the bottom of the top right square, and one in the top of the bottom left square.

Once you have made these points, make sure you enter the values for each. For the top right point the Output value is 199, and the input value is 185. For the bottom point the values are 56 and 68, respectively. You can play around with these setting and adjust them to whatever you feel is appropriate. Repeat this for each of the colors, Green and Blue.


Final Image

Your image should now look something like the one seen below. As you can see, we have removed the man on her left with very little effort using Photoshop CS5′s new Content Aware Feature.

Categories: Logiciel Tags: