Skip to content

Acile067/Project_OIB_Smart_Meter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Smart Meter

Developed as a project for the course 'Fundamentals of Information Security', the system processes smart meter readings and stores data on the recorded consumption. Security is achieved through the use of certificates, RBAC (Role-Based Access Control), and an event logger.

Built using

Installation:

  1. Install .NET SDK:
    Download and install the .NET SDK 8.0 for your operating system from here.

  2. Verify installation:
    Run the following command in your terminal to confirm:

    dotnet --list-sdks

How to run:

Preparation:

1. Create Users and Groups

  1. Navigate to:
    Computer ManagementLocal Users and Groups

  2. Create Users:

    • Administrator1 (password: 1234)
    • Operator1 (password: 1234)
    • SuperAdministrator1 (password: 1234)
    • MainService (password: 1234)
    • LoadBalancer (password: 1234)
    • Worker1 (password: 1234)
    • Worker2 (password: 1234)
  3. Create Groups:

    • Admin → Add Administrator1
    • Operator → Add Operator1
    • Super-administrator → Add SuperAdministrator1

2. Create and Install Certificates

  1. Locate makecert.exe:
    Navigate to C:\Program Files (x86)\Windows Kits\10\bin and find the folder corresponding to your version (e.g., \10.0.22621.0\x86).

  2. Open Command Prompt:
    Run Command Prompt as Administrator and move to the directory with makecert.exe:

    cd "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86"

3. Generate Certificates:

  • Self-Signed Certificate:

    makecert -n "CN=TestCA" -r -sv TestCA.pvk TestCA.cer
  • Worker and LoadBalancer Certificates:

    Generate .pvk and .cer files:

    makecert -sv Worker1.pvk -iv TestCA.pvk -n "CN=Worker1" -pe -ic TestCA.cer Worker1.cer -sr localmachine -ss My -sky exchange
    makecert -sv Worker2.pvk -iv TestCA.pvk -n "CN=Worker2" -pe -ic TestCA.cer Worker2.cer -sr localmachine -ss My -sky exchange
    makecert -sv LoadBalancer.pvk -iv TestCA.pvk -n "CN=LoadBalancer" -pe -ic TestCA.cer LoadBalancer.cer -sr localmachine -ss My -sky exchange

    Generate .pfx Files:

    pvk2pfx.exe /pvk Worker1.pvk /pi 1234 /spc Worker1.cer /pfx Worker1.pfx
    pvk2pfx.exe /pvk Worker2.pvk /pi 1234 /spc Worker2.cer /pfx Worker2.pfx
    pvk2pfx.exe /pvk LoadBalancer.pvk /pi 1234 /spc LoadBalancer.cer /pfx LoadBalancer.pfx

4. Install Certificates:

TestCA Certificate

  1. Locate TestCA.cer, double-click, and choose Install Certificate.
  2. Select Local Machine → Place in Trusted Root Certification Authorities → Next → Finish.

Worker and LoadBalancer Certificates

  1. Locate .pfx files (e.g., Worker1.pfx), double-click, and follow these steps:

    • Select Local Machine.
    • Enter password 1234.
    • Check Mark this key as exportable.
    • Place in Personal store.
  2. Locate .cer files (e.g., Worker1.cer), double-click, and follow these steps:

    • Select Local Machine.
    • Place in Trusted People.
    • Click Finish.
  3. Repeat these steps for Worker2 and LoadBalancer.


5. Manage Certificates in MMC:

  1. Open MMC:

    • Press Windows + R, type mmc, and hit Enter.
  2. Add Certificates Snap-in:

    • Go to FileAdd/Remove Snap-ins.
    • Select Certificates.
    • Choose Computer AccountLocal Computer → Finish.
  3. Configure Worker1 Certificate:

    • Locate Worker1 under Personal > Certificates.
    • Right-click the certificate → Select Manage Private Keys.
    • Add Worker1 user → Click OK.
  4. Repeat these steps for Worker2 and LoadBalancer.


Run:

1. Clone the project:

Clone the repository and navigate to the appropriate directory:

git clone https://github.com/Acile067/Project_OIB_Smart_Meter.git
cd Project_OIB_Smart_Meter/Smart_Meter

2. Build the Project

Build using MSVC:

  1. Open the Developer Command Prompt for VS 2022.
  2. Build the project using the following command:
msbuild Smart_Meter.sln /p:Configuration=Debug /p:Platform=x64

3. Set Security Permissions

  1. Navigate to the Project_OIB_Smart_Meter folder.
  2. Right-click on the Smart_Meter folder → Select Properties.
  3. Go to the Security tab and add all created users with Full Control permissions.

4. Run the Project

Important Notes:

  • First-Time Run: The service must be run as an administrator the first time to allow it to create the Event Log File.
  • For subsequent runs, use the specific accounts mentioned below.

Steps:

  1. Run the Service:

    • Navigate to: \Smart_Meter\Service\bin\Debug.
    • Hold Shift + Right-Click on Service.exe → Select Run as different user.
    • For the first run, select the Administrator account. For subsequent runs, use the MainService account.
  2. Run the Load Balancer:

    • Navigate to: \Smart_Meter\LoadBalancer\bin\Debug.
    • Hold Shift + Right-Click on LoadBalancer.exe → Select Run as different user → Use the LoadBalancer account.
  3. Run Workers:

    • Navigate to: \Smart_Meter\Worker\bin\Debug.
    • Hold Shift + Right-Click on Worker.exe → Select Run as different user.
    • Run two instances:
      • One using the Worker1 account.
      • One using the Worker2 account.
  4. Run Clients:

    • Navigate to: \Smart_Meter\Client\bin\Debug.
    • Hold Shift + Right-Click on Client.exe → Select Run as different user.
    • Run instances using the following accounts:
      • Administrator1
      • SuperAdministrator1
      • Operator1

About

Projekat iz predmeta Osnove informacione bezbednosti IS (oib). Pametno brojilo.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages