en:cs:op:bsd:jail
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:cs:op:bsd:jail [2025/05/04 17:49] – ulascemh | en:cs:op:bsd:jail [2025/05/04 17:50] (current) – ulascemh | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== FreeBSD Jail ===== | ===== FreeBSD Jail ===== | ||
- | FreeBSD | + | FreeBSD |
- | Jail' | + | Jails can be thought of as a kind of operating system-level virtualization. |
- | FreeBSD'yi diğer işletim sistemlerinden güvenlik açısından öne çıkaran bir sistemdir. | + | It is a system that makes FreeBSD |
- | Bu sayfada anlatılan | + | Bu sayfada anlatılan |
- | Ayrıca | + | In addition, |
- | Kurulan | + | The installed |
<WRAP round important> | <WRAP round important> | ||
- | Jail' | + | The FreeBSD |
</ | </ | ||
<WRAP round help> | <WRAP round help> | ||
- | Bu yazıda | + | This article will explain |
- | * FreeBSD sisteminizde internet erişimi | + | * Internet access is <wrap em>required</ |
- | * Yazı boyunca kullanılan | + | * The '' |
- | * Yazı boyunca kullanılan | + | * The '' |
- | * Yazı boyunca kullanılan | + | * Throughout the article, |
- | * Örnek komutlar | + | * The example commands are used for **i386** jail installation in **amd64** architecture. |
</ | </ | ||
- | ===== FreeBSD Jail Kurulumu | + | ===== FreeBSD Jail Installation |
- | Jail kurulum aşamaları şu şekilde sıralanabilir. | + | Jail installation steps can be listed as follows. |
- | - Klasörlerin oluşturulması. | + | - Creation of folders. |
- | - Gerekli | + | - Downloading the required |
- | - Ana sistem üzerinde ayarların yapılması. | + | - Making settings on the main system. |
- | - Jail yapılandırma dosyalarının oluşturulması ve düzenlenmesi. | + | - Creating and editing jail configuration files. |
- | ==== Klasör Yapısı | + | ==== Folder Structure |
- | Jail' | + | Jails do not have to be kept in a specific directory. The script will use the directory |
- | Aşağıdaki komutta gerekli yerleri değiştirerek çalıştırın ve klasörleri oluşturun. | + | Run and create the folders by changing the necessary places in the command below. |
<code bash> | <code bash> | ||
mkdir -p / | mkdir -p / | ||
- | mkdir /usr/jails/__JAİL_ADI__ | + | mkdir /usr/jails/__JAIL_NAME__ |
</ | </ | ||
<WRAP round info> | <WRAP round info> | ||
- | '' | + | The '' |
</ | </ | ||
- | ==== Gerekli Dosyaların İndirilmesi | + | ==== Downloading Required Files ==== |
- | Gerektiğinde tekrardan indirme gerekmemesi için indirilen dosyaları | + | The downloaded files will be kept in ''/ |
- | İhtiyaç halinde hızlıca yeni bir jail kurmak için kullanabilirsiniz. Ancak alan sıkıntısı çekiyorsanız bu dosyaları her jail kurulumunda tekrardan indirebilirsiniz. | + | You can use it to quickly install a new jail if needed. However, if you are short on space, you can download these files again for each jail installation. |
- | * Gerekli dosyaları indirmek için aşağıdaki komutu düzenleyerek çalıştırın. | + | * Edit and run the command below to download the necessary files. |
> <code bash> | > <code bash> | ||
- | fetch https:// | + | fetch https:// |
</ | </ | ||
- | >> **Örnek**; | + | >> **Example**; |
>> <code bash> | >> <code bash> | ||
fetch https:// | fetch https:// | ||
</ | </ | ||
- | * İndirilen | + | * Edit and run the following command to extract the downloaded |
> <code bash> | > <code bash> | ||
- | tar -xpf / | + | tar -xpf / |
</ | </ | ||
- | >> **Örnek**; | + | >> **Example**; |
>> <code bash> | >> <code bash> | ||
- | tar -xpf / | + | tar -xpf / |
</ | </ | ||
- | * Eğer disk alanınız az ise, indirilen dosyaları silmek için aşağıdaki komutu çalıştırabilirsiniz. Yeni jail kurmak için yeniden indirmeniz gerekir. | + | * If you are low on disk space, you can run the following command to delete the downloaded files. To install |
> <code bash> | > <code bash> | ||
- | rm -f / | + | rm -f / |
</ | </ | ||
- | >> **Örnek**; | + | >> **Example**; |
>> <code bash> | >> <code bash> | ||
rm -f / | rm -f / | ||
</ | </ | ||
- | ==== Ana Sistem Ayarları | + | ==== Main System Settings |
- | Jail' | + | For jails to work, some adjustments need to be made on the main system. |
- | * Jail için internet | + | * The internet |
> <code bash> | > <code bash> | ||
- | cp / | + | cp / |
- | cp / | + | cp / |
</ | </ | ||
>> **Örnek**; | >> **Örnek**; | ||
>> <code bash> | >> <code bash> | ||
- | cp / | + | cp / |
- | cp / | + | cp / |
</ | </ | ||
- | * Jail için olası güncelleştirmeleri almak için aşağıdaki komutu düzenleyerek çalıştırın. | + | * Edit and run the following command to get possible updates for Jail. |
> <code bash> | > <code bash> | ||
- | freebsd-update -b /usr/jails/__JAİL_ADI__/ fetch install | + | freebsd-update -b /usr/jails/__JAIL_NAME__/ fetch install |
</ | </ | ||
>> **Örnek**; | >> **Örnek**; | ||
>> <code bash> | >> <code bash> | ||
- | freebsd-update -b /usr/jails/rtfi32bitjail/ fetch install | + | freebsd-update -b /usr/jails/uch32bitjail/ fetch install |
</ | </ | ||
- | * Makine başladığında jail' | + | * If you want the jails to start automatically when the machine starts, run the following command.((If you want to start them manually, skip this step. The command to start the jail will change according to this step.)) |
> <code bash> | > <code bash> | ||
- | sysrc jail_enable=" | + | sysrc jail_enable=" |
- | sysrc jail_parallel_start=" | + | sysrc jail_parallel_start=" |
</ | </ | ||
- | ==== VNET Ayarları | + | ==== VNET Settings |
- | Yazıda hazırlanan | + | The jail prepared in this article is prepared completely independently from the main system. Therefore, the jail needs to run on a separate network. VNET will be used for this. |
- | Eğer jail' | + | If you don't want your jail to have internet access via a separate network |
- | * Bağdaştırıcı köprüsü oluşturmak için aşağıdaki komutu çalıştırın. | + | * Run the following command to create an adapter bridge. |
> <code bash> | > <code bash> | ||
ifconfig bridge create | ifconfig bridge create | ||
</ | </ | ||
- | >> | + | >> |
- | >>> | + | >>> |
- | * Köprü oluşturulduktan sonra aşağıdaki komutu çalıştırarak onu '' | + | * Once the bridge is created, it will be necessary to add it to the '' |
- | > Burada | + | > Here '' |
> | > | ||
- | > Aşağıda örnek bir çıktı bulunmaktadır. Vurgulanan satırda ismi görebilirsiniz. | + | > Below is a sample output. You can see the name in the highlighted line. |
>>< | >>< | ||
em0: flags=8863< | em0: flags=8863< | ||
Line 148: | Line 148: | ||
</ | </ | ||
- | * Aşağıdaki komutu çalıştırın ve köprüyü | + | * Run the following command and add the bridge to interface |
> <code bash> | > <code bash> | ||
Line 154: | Line 154: | ||
</ | </ | ||
- | * Bu işlemlerin her başlangıçta otomatik gerçekleşmesi için ''/ | + | * Add the following lines to the ''/ |
> <code bash> | > <code bash> | ||
Line 162: | Line 162: | ||
</ | </ | ||
- | ==== Jail Konfigürasyonu | + | ==== Jail Configuration |
- | Jail' | + | There are two ways to set configuration files for jails. If you are going to use a lot of jails, it makes more sense to choose the second way. |
- | === Birinci Yol === | + | === First Way === |
- | Konfigürasyon bilgileri tek bir dosyada tutulur. Bu dosya ''/ | + | Configuration information is kept in a single file. This file is ''/ |
- | Her yeni jail için bu dosyaya yeni girdiler eklemeniz gerekmektedir. | + | You need to add new entries to this file for each new jail. |
- | === İkinci Yol === | + | === Second Way === |
- | Konfigürasyon bilgileri her jail için ayrı bir dosyada tutulur. Bu dosyalar | + | Configuration information is kept in a separate file for each jail. These files are kept in the ''/ |
- | Her yeni jail için bu klasöre yeni bir dosya oluşturmanız gerekmektedir. Eğer çok sayıda jail bulunuyorsa bu yöntem karışıklığı önler. | + | For each new jail you need to create a new file in this folder. This method avoids confusion if you have many jails. |
----- | ----- | ||
- | Seçilen yönteme göre konfigürasyon dosyasını açın ve vurgulanan satırları düzenleyerek ekleyin. | + | Open the configuration file according to the selected method and add the highlighted lines by editing them. |
- | Detaylı bilgiler yorum olarak yanlarına yazılmıştır. | + | Detailed information is written next to them as a comment. |
<WRAP round important> | <WRAP round important> | ||
- | Oluşturulacak olan dosyalarda satır sonlarına dikkat ediniz. **CRLF** yerine | + | Pay attention to the line breaks in the files to be created. Use **LF** instead of **CRLF**. Otherwise unwanted results may occur. |
</ | </ | ||
<file bash / | <file bash / | ||
- | __JAİL_ADI__ | + | __JAIL_NAME__ |
exec.start = "/ | exec.start = "/ | ||
exec.stop = "/ | exec.stop = "/ | ||
Line 219: | Line 219: | ||
- | ===== Jail Yönetimi | + | ===== Jail Management |
- | * Sistemde çalışmakta olan jail' | + | * You can use the following command to list the jails currently running on the system. |
> <code bash> | > <code bash> | ||
Line 227: | Line 227: | ||
</ | </ | ||
- | * Jail'i başlatmak için aşağıdaki komutu kullanabilirsiniz. Eğer başlangıçta otomatik başlatmak için ayar yapmadıysanız bir alttaki komutu kullanmak <wrap em> | + | * You can use the command below to start Jail. If you have not set it to autostart at startup, you will have to use the command below. |
> <code bash> | > <code bash> | ||
- | service jail start __JAİL_ADI__ | + | service jail start __JAIL_NAME__ |
- | service jail onestart | + | service jail onestart |
</ | </ | ||
- | * Jail'i durdurmak için aşağıdaki komutu kullanabilirsiniz. | + | * You can use the following command to stop the jail. |
> <code bash> | > <code bash> | ||
- | service jail stop __JAİL_ADI__ | + | service jail stop __JAIL_NAME__ |
</ | </ | ||
- | * Jail'i yeniden başlatmak için aşağıdaki komutu kullanabilirsiniz. | + | * You can use the following command to restart |
> <code bash> | > <code bash> | ||
- | service jail restart | + | service jail restart |
</ | </ | ||
Line 249: | Line 249: | ||
<WRAP round info> | <WRAP round info> | ||
- | FreeBSD | + | Since security is a top priority in FreeBSD, even root privileges are not enough to delete some files. |
- | Bu sistemi dosya bayrakları kontrol eder. | + | File flags control this system. |
</ | </ | ||
- | * İlk olarak sileceğinizi jaili durdurun. Daha sonra aşağıdaki komutu | + | * First stop the jail you are going to delete. Then run the command below according to your jail and change the file flags. |
> <code bash> | > <code bash> | ||
- | chflags -R 0 /usr/jails/__JAİL_ADI__ | + | chflags -R 0 /usr/jails/__JAIL_NAME__ |
</ | </ | ||
- | * Artık | + | * You can now delete the jail folder with the following command. |
> <code bash> | > <code bash> | ||
- | rm -rf /usr/jails/__JAİL_ADI__ | + | rm -rf /usr/jails/__JAIL_NAME__ |
</ | </ | ||
- | * Son olarak ilgili | + | * Finally, complete the deletion process by deleting the configuration file for the relevant |
- | ==== Jail Paket Yönetimi | + | ==== Jail Package Management |
- | Eğer jail'inize internet erişimi vermediyseniz.((Bu yazıda | + | If you have not given internet access to your jail.((In this article, this part is omitted because internet access is given to jails with vnet.)) |
> <code bash> | > <code bash> | ||
- | pkg -j __JAİL_ADI__ | + | pkg -j __JAIL_NAME__ |
</ | </ | ||
- | >> **Örnek**; | + | >> **Example**; |
>> <code bash> | >> <code bash> | ||
- | pkg -j rtfi32bitjail | + | pkg -j uch32bitjail |
</ | </ | ||
- | ==== Jail Erişimi | + | ==== Jail Access |
- | Ana sistem üzerinden | + | Although it is more convenient to manage the jail through the main system, you can access the jail with the following command. |
<code bash> | <code bash> | ||
- | jexec -u root __JAIL_ISMI__ | + | jexec -u root __JAIL_NAME__ |
</ | </ | ||
- | ==== Jail Üzerinde Komut Çalıştırma | + | ==== Command Execution on Jail ==== |
- | Jail üzerinde komut çalıştırmak için çalıştıracağınız komuta aşağıdaki ön eki eklemeniz gerekmektedir. | + | To run a command on Jail, you need to add the following prefix to the command you will run. |
> <code bash> | > <code bash> | ||
- | jexec -l __JAİL_ADI__ __KOMUT__ | + | jexec -l __JAIL_NAME__ __COMMAND__ |
</ | </ | ||
>> **Örnek**; | >> **Örnek**; | ||
>> <code bash> | >> <code bash> | ||
- | jexec -l rtfi32bitjail | + | jexec -l uch32bitjail |
</ | </ | ||
- | <wrap onlyprint> | + | <wrap onlyprint> |
<wrap hide> | <wrap hide> | ||
- | https:// | + | https:// |
</ | </ |
en/cs/op/bsd/jail.1746380971.txt.gz · Last modified: 2025/05/04 17:49 by ulascemh