User Tools

Site Tools


en:cs:op:bsd:jail

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:cs:op:bsd:jail [2025/05/04 17:49] ulascemhen:cs:op:bsd:jail [2025/05/04 17:50] (current) ulascemh
Line 1: Line 1:
 ===== FreeBSD Jail ===== ===== FreeBSD Jail =====
  
-FreeBSD sistemimiz içersinde sanal bir sistem oluşturmak için kullanılan bir yöntemdirBu yöntem ile oluşturulan sistemlerana sistemden tamamen bağımsızdırBu sayede olası bir güvenlik açığından etkilenmezler. Ayrıca jail içerisinde çalışan bir servis ele geçirildiğindeana sistemde çalışan servisler etkilenmez.+FreeBSD is a method used to create a virtual system within our systemThe systems created with this method are completely independent from the main system. In this waythey are not affected by a possible security vulnerabilityAlso, when a service running in the jail is compromisedthe services running on the main system are not affected.
  
-Jail'ler bir tür işletim sistemi düzeyinde sanallaştırma olarak düşünülebilir.+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 stand out from other operating systems in terms of security.
  
-Bu sayfada anlatılan kurulum ve kullanım bilgileri. **Thick Jail** olarak isimlendirilen tamami ile ayrı bir yapı oluşturulması ile ilgilidir.+Bu sayfada anlatılan installation and usage informationIt is about creating a completely separate structure called **Thick Jail**.
  
-Ayrıca //VNET// özellikleride kullanılarak Jail'lerin ayrı bir ağda çalışması sağlanacaktır.+In addition, //VNET// features will be used to enable Jails to run on separate network.
  
-Kurulan jail temel FreeBSD dosyalarının hepsine sahip olacaktır.+The installed jail will have all the basic FreeBSD files.
  
 <WRAP round important> <WRAP round important>
-Jail'de çalışan FreeBSD sürümü ana sistemde çalışan FreeBSD sürümden daha güncel olamaz.+The FreeBSD version running in the jail cannot be more up-to-date than the FreeBSD version running on the main system.
 </WRAP> </WRAP>
  
 <WRAP round help> <WRAP round help>
-Bu yazıda Jail kurulumukullanımı ve yönetimi anlatılacaktır+This article will explain Jail installationusage and management
-  * FreeBSD sisteminizde internet erişimi <wrap em>gerekmektedir</wrap>+  * Internet access is <wrap em>required</wrap> on your FreeBSD system
-  * Yazı boyunca kullanılan ''%%__JAİL_ADI__%%'' sizin belirleyeceğiniz bir isim olacaktırÖrnek komutlarda **uch32bitjail** ismi kullanılmıştır+  * The ''%%__JAIL_NAME__%%'' used throughout the article will be a name of your choiceThe name **uch32bitjail** is used in the example commands
-  * Yazı boyunca kullanılan ''%%__VERSİYON__%%'' kuracağınız jail'in FreeBSD sürümüdür. Örnek komutlarda kullanılan sürüm **13.2-RELEASE**'dir+  * The ''%%__VERSION__%%'' used throughout the article is the FreeBSD version of the jail you will install. The version used in the example commands is **13.2-RELEASE**. 
-  * Yazı boyunca kullanılan ''%%__MİMARİ__%%'' kuracağınız jail'in FreeBSD mimarisidir. Örnek komutlarda kullanılan mimari **i386**'dir+  * Throughout the article, ''%%__ARCHITECTURE__%%'' is the FreeBSD architecture of the jail you will install. The architecture used in the example commands is **i386**. 
-    * Örnek komutlar **amd64** mimarisi içerisinde **i386** jail kurulumu için kullanılmıştır.+    * The example commands are used for **i386** jail installation in **amd64** architecture.
 </WRAP> </WRAP>
  
-===== 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 base arşivinin indirilmesi+  - Downloading the required base archive
-  - 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'lerin özellikle belirli bir dizinde tutulma zorunluğu bulunmamaktadırYazdıda ''/usr/jails'' dizinini kullanılacaktırİsterseniz değiştirebilirsiniz...+Jails do not have to be kept in a specific directoryThe script will use the directory ''/usr/jails''You can change it if you want...
  
-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 /usr/jails/files mkdir -p /usr/jails/files
-mkdir /usr/jails/__JAİL_ADI__+mkdir /usr/jails/__JAIL_NAME__
 </code> </code>
  
 <WRAP round info> <WRAP round info>
-''-p'' parametresi recursive olarak klasörleri oluştururYani ''/usr/jails'' klasörü yoksa onu da oluşturur.+The ''-p'' parameter creates folders recursivelySo if the folder ''/usr/jails'' does not exist, it creates it too.
 </WRAP> </WRAP>
  
-==== Gerekli Dosyaların İndirilmesi ====+==== Downloading Required Files ====
  
-Gerektiğinde tekrardan indirme gerekmemesi için indirilen dosyaları ''/usr/jails/files'' konumunda tutulacaktır.+The downloaded files will be kept in ''/usr/jails/files'' to avoid re-downloading them when needed.
  
-İhtiyaç halinde hızlıca yeni bir jail kurmak için kullanabilirsinizAncak 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 neededHowever, 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://download.freebsd.org/ftp/releases/__MİMARİ__/__MİMARİ__/__VERSION__/base.txz -o /usr/jails/files/__VERSION__-__MİMARİ__-base.txz+fetch https://download.freebsd.org/ftp/releases/__ARCHITECTURE__/__ARCHITECTURE__/__VERSION__/base.txz -o /usr/jails/files/__VERSION__-__ARCHITECTURE__-base.txz
 </code> </code>
->> **Örnek**;+>> **Example**;
 >> <code bash> >> <code bash>
 fetch https://download.freebsd.org/ftp/releases/i386/i386/13.2-RELEASE/base.txz -o /usr/jails/files/13.2-RELEASE-i386-base.txz fetch https://download.freebsd.org/ftp/releases/i386/i386/13.2-RELEASE/base.txz -o /usr/jails/files/13.2-RELEASE-i386-base.txz
 </code> </code>
  
-  * İndirilen //base// arşivini ilgili jail konumuna çıkartmak için aşağıdaki komutu düzenleyerek çalıştırın.+  * Edit and run the following command to extract the downloaded //base// archive to the relevant jail location.
  
 > <code bash> > <code bash>
-tar -xpf /usr/jails/files/__VERSION__-__MİMARİ__-base.txz -C /usr/jails/__JAİL_ADI__ --unlink+tar -xpf /usr/jails/files/__VERSION__-__ARCHITECTURE__-base.txz -C /usr/jails/__JAIL_NAME__ --unlink
 </code> </code>
->> **Örnek**;+>> **Example**;
 >> <code bash> >> <code bash>
-tar -xpf /usr/jails/files/13.2-RELEASE-i386-base.txz -C /usr/jails/rtfi32bitjail --unlink+tar -xpf /usr/jails/files/13.2-RELEASE-i386-base.txz -C /usr/jails/uch32bitjail --unlink
 </code> </code>
  
-  * Eğer disk alanınız az iseindirilen 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 spaceyou can run the following command to delete the downloaded files. To install new jail you will need to download it again.
  
 > <code bash> > <code bash>
-rm -f /usr/jails/files/__VERSION__-__MİMARİ__-base.txz+rm -f /usr/jails/files/__VERSION__-__ARCHITECTURE__-base.txz
 </code> </code>
->> **Örnek**;+>> **Example**;
 >> <code bash> >> <code bash>
 rm -f /usr/jails/files/13.2-RELEASE-i386-base.txz rm -f /usr/jails/files/13.2-RELEASE-i386-base.txz
 </code> </code>
  
-==== Ana Sistem Ayarları ====+==== Main System Settings ====
  
