Skip to content

SadikSunbul/GoPolicy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Go Policy Logo

Go Policy

Windows Group Policy Editor - Web-Based Interface for All Windows Versions

Go Version License Platform

Features β€’ Installation β€’ Usage β€’ API Documentation β€’ Contributing


πŸ“– About

Go Policy is a modern, web-based Windows Group Policy Editor written in Go. This project is inspired by the original PolicyPlus project, which was written in Visual Basic .NET. Go Policy provides the same powerful functionality with a modern web interface, making it accessible from any browser.

Inspiration

This project is inspired by and based on the excellent work done in PolicyPlus by Fleex255. The original PolicyPlus project demonstrated how to work with Windows Group Policy settings without requiring the full Group Policy infrastructure, making it accessible on all Windows editions including Home versions.

Go Policy takes this concept further by:

  • Rewriting the core logic in Go for better performance and cross-platform potential
  • Adding a modern web interface for easier access and better user experience
  • Maintaining full compatibility with Windows Group Policy structures (ADMX/ADML files)
  • Providing RESTful API endpoints for programmatic access

Key Differences from PolicyPlus

While PolicyPlus is a desktop application, Go Policy is a web-based solution that:

  • Runs as a local web server
  • Can be accessed from any device on your network
  • Provides a REST API for automation
  • Uses modern web technologies for a responsive UI

Note: Policy descriptions and explanations will appear in your device's language based on the ADML (Administrative Template Language) files available on your system. The interface automatically detects and uses the appropriate language files.


✨ Features

  • βœ… Works on all Windows versions (Home, Pro, Enterprise, Server)
  • 🌐 Modern web-based interface - Access from any browser
  • πŸ“ Full ADMX/ADML support - Reads all Windows policy definitions
  • πŸ’Ύ Registry-based policy management - Direct registry manipulation
  • πŸ” Advanced search - Find policies by name or description
  • 🎨 Dark mode UI - Modern, professional design
  • πŸš€ Fast and lightweight - Built with Go for optimal performance
  • πŸ”„ Explorer refresh - Restart Windows Explorer with one click
  • πŸ“± Responsive design - Works on desktop and tablet devices
  • 🌍 Multi-language support - Policy descriptions in your system language

🎯 What Can You Do with Go Policy?

Go Policy allows you to manage a wide range of Windows system and user settings through Group Policy. Here are some common use cases:

System Management:

  • πŸ”’ Block/enable USB ports - Control USB device access
  • πŸ–ΌοΈ Prevent wallpaper changes - Lock desktop customization
  • 🎨 Customize Start menu - Configure Start menu appearance and behavior
  • 🌐 Manage network settings - Control network connection policies
  • πŸ” Apply security policies - Enforce security configurations
  • πŸ”„ Control Windows Update - Manage update settings and policies
  • πŸ“± Device restrictions - Limit access to specific devices or features
  • 🚫 Application control - Block or allow specific applications
  • πŸ”‘ Password policies - Configure password requirements
  • πŸ“‚ File system access - Control access to drives and folders

And hundreds more system settings...

Integration with Your Projects

Go Policy provides RESTful API endpoints that allow you to integrate Group Policy management into your own applications and automation scripts. Whether you're building:

  • Configuration management tools - Automate policy deployment
  • IT administration dashboards - Centralized policy management
  • DevOps pipelines - Policy enforcement in CI/CD workflows
  • Monitoring systems - Track and audit policy changes
  • Custom automation scripts - Programmatic policy configuration

You can use the REST API to:

  • List and search policies programmatically
  • Read current policy states
  • Apply policy changes via API calls
  • Integrate with existing infrastructure management tools

See the API Documentation section for detailed endpoint information and examples.


🎯 Main Goals

  1. Universal Access: Works on all Windows versions including Home editions
  2. License Compliance: No Windows components shipped, uses system files
  3. Full-Featured: Complete Group Policy management capabilities
  4. Easy to Use: Intuitive web interface accessible from any browser
  5. Developer Friendly: RESTful API for automation and integration

πŸ“¦ Installation

Requirements

  • Go 1.21 or higher (for building from source)
  • Windows Vista or higher (Windows Server 2008+ supported)
  • Web browser (Chrome, Firefox, Edge, Safari, etc.)
  • Administrator privileges (required for policy changes)

Quick Start (Binary)

  1. Download the latest release from the Releases page
  2. Extract the executable
  3. Run gopolicy.exe (or gopolicy on other platforms)
    • Default port (8080): gopolicy.exe
    • Custom port: gopolicy.exe -p 9000
  4. Open your browser and navigate to http://localhost:8080 (or your custom port)
  5. Important: For policy changes, run as Administrator (right-click β†’ Run as administrator)

Build from Source

# Clone the repository
git clone https://github.com/SadikSunbul/GoPolicy.git
cd GoPolicy

# Install dependencies
go mod download

# Build the application
go build -o gopolicy.exe

# Run the application
# Default port (8080)
./gopolicy.exe

# Or specify a custom port
./gopolicy.exe -p 9000

Command Line Options

  • -p <port>: Specify the port number (default: 8080)
    • Example: gopolicy.exe -p 9000 runs on port 9000
    • Example: gopolicy.exe runs on default port 8080

πŸš€ Usage

Starting the Application

When you start Go Policy, you'll see output like this:

Policy Plus - Go Edition
Local Group Policy Editor for all Windows editions
========================================
Loading ADMX files: C:\Windows\PolicyDefinitions
Detected locales: [en-US, tr-TR]
Starting web interface: http://localhost:8080
Open in your browser and start using!

Using the Web Interface

  1. Open the Web Interface

    • Navigate to http://localhost:8080 in your browser
    • The interface will load with all available policy categories
  2. Browse Categories

    • Use the left sidebar to navigate through policy categories
    • Categories are organized by User Configuration and Computer Configuration
    • Click on a category to see its policies
  3. Search Policies

    • Use the search box in the sidebar to find policies by name or description
    • Filter by User, Computer, or Both sections
    • Search results appear in real-time
  4. View and Edit Policies

    • Click on a policy from the list to view its details in the right panel
    • Configure the policy state: Enabled, Disabled, or Not Configured
    • Set policy-specific values if the policy has configurable elements
    • Click "Apply" to save your changes
  5. Refresh Explorer

    • After making policy changes, click "Refresh Explorer" to restart Windows Explorer
    • This ensures some policy changes take effect immediately

Example Screenshots

Main Interface Main interface showing categories and policy list

Policy Configuration Policy configuration panel with settings

Search Results Search functionality with filtered results


πŸ”§ API Documentation

Go Policy provides a RESTful API for programmatic access. All API endpoints return JSON responses.

Base URL

http://localhost:8080

Endpoints

1. Get Main Page

GET /

Returns the main HTML page of the web interface.

Response: HTML content


2. List Categories

GET /api/categories

Retrieves all policy categories organized by User and Computer configurations.

Response:

{
  "user": [
    {
      "id": "category-id",
      "name": "Category Name",
      "description": "Category description",
      "policyCount": 10,
      "children": [...]
    }
  ],
  "computer": [...]
}

Usage Example:

curl http://localhost:8080/api/categories

3. List Policies

GET /api/policies?category={categoryId}

Retrieves all policies in a specific category.

Parameters:

  • category (required): The category ID

Response:

[
  {
    "id": "policy-id",
    "name": "Policy Name",
    "description": "Policy description",
    "state": "Not Configured",
    "section": "User"
  }
]

Usage Example:

curl "http://localhost:8080/api/policies?category=NetworkConnections"

4. Get Policy Details

GET /api/policy/{policyId}

Retrieves detailed information about a specific policy, including its current state and configurable elements.

Parameters:

  • policyId (path): The policy ID

Response:

{
  "id": "policy-id",
  "name": "Policy Name",
  "description": "Detailed policy description",
  "state": "Enabled",
  "section": "User",
  "registryKey": "Software\\Policies\\Microsoft\\Windows\\...",
  "elements": [
    {
      "id": "element-id",
      "type": "text",
      "label": "Element Label",
      "description": "Element description",
      "required": false,
      "defaultValue": "default value"
    }
  ]
}

Usage Example:

curl http://localhost:8080/api/policy/NC_AllowAdvancedTCPIPConfig

5. Set Policy State

POST /api/policy/set
Content-Type: application/json

Applies a policy configuration to the system.

Request Body:

{
  "policyId": "policy-id",
  "state": "Enabled",
  "section": "user",
  "options": {
    "element-id": "value"
  }
}

Parameters:

  • policyId (required): The policy ID
  • state (required): One of Enabled, Disabled, or NotConfigured
  • section (optional): user or machine (defaults based on policy)
  • options (optional): Object containing element values for the policy

Response:

{
  "success": true,
  "message": "Policy updated successfully",
  "verifiedState": "Enabled"
}

Usage Example:

curl -X POST http://localhost:8080/api/policy/set \
  -H "Content-Type: application/json" \
  -d '{
    "policyId": "NC_AllowAdvancedTCPIPConfig",
    "state": "Enabled",
    "section": "user"
  }'

6. Search Policies

GET /api/search?q={query}&section={section}

Searches for policies by name or description.

Parameters:

  • q (required): Search query
  • section (optional): user, computer, or both (default: both)

Response:

{
  "query": "search term",
  "user": [
    {
      "id": "policy-id",
      "name": "Policy Name",
      "description": "Description",
      "state": "Not Configured",
      "section": "User",
      "categoryId": "category-id",
      "categoryName": "Category Name"
    }
  ],
  "computer": [...],
  "total": 5
}

Usage Example:

curl "http://localhost:8080/api/search?q=network&section=both"

7. List Policy Sources

GET /api/sources

Retrieves available policy sources (Registry, Local GPO, etc.).

Response:

[
  {
    "type": "Local GPO",
    "path": "C:\\Windows\\System32\\GroupPolicy",
    "writable": true
  },
  {
    "type": "Registry",
    "path": "HKLM",
    "writable": true
  }
]

Usage Example:

curl http://localhost:8080/api/sources

8. Save Policies

POST /api/save

Saves all pending policy changes to disk (for POL file-based sources).

Response:

{
  "success": true,
  "message": "Changes saved"
}

Usage Example:

curl -X POST http://localhost:8080/api/save

9. Refresh Windows Explorer

POST /api/refresh-explorer

Restarts Windows Explorer to apply policy changes that require a shell restart.

Response:

{
  "success": true,
  "message": "Windows Explorer restarted successfully"
}

Usage Example:

curl -X POST http://localhost:8080/api/refresh-explorer

Note: This endpoint requires administrator privileges.


Error Responses

All API endpoints may return error responses in the following format:

{
  "error": "Error message description"
}

Common HTTP status codes:

  • 200 OK - Request successful
  • 400 Bad Request - Invalid request parameters
  • 404 Not Found - Resource not found
  • 405 Method Not Allowed - Invalid HTTP method
  • 500 Internal Server Error - Server error

🎨 Customization

Change Port

Edit main.go and modify the port variable:

port := ":8080"  // Change to your desired port

Change ADMX Folder

By default, Go Policy uses C:\Windows\PolicyDefinitions. To use a custom folder:

admxPath := "C:\\YourCustomPath\\PolicyDefinitions"

Customize UI

  • Colors: Edit CSS variables in web/static/style.css
  • Layout: Modify internal/handlers/templates/index.gohtml
  • Behavior: Update web/static/app.js

πŸ› Troubleshooting

ADMX Files Cannot Be Loaded

Problem: Policies don't appear or categories are empty.

Solution:

  1. Verify ADMX files exist in C:\Windows\PolicyDefinitions
  2. On Windows Home editions, download ADMX files from Microsoft
  3. Extract to C:\Windows\PolicyDefinitions folder

Port Already in Use

Problem: Application fails to start with port error.

Solution:

  • Change the port in main.go
  • Or close the application using port 8080

Access Denied Errors

Problem: Policy changes fail with access denied.

Solution:

  • Run as Administrator - Right-click the executable and select "Run as administrator"
  • Some policy changes require elevated privileges
  • Note: Even when compiled to an .exe file, administrator privileges are still required for registry write operations. This is a Windows security requirement, not a limitation of the application.

Policies Not Taking Effect

Problem: Changes are saved but don't apply.

Solution:

  1. Click "Refresh Explorer" button
  2. Log off and log back in
  3. Restart your computer for some policies
  4. Run gpupdate /force in Command Prompt as administrator

Language/Translation Issues

Problem: Policy descriptions appear in wrong language.

Solution:

  • Go Policy uses ADML files from your system
  • Ensure your system has the correct language pack installed
  • ADML files should be in C:\Windows\PolicyDefinitions\{locale}

🀝 Contributing

We welcome contributions! Here's how you can help:

How to Contribute

  1. Fork the Repository

    # Click the "Fork" button on GitHub
  2. Create a Feature Branch

    git checkout -b feature/your-feature-name
  3. Make Your Changes

    • Write clean, documented code
    • Follow Go coding conventions
    • Add tests if applicable
    • Update documentation
  4. Commit Your Changes

    git commit -m "Add: Description of your feature"
  5. Push to Your Fork

    git push origin feature/your-feature-name
  6. Open a Pull Request

    • Go to the original repository on GitHub
    • Click "New Pull Request"
    • Select your branch
    • Describe your changes

Contribution Guidelines

  • Code Style: Follow standard Go formatting (go fmt)
  • Documentation: Update README.md and code comments
  • Testing: Test your changes on Windows
  • Issues: Reference related issues in your PR
  • Commits: Write clear, descriptive commit messages

Areas for Contribution

  • πŸ› Bug Fixes: Fix issues reported in the issue tracker
  • ✨ New Features: Add requested features
  • πŸ“š Documentation: Improve documentation and examples
  • 🎨 UI/UX: Enhance the web interface
  • ⚑ Performance: Optimize code and improve speed
  • 🌍 Localization: Add support for more languages
  • πŸ§ͺ Testing: Add unit tests and integration tests

Reporting Issues

When reporting issues, please include:

  • Windows version
  • Go version (if building from source)
  • Steps to reproduce
  • Expected vs actual behavior
  • Screenshots (if applicable)
  • Error messages

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgments

  • Original PolicyPlus Project: Fleex255/PolicyPlus

    • This project is inspired by and based on the excellent work done by Fleex255
    • PolicyPlus demonstrated how to work with Windows Group Policy without full infrastructure
    • Go Policy adapts these concepts to a modern web-based architecture
  • Go Community: For the excellent tools and libraries

  • Contributors: Everyone who has helped improve this project


⭐ If you liked this project, don't forget to give it a star! ⭐

Made with ❀️ using Go

⬆ Back to Top

About

πŸ›‘οΈ Group Policy Editor for all Windows editions. Built with Go. Web UI + REST API.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors 2

  •  
  •