hacktricks/linux-hardening/linux-environment-variables.md

147 lines
6.2 KiB
Markdown
Raw Normal View History

2024-02-11 02:13:58 +00:00
# Mazingira ya Linux
2022-04-28 16:01:33 +00:00
<details>
<summary><strong>Jifunze kuhusu kudukua AWS kutoka sifuri hadi shujaa na</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (Mtaalam wa Timu Nyekundu ya AWS ya HackTricks)</strong></a><strong>!</strong></summary>
2022-04-28 16:01:33 +00:00
2024-02-11 02:13:58 +00:00
Njia nyingine za kusaidia HackTricks:
2024-02-02 12:19:57 +00:00
* Ikiwa unataka kuona **kampuni yako ikitangazwa kwenye HackTricks** au **kupakua HackTricks kwa PDF** Angalia [**MIPANGO YA KUJIUNGA**](https://github.com/sponsors/carlospolop)!
* Pata [**bidhaa rasmi za PEASS & HackTricks**](https://peass.creator-spring.com)
* Gundua [**Familia ya PEASS**](https://opensea.io/collection/the-peass-family), mkusanyiko wetu wa [**NFTs**](https://opensea.io/collection/the-peass-family) za kipekee
* **Jiunge na** 💬 [**Kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au kikundi cha [**telegram**](https://t.me/peass) au **tufuate** kwenye **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Shiriki mbinu zako za kudukua kwa kuwasilisha PRs kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos za github.
2022-04-28 16:01:33 +00:00
</details>
**Kikundi cha Usalama cha Kujitahidi**
<figure><img src="../.gitbook/assets/telegram-cloud-document-1-5159108904864449420.jpg" alt=""><figcaption></figcaption></figure>
{% embed url="https://discord.gg/tryhardsecurity" %}
***
## Mazingira ya Kitaifa
Mazingira ya kitaifa **yataurithiwa na** **mchakato wa watoto**.
Unaweza kuunda mazingira ya kitaifa kwa kikao chako cha sasa kwa kufanya:
```bash
export MYGLOBAL="hello world"
echo $MYGLOBAL #Prints: hello world
```
Hii variable itapatikana na vikao vyako vya sasa na michakato yake ya watoto.
2024-02-11 02:13:58 +00:00
Unaweza **kuondoa** variable kwa kufanya:
```bash
unset MYGLOBAL
```
## Variables za Kienyeji
**Variables za kienyeji** zinaweza kufikiwa tu na **shell/script ya sasa**.
```bash
LOCAL="my local"
echo $LOCAL
unset LOCAL
```
## Orodhesha mazingira ya sasa
```bash
set
env
printenv
cat /proc/$$/environ
cat /proc/`python -c "import os; print(os.getppid())"`/environ
```
## Vipimo vya kawaida
2024-02-11 02:13:58 +00:00
Kutoka: [https://geek-university.com/linux/common-environment-variables/](https://geek-university.com/linux/common-environment-variables/)
* **DISPLAY** kiolesura kinachotumiwa na **X**. Kipimo hiki kawaida huwekwa kama **:0.0**, ambayo inamaanisha kiolesura cha kwanza kwenye kompyuta ya sasa.
* **EDITOR** mhariri wa maandishi unaopendelewa na mtumiaji.
* **HISTFILESIZE** idadi kubwa ya mistari inayojumuishwa kwenye faili ya historia.
* **HISTSIZE** Idadi ya mistari inayoongezwa kwenye faili ya historia wakati mtumiaji anamaliza kipindi chake.
* **HOME** saraka yako ya nyumbani.
* **HOSTNAME** jina la mwenyeji wa kompyuta.
* **LANG** lugha yako ya sasa.
* **MAIL** eneo la sanduku la barua pepe la mtumiaji. Kawaida **/var/spool/mail/USER**.
* **MANPATH** orodha ya saraka za kutafuta kurasa za mwongozo.
* **OSTYPE** aina ya mfumo wa uendeshaji.
* **PS1** ishara ya amri ya msingi katika bash.
* **PATH** hifadhi njia ya saraka zote zinazoshikilia faili za binary unazotaka kutekeleza kwa kutoa jina la faili na sio njia ya kihusishi au kamili.
* **PWD** saraka ya kazi ya sasa.
* **SHELL** njia ya kabu ya amri ya sasa (kwa mfano, **/bin/bash**).
* **TERM** aina ya terminal ya sasa (kwa mfano, **xterm**).
* **TZ** eneo lako la muda.
* **USER** jina lako la mtumiaji la sasa.
## Vipimo vya kuvutia kwa udukuzi
2022-10-05 22:34:56 +00:00
### **HISTFILESIZE**
Badilisha **thamani ya kipimo hiki kuwa 0**, hivyo unapomaliza **kipindi chako** faili ya **historia** (\~/.bash\_history) **itafutwa**.
```bash
export HISTFILESIZE=0
```
2022-10-05 22:34:56 +00:00
### **HISTSIZE**
**Badilisha thamani ya kigezo hiki iwe 0**, ili unapomaliza kipindi chako cha **kikao** amri yoyote isiongezwe kwenye **faili ya historia** (\~/.bash\_history).
```bash
export HISTSIZE=0
```
2023-01-18 13:30:35 +00:00
### http\_proxy & https\_proxy
Mchakato utatumia **proxy** iliyotangazwa hapa kuunganisha kwenye mtandao kupitia **http au https**.
```bash
export http_proxy="http://10.10.10.10:8080"
2023-01-18 13:30:35 +00:00
export https_proxy="http://10.10.10.10:8080"
```
### SSL\_CERT\_FILE & SSL\_CERT\_DIR
Mchakato utaamini vyeti vilivyoorodheshwa katika **mazingira haya ya mazingira**.
```bash
2023-01-18 13:30:35 +00:00
export SSL_CERT_FILE=/path/to/ca-bundle.pem
export SSL_CERT_DIR=/path/to/ca-certificates
```
2022-10-05 22:34:56 +00:00
### PS1
**Badilisha jinsi kivinjari chako kinavyoonekana.**
2024-02-11 02:13:58 +00:00
[**Hii ni mfano**](https://gist.github.com/carlospolop/43f7cd50f3deea972439af3222b68808)
Mizizi:
![](<../.gitbook/assets/image (894).png>)
2024-02-11 02:13:58 +00:00
Mtumiaji wa kawaida:
![](<../.gitbook/assets/image (737).png>)
Kazi moja, mbili na tatu zilizowekwa nyuma:
![](<../.gitbook/assets/image (142).png>)
Kazi moja iliyowekwa nyuma, moja imezuiliwa na amri ya mwisho haikumalizika kwa usahihi:
![](<../.gitbook/assets/image (712).png>)
2022-04-28 16:01:33 +00:00
**Kikundi cha Usalama cha Kujaribu Kwa Bidii**
<figure><img src="../.gitbook/assets/telegram-cloud-document-1-5159108904864449420.jpg" alt=""><figcaption></figcaption></figure>
{% embed url="https://discord.gg/tryhardsecurity" %}
2022-04-28 16:01:33 +00:00
<details>
<summary><strong>Jifunze kuhusu kuvamia AWS kutoka sifuri hadi shujaa na</strong> <a href="https://training.hacktricks.xyz/courses/arte"><strong>htARTE (Mtaalam wa Timu Nyekundu ya AWS ya HackTricks)</strong></a><strong>!</strong></summary>
2022-04-28 16:01:33 +00:00
2024-02-11 02:13:58 +00:00
Njia nyingine za kusaidia HackTricks:
2024-02-02 12:19:57 +00:00
* Ikiwa unataka kuona **kampuni yako ikionekana katika HackTricks** au **kupakua HackTricks kwa PDF** Angalia [**MIPANGO YA KUJIUNGA**](https://github.com/sponsors/carlospolop)!
* Pata [**bidhaa rasmi za PEASS & HackTricks**](https://peass.creator-spring.com)
* Gundua [**Familia ya PEASS**](https://opensea.io/collection/the-peass-family), mkusanyiko wetu wa [**NFTs**](https://opensea.io/collection/the-peass-family) ya kipekee
* **Jiunge na** 💬 [**Kikundi cha Discord**](https://discord.gg/hRep4RUj7f) au kikundi cha [**telegram**](https://t.me/peass) au **tufuate** kwenye **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Shiriki mbinu zako za kuvamia kwa kuwasilisha PRs kwa** [**HackTricks**](https://github.com/carlospolop/hacktricks) na [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) repos za github.
2022-04-28 16:01:33 +00:00
</details>