-Jail'lerin çalışması için ana sistem üzerinde bazı ayarlamalar yapılması gerekmektedir.+For jails to work, some adjustments need to be made on the main system.
  
-  * Jail için internet bağlantısı ve saat ayarlarını direkt olarak ana sistemden kopyalanması gerekmektedirAşağıdaki komutu düzenleyerek çalıştırın.+  * The internet connection and time settings for Jail need to be copied directly from the main systemEdit and run the following command.
  
 > <code bash> > <code bash>
-cp /etc/resolv.conf /usr/jails/__JAİL_ADI__/etc/resolv.conf +cp /etc/resolv.conf /usr/jails/__JAIL_NAME__/etc/resolv.conf 
-cp /etc/localtime /usr/jails/__JAİL_ADI__/etc/localtime+cp /etc/localtime /usr/jails/__JAIL_NAME__/etc/localtime
 </code> </code>
 >> **Örnek**; >> **Örnek**;
 >> <code bash> >> <code bash>
-cp /etc/resolv.conf /usr/jails/rtfi32bitjail/etc/resolv.conf +cp /etc/resolv.conf /usr/jails/uch32bitjail/etc/resolv.conf 
-cp /etc/localtime /usr/jails/rtfi32bitjail/etc/localtime+cp /etc/localtime /usr/jails/uch32bitjail/etc/localtime
 </code> </code>
  
-  * 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
 </code> </code>
 >> **Örnek**; >> **Örnek**;
 >> <code bash> >> <code bash>
-freebsd-update -b /usr/jails/rtfi32bitjail/ fetch install+freebsd-update -b /usr/jails/uch32bitjail/ fetch install
 </code> </code>
  
-  * Makine başladığında jail'lerin otomatik olarak başlamasını istiyorsanız aşağıdaki komutu çalıştırın.((Eğer manuel olarak başlatmak istiyorsanız bu adımı es geçinizJail'i başlatma komutu bu aşamaya göre değişecektir.))+  * 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 stepThe command to start the jail will change according to this step.))
  
 > <code bash> > <code bash>
-sysrc jail_enable="YES"Başlangıçta jailleri başlatmak için+sysrc jail_enable="YES"Initially to start the jails
-sysrc jail_parallel_start="YES"Bu satırıda eklersenizjailler arkaplanda başlatılır.+sysrc jail_parallel_start="YES"If you add this linethe jails will be started in the background.
 </code> </code>
  
-==== VNET Ayarları ====+==== VNET Settings ====
  
-Yazıda hazırlanan jail, ana sistemden tamamen bağımsız olarak hazırlanmaktadırBu yüzden jail'in ayrı bir ağda çalışması gerekmektedirBunun için VNET kullanılacaktır.+The jail prepared in this article is prepared completely independently from the main systemTherefore, the jail needs to run on separate network. VNET will be used for this.
  
-Eğer jail'inizde ayrı bir ağ üzerinden internet erişimi olmasını istemiyorsanız((Hiç internet bağlantısı olmaması veya ana sistemle aynı ip'yi paylaşması)) bu kısmı atlayabilirsiniz.+If you don't want your jail to have internet access via separate network ((no internet connection at all or sharing the same ip with the main system)) you can skip this part.
  
-  * 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
 </code> </code>
->> Size bir çıktı vermesi gerekmektedirBu çıktıda köprü bağdaştırıcının ismi bulunmaktadırBu ismi bir yere not edin+>> It should give you an outputThis output contains the name of the bridge adapterMake a note of this name
->>> Örnek olarak ''bridge0''+>>> As an example ''bridge0''
  
-  * Köprü oluşturulduktan sonra aşağıdaki komutu çalıştırarak onu ''em0'' arayüzüne eklemek gerekecektir:+  * Once the bridge is created, it will be necessary to add it to the ''em0'' interface by running the following command:
  
