Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
windows-vm
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
pem
windows-vm
Commits
ef9f48c1
Commit
ef9f48c1
authored
Apr 28, 2025
by
César Galvis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: pac working
parent
617c5b9b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
13 deletions
+32
-13
Vagrantfile
Vagrantfile
+1
-1
PacInstall.ps1
src/scripts/ps/PacInstall.ps1
+31
-0
PacScheduledTask.ps1
src/scripts/ps/PacScheduledTask.ps1
+0
-12
PacServer.ps1
src/scripts/ps/PacServer.ps1
+0
-0
No files found.
Vagrantfile
View file @
ef9f48c1
...
...
@@ -35,7 +35,7 @@ Vagrant.configure("2") do |config|
## Set up proxy
config
.
vm
.
provision
"file"
,
source:
"./src/config/squid-proxy.conf"
,
destination:
"C:/Squid/etc/squid/squid.conf"
## Set up PAC
config
.
vm
.
provision
"shell"
,
path:
"src/scripts/ps/PacS
cheduledTask
.ps1"
config
.
vm
.
provision
"shell"
,
path:
"src/scripts/ps/PacS
etup
.ps1"
## Restart machine
config
.
vm
.
provision
:shell
do
|
shell
|
shell
.
privileged
=
true
...
...
src/scripts/ps/PacInstall.ps1
0 → 100644
View file @
ef9f48c1
# PAC (Proxy Auto-Config) scheduled task setup
# Set Execution Policy
Set-ExecutionPolicy
Bypass -Force
# Variables
$taskName
=
"StartPACServer"
$proxyScriptPath
=
"C:\\vagrant\src\scripts\ps\PacServer.ps1"
# Check if the scheduled task already exists
if
(
Get-ScheduledTask
-TaskName
$taskName
-ErrorAction SilentlyContinue
)
{
Write-Host
"Scheduled Task '
$taskName
' already exists. Skipping creation."
}
else
{
Write-Host
"Scheduled Task '
$taskName
' does not exist. Creating..."
$Action
=
New-ScheduledTaskAction
-Execute
"powershell.exe"
-Argument
"-ExecutionPolicy Bypass -File
$proxyScriptPath
"
$Trigger
=
New-ScheduledTaskTrigger
-AtStartup
$Principal
=
New-ScheduledTaskPrincipal
-UserId
"SYSTEM"
-RunLevel Highest
$Settings
=
New-ScheduledTaskSettingsSet
-AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
Register-ScheduledTask
-TaskName
$taskName
-Action
$Action
-Trigger
$Trigger
-Principal
$Principal
-Settings
$Settings
}
# Open port 8080 in Windows Firewall if not already open
if
(
-not
(
Get-NetFirewallRule
-DisplayName
"Allow Proxy PAC Server"
-ErrorAction SilentlyContinue
))
{
New-NetFirewallRule
-DisplayName
"Allow Proxy PAC Server"
-Direction Inbound -Protocol TCP -LocalPort 8080 -Action Allow
Write-Host
"Firewall rule created to allow inbound connections on port 8080."
}
else
{
Write-Host
"Firewall rule 'Allow Proxy PAC Server' already exists. Skipping creation."
}
\ No newline at end of file
src/scripts/ps/PacScheduledTask.ps1
deleted
100644 → 0
View file @
617c5b9b
# PAC (Proxy Auto-Config) scheduled task setup
# Bypass policy
Set-ExecutionPolicy
Bypass -Force
# Create scheduled task
$Action
=
New-ScheduledTaskAction
-Execute
"powershell.exe"
-Argument
"-ExecutionPolicy Bypass -File C:\\vagrant\src\scripts\ps\PacSetup.ps1"
$Trigger
=
New-ScheduledTaskTrigger
-AtStartup
$Principal
=
New-ScheduledTaskPrincipal
-UserId
"SYSTEM"
-RunLevel Highest
$Settings
=
New-ScheduledTaskSettingsSet
-AllowStartIfOnBatteries -DontStopIfGoingOnBatteries
Register-ScheduledTask
-TaskName
"StartPACServer"
-Action
$Action
-Trigger
$Trigger
-Principal
$Principal
-Settings
$Settings
\ No newline at end of file
src/scripts/ps/PacSe
tup
.ps1
→
src/scripts/ps/PacSe
rver
.ps1
View file @
ef9f48c1
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment