Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dimkinthepro/wireguard-bundle
Wireguard bundle for Symfony
https://github.com/dimkinthepro/wireguard-bundle
bundle symfony vpn wire-guard wireguard
Last synced: 8 days ago
JSON representation
Wireguard bundle for Symfony
- Host: GitHub
- URL: https://github.com/dimkinthepro/wireguard-bundle
- Owner: dimkinthepro
- Created: 2023-11-05T16:39:10.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-01-12T07:34:24.000Z (10 months ago)
- Last Synced: 2024-04-12T20:18:50.706Z (7 months ago)
- Topics: bundle, symfony, vpn, wire-guard, wireguard
- Language: PHP
- Homepage:
- Size: 30.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# Wireguard bundle for Symfony
### 1. Create wireguard bundle configuration:
```yaml
# config/packages/dimkinthepro_wireguard.yamldimkinthepro_wireguard:
wg_interface: 'wg0'
server_interface: 'eth0' # External interface of the server
server_external_ip: '93.88.75.12' # External IP of the server
server_internal_ip: '10.0.0.1/8' # Will be used for wireguard users
peer_allowed_ips: '0.0.0.0/0' # Can be separated by comma: '192.168.1.0/24, 192.168.2.0/24'
dns: '8.8.8.8,8.8.4.4'
port: '51999'
```### 2. Installation:
```bash
composer require dimkinthepro/wireguard-bundle
```### 3. Check bundles config:
```php
# config/bundles.phpreturn [
#...
Dimkinthepro\Wireguard\DimkintheproWireguardBundle::class => ['all' => true],
];
```### 4. Grand access to wireguard config for php
```bash
chown "www-data:www-data" /etc/wireguard```
### 5. Grand access for php
```bash
echo 'www-data ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers
```### 6. Usage example
```php
# src/Infrastructure/Service/VpnService.phpsetId(1);
$this->peerManager->setupKeyPairs($peer);
$this->peerManager->setupIp($peer);return $peer;
}public function upServer(Peer $peer): void
{
$config = $this->vpnConfigMaker->makeServerConfig($peer);
$this->vpnManager->applyConfig($config);
$this->vpnManager->up();
}public function getQrCode(Peer $peer): string
{
$peerConfig = $this->vpnConfigMaker->makePeerConfig($peer);return $this->qrCodeGenerator->getQrCodeImage($peerConfig);
}
}
```