-Burada ''em0'' cihazın bağdaştırıcı ismidirSizin sisteminizde bu isim farklı olabilirÖğrenmek için ''ifconfig'' komutunu kullanabilirsiniz.+Here ''em0'' is the adapter name of the deviceThis name may be different in your systemYou can use the ''ifconfig'' command to find out.
 > >
-ağıda örnek bir çıktı bulunmaktadırVurgulanan satırda ismi görebilirsiniz.+Below is sample outputYou can see the name in the highlighted line.
 >><code sh [enable_line_numbers="true", ,highlight_lines_extra="1"]> >><code sh [enable_line_numbers="true", ,highlight_lines_extra="1"]>
 em0: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 em0: flags=8863<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
Line 148: Line 148:
 </code> </code>
  
-  * Aşağıdaki komutu çalıştırın ve köprüyü em0 arayüzüne ekleyinBurada ''bridge0'' bir önceki komutta oluşturulan köprü ismidir. ''em0'' ise ana sistemdeki ağ arayüzüdür.+  * Run the following command and add the bridge to interface em0. Here ''bridge0'' is the bridge name created in the previous command and ''em0'' is the network interface on the host system.
  
 > <code bash> > <code bash>
Line 154: Line 154:
 </code> </code>
  
-  * Bu işlemlerin her başlangıçta otomatik gerçekleşmesi için ''/etc/rc.conf'' dosyasına aşağıdaki satırları ekleyin.+  * Add the following lines to the ''/etc/rc.conf'' file so that this happens automatically on every startup.
  
 > <code bash> > <code bash>
Line 162: Line 162:
 </code> </code>
  
-==== Jail Konfigürasyonu ====+==== Jail Configuration ====
  
-Jail'ler için konfigürasyon dosyalarını ayarlamanın iki yolu bulunmaktadırEğer çok fazla jail kullanacaksanız ikinci yolu tercih etmeniz daha mantıklı olacaktır.+There are two ways to set configuration files for jailsIf 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 tutulurBu dosya ''/etc/jail.conf'' dosyasıdır.+Configuration information is kept in a single fileThis file is ''/etc/jail.conf''.
  
-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 tutulurBu dosyalar ''/etc/jail.conf.d/'' klasörü içerisinde tutulur.+Configuration information is kept in a separate file for each jail. These files are kept in the ''/etc/jail.conf.d/'' folder.
  
-Her yeni jail için bu klasöre yeni bir dosya oluşturmanız gerekmektedirEğ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 folderThis 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 **LF** kullanınızAksi taktirde istenmeyen sonuçlar oluşabilir.+Pay attention to the line breaks in the files to be createdUse **LF** instead of **CRLF**. Otherwise unwanted results may occur.
 </WRAP> </WRAP>
  
 <file bash /etc/jail.conf [highlight_lines_extra="1,15,18"]> <file bash /etc/jail.conf [highlight_lines_extra="1,15,18"]>
-__JAİL_ADI__ { # Jail'in ismi+__JAIL_NAME__ { # Jail'in ismi
   exec.start = "/bin/sh /etc/rc"; # Jail başlatıldığında çalıştırılacak olan komutlar.   exec.start = "/bin/sh /etc/rc"; # Jail başlatıldığında çalıştırılacak olan komutlar.
   exec.stop = "/bin/sh /etc/rc.shutdown"; # Jail kapatıldığında çalıştırılacak olan komutlar.   exec.stop = "/bin/sh /etc/rc.shutdown"; # Jail kapatıldığında çalıştırılacak olan komutlar.
Line 219: Line 219:
  
  
-===== Jail Yönetimi =====+===== Jail Management =====
  
-  * Sistemde çalışmakta olan jail'leri listelemek için aşağıdaki komutu kullanabilirsiniz.+  * You can use the following command to list the jails currently running on the system.
  
 > <code bash> > <code bash>
Line 227: Line 227:
 </code> </code>
  
-  * Jail'i başlatmak için aşağıdaki komutu kullanabilirsinizEğer başlangıçta otomatik başlatmak için ayar yapmadıysanız bir alttaki komutu kullanmak <wrap em>zorundasınız</wrap>.+  * 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 __JAİL_ADI__+service jail onestart __JAIL_NAME__
 </code> </code>
  
-  * 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__
 </code> </code>
  
-  * Jail'i yeniden başlatmak için aşağıdaki komutu kullanabilirsiniz.+  * You can use the following command to restart Jail.
  
 > <code bash> > <code bash>
-service jail restart __JAİL_ADI__+service jail restart __JAIL_NAME__
 </code> </code>
  
Line 249: Line 249:
  
 <WRAP round info> <WRAP round info>
-FreeBSD işletim sisteminde güvenlik birinci planda olduğundan bazı dosyaları silmek için root yetkisi bile yeterli değildir+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.
 </WRAP> </WRAP>
  
-  * İlk olarak sileceğinizi jaili durdurunDaha sonra aşağıdaki komutu jail'inize göre çalıştırın ve dosya bayraklarını değiştirin.+  * First stop the jail you are going to deleteThen 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__
 </code> </code>
  
-  * Artık jail klasörünü aşağıdaki komutla silebilirsiniz.+  * 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__
 </code> </code>
  
-  * Son olarak ilgili jail'e ait konfigürasyon dosyasını silerek silme işlemini tamamlayınBirinci yol ile konfigürasyon sağladıysanız. ''/etc/jail.conf'' dosyasını düzenleyinİkinci yol ile konfigürasyon sağladıysanız. ''/etc/jail.conf.d/__JAİL_ADI__.conf'' dosyasını silin.+  * Finally, complete the deletion process by deleting the configuration file for the relevant jail. If you configured with the first wayEdit the ''/etc/jail.conf'' fileIf you configured with the second wayDelete the file ''/etc/jail.conf.d/__JAIL_NAME__.conf''.
  
-==== Jail Paket Yönetimi ====+==== Jail Package Management ====
  
-Eğer jail'inize internet erişimi vermediyseniz.((Bu yazıda vnet ile jail'lere internet erişimi verildiği için bu kısım atlanmıştır.)) Ana sistemden jail'e paket kurmak için aşağıdaki komutu kullanabilirsiniz.+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.)) You can use the following command to install packages from the main system to jail.
  
 > <code bash> > <code bash>
-pkg -j __JAİL_ADI__ install __PAKET_ADI__+pkg -j __JAIL_NAME__ install __PACKET_NAME__
 </code> </code>
->> **Örnek**;+>> **Example**;
 >> <code bash> >> <code bash>
-pkg -j rtfi32bitjail install wget+pkg -j uch32bitjail install wget
 </code> </code>
  
-==== Jail Erişimi ====+==== Jail Access ====
  
-Ana sistem üzerinden jail yönetimi daha uygun olsadaisterseniz jail içerisine aşağıdaki komutla erişebilirsiniz.+Although it is more convenient to manage the jail through the main systemyou can access the jail with the following command.
  
 <code bash> <code bash>
-jexec -u root __JAIL_ISMI__+jexec -u root __JAIL_NAME__
 </code> </code>
  
-==== 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__
 </code> </code>
 >> **Örnek**; >> **Örnek**;
 >> <code bash> >> <code bash>
-jexec -l rtfi32bitjail service stop apache24+jexec -l uch32bitjail service stop apache24
 </code> </code>
  
-<wrap onlyprint>[[tr:cs:op:bsd:jail|UCH Viki]]'den alınmıştır.</wrap>+<wrap onlyprint>Taken from [[en:cs:op:bsd:jail|UCH Wiki]].</wrap>
 <wrap hide> <wrap hide>
-https://wiki.ulascemh.com/doku.php?id=tr:cs:op:bsd:jail+https://wiki.ulascemh.com/doku.php?id=en:cs:op:bsd:jail
 </wrap> </wrap>
en/cs/op/bsd/jail.1746380971.txt.gz · Last modified: 2025/05/04 17:49 by ulascemh