mirror of
https://github.com/HackTricks-wiki/hacktricks-cloud.git
synced 2026-01-04 08:47:13 -08:00
Translated ['src/pentesting-ci-cd/cloudflare-security/cloudflare-domains
This commit is contained in:
173
src/pentesting-cloud/azure-security/az-services/az-postgresql.md
Normal file
173
src/pentesting-cloud/azure-security/az-services/az-postgresql.md
Normal file
@@ -0,0 +1,173 @@
|
||||
# Az - PostgreSQL Databases
|
||||
|
||||
{% hint style="success" %}
|
||||
Learn & practice AWS Hacking:<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">\
|
||||
Learn & practice GCP Hacking: <img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
||||
|
||||
<details>
|
||||
|
||||
<summary>Support HackTricks</summary>
|
||||
|
||||
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
|
||||
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**.**
|
||||
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
|
||||
|
||||
</details>
|
||||
{% endhint %}
|
||||
|
||||
## Azure PostgreSQL
|
||||
**Azure Database for PostgreSQL** は、**PostgreSQL** Community Edition に基づいた完全管理型の **リレーショナルデータベースサービス** です。さまざまなアプリケーションニーズに対してスケーラビリティ、セキュリティ、柔軟性を提供するように設計されています。Azure MySQL と同様に、PostgreSQL には 2 つのデプロイメントモデルがあります。
|
||||
|
||||
* **Single Server** (退役予定):
|
||||
- シンプルでコスト効果の高い PostgreSQL デプロイメントに最適化されています。
|
||||
- 自動バックアップ、基本的な監視、高可用性を特徴としています。
|
||||
- 予測可能なワークロードを持つアプリケーションに最適です。
|
||||
* **Flexible Server**:
|
||||
- データベース管理と構成に対するより大きな制御を提供します。
|
||||
- 同じゾーン内およびゾーン間での高可用性をサポートします。
|
||||
- 弾力的なスケーリング、自動メンテナンス、コスト削減機能を特徴としています。
|
||||
- コストを最適化するためにサーバーの開始と停止が可能です。
|
||||
|
||||
### Key Features
|
||||
|
||||
* **Custom Maintenance Windows**: 中断を最小限に抑えるために更新をスケジュールします。
|
||||
* **Active Monitoring**: データベースのパフォーマンスを追跡し改善するための詳細なメトリクスとログにアクセスします。
|
||||
* **Stop/Start Server**: ユーザーはサーバーを停止および開始できます。
|
||||
* **Automatic Backups**: 最大 35 日間の保持期間を設定可能な組み込みの毎日のバックアップ。
|
||||
* **Role-Based Access**: Azure Active Directory を通じてユーザー権限と管理アクセスを制御します。
|
||||
* **Security and Networking**: セキュアなデータベースアクセスのためにサーバーファイアウォールルールを管理し、必要に応じて仮想ネットワーク構成を切り離すことができます。
|
||||
|
||||
### Enumeration
|
||||
|
||||
{% tabs %}
|
||||
{% tab title="az cli" %}
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
# List servers in a resource group
|
||||
az postgres flexible-server list --resource-group <resource-group-name>
|
||||
# List databases in a flexible-server
|
||||
az postgres flexible-server db list --resource-group <resource-group-name> --server-name <server_name>
|
||||
# Show specific details of a Postgre database
|
||||
az postgres flexible-server db show --resource-group <resource-group-name> --server-name <server_name> --database-name <database_name>
|
||||
|
||||
# List firewall rules of the a server
|
||||
az postgres flexible-server firewall-rule list --resource-group <resource-group-name> --name <server_name>
|
||||
# List parameter values for a felxible server
|
||||
az postgres flexible-server parameter list --resource-group <resource-group-name> --server-name <server_name>
|
||||
# List private link
|
||||
az postgres flexible-server private-link-resource list --resource-group <resource-group-name> --server-name <server_name>
|
||||
|
||||
# List all ad-admin in a server
|
||||
az postgres flexible-server ad-admin list --resource-group <resource-group-name> --server-name <server_name>
|
||||
# List all user assigned managed identities from the server
|
||||
az postgres flexible-server identity list --resource-group <resource-group-name> --server-name <server_name>
|
||||
|
||||
# List the server backups
|
||||
az postgres flexible-server backup list --resource-group <resource-group-name> --name <server_name>
|
||||
# List all read replicas for a given server
|
||||
az postgres flexible-server replica list --resource-group <resource-group-name> --name <server_name>
|
||||
# List migrations
|
||||
az postgres flexible-server migration list --resource-group <resource-group-name> --name <server_name>
|
||||
|
||||
# Get the server's advanced threat protection setting
|
||||
az postgres flexible-server advanced-threat-protection-setting show --resource-group <resource-group-name> --name <server_name>
|
||||
# List all of the maintenances of a flexible server
|
||||
az postgres flexible-server maintenance list --resource-group <resource-group-name> --server-name <server_name>
|
||||
# List log files for a server.
|
||||
az postgres flexible-server server-logs list --resource-group <resource-group-name> --server-name <server_name>
|
||||
|
||||
```
|
||||
{% endcode %}
|
||||
{% endtab %}
|
||||
|
||||
{% tab title="Az PowerShell" %}
|
||||
{% code overflow="wrap" %}
|
||||
```powershell
|
||||
Get-Command -Module Az.PostgreSql
|
||||
|
||||
# List flexible-servers in a resource group
|
||||
Get-AzPostgreSqlFlexibleServer -ResourceGroupName <resource-group-name>
|
||||
# List databases in a flexible-server
|
||||
Get-AzPostgreSqlFlexibleServerDatabase -ResourceGroupName <resource-group-name> -ServerName <server_name>
|
||||
|
||||
# List firewall rules of the a flexible-server
|
||||
Get-AzPostgreSqlFlexibleServerFirewallRule -ResourceGroupName <resource-group-name> -ServerName <server_name>
|
||||
|
||||
# List configuration settings of a flexible server
|
||||
Get-AzPostgreSqlFlexibleServerConfiguration -ResourceGroupName <resource-group-name> -ServerName <server_name>
|
||||
# Get the connection string for a flexible server
|
||||
Get-AzPostgreSqlFlexibleServerConnectionString -ResourceGroupName <resource-group-name> -ServerName <server_name> -Client <client>
|
||||
|
||||
Get-AzPostgreSqlFlexibleServerLocationBasedCapability -Location <location>
|
||||
|
||||
# List servers in a resource group
|
||||
Get-AzPostgreSqlServer -ResourceGroupName <resource-group-name>
|
||||
|
||||
```
|
||||
{% endcode %}
|
||||
{% endtab %}
|
||||
{% endtabs %}
|
||||
|
||||
### 接続
|
||||
|
||||
拡張機能 rdbms-connect を使用すると、次のようにデータベースにアクセスできます:
|
||||
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
az postgres flexible-server connect -n <server-name> -u <username> -p <password> --interactive
|
||||
|
||||
#or execute commands
|
||||
az postgres flexible-server execute \
|
||||
-n <server-name> \
|
||||
-u <username> \
|
||||
-p "<password>" \
|
||||
-d <database-name> \
|
||||
--querytext "SELECT * FROM <table-name>;"
|
||||
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
または
|
||||
{% code overflow="wrap" %}
|
||||
```bash
|
||||
psql -h testpostgresserver1994.postgres.database.azure.com -p 5432 -U adminuser <database-name>
|
||||
```
|
||||
{% endcode %}
|
||||
|
||||
## 参考文献
|
||||
|
||||
* [https://learn.microsoft.com/en-us/azure/postgresql/](https://learn.microsoft.com/en-us/azure/postgresql/)
|
||||
* [https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/service-overview](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/service-overview)
|
||||
* [https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/overview](https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/overview)
|
||||
|
||||
## 権限昇格
|
||||
|
||||
{% content-ref url="../az-privilege-escalation/az-postgresql-privesc.md" %}
|
||||
[az-postgresql-privesc.md](../az-privilege-escalation/az-postgresql-privesc.md)
|
||||
{% endcontent-ref %}
|
||||
|
||||
## ポストエクスプロイト
|
||||
|
||||
{% content-ref url="../az-post-exploitation/az-postgresql-post-exploitation.md" %}
|
||||
[az-postgresql-post-exploitation.md](../az-post-exploitation/az-postgresql-post-exploitation.md)
|
||||
{% endcontent-ref %}
|
||||
|
||||
## ToDo
|
||||
|
||||
* ad-adminでアクセスする方法を探して、権限昇格の手法であることを確認する
|
||||
|
||||
|
||||
{% hint style="success" %}
|
||||
AWSハッキングを学び、実践する:<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="../../../.gitbook/assets/image (1) (1) (1) (1).png" alt="" data-size="line">\
|
||||
GCPハッキングを学び、実践する:<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="../../../.gitbook/assets/image (2) (1).png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
|
||||
|
||||
<details>
|
||||
|
||||
<summary>HackTricksをサポートする</summary>
|
||||
|
||||
* [**サブスクリプションプラン**](https://github.com/sponsors/carlospolop)を確認してください!
|
||||
* **💬 [**Discordグループ**](https://discord.gg/hRep4RUj7f)または[**テレグラムグループ**](https://t.me/peass)に参加するか、**Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks_live)**をフォローしてください。**
|
||||
* **[**HackTricks**](https://github.com/carlospolop/hacktricks)および[**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud)のGitHubリポジトリにPRを提出してハッキングトリックを共有してください。**
|
||||
|
||||
</details>
|
||||
{% endhint %}
|
||||
Reference in New Issue
Block a user