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.
-
Install .NET SDK:
Download and install the .NET SDK 8.0 for your operating system from here. -
Verify installation:
Run the following command in your terminal to confirm:dotnet --list-sdks
Preparation:
-
Navigate to:
Computer Management → Local Users and Groups -
Create Users:
- Administrator1 (password:
1234
) - Operator1 (password:
1234
) - SuperAdministrator1 (password:
1234
) - MainService (password:
1234
) - LoadBalancer (password:
1234
) - Worker1 (password:
1234
) - Worker2 (password:
1234
)
- Administrator1 (password:
-
Create Groups:
- Admin → Add Administrator1
- Operator → Add Operator1
- Super-administrator → Add SuperAdministrator1
-
Locate
makecert.exe
:
Navigate toC:\Program Files (x86)\Windows Kits\10\bin
and find the folder corresponding to your version (e.g.,\10.0.22621.0\x86
). -
Open Command Prompt:
Run Command Prompt as Administrator and move to the directory withmakecert.exe
:cd "C:\Program Files (x86)\Windows Kits\10\bin\10.0.22621.0\x86"
-
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
- Locate
TestCA.cer
, double-click, and choose Install Certificate. - Select Local Machine → Place in Trusted Root Certification Authorities → Next → Finish.
-
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.
-
Locate
.cer
files (e.g.,Worker1.cer
), double-click, and follow these steps:- Select Local Machine.
- Place in Trusted People.
- Click Finish.
-
Repeat these steps for
Worker2
andLoadBalancer
.
-
Open MMC:
- Press
Windows + R
, typemmc
, and hit Enter.
- Press
-
Add Certificates Snap-in:
- Go to File → Add/Remove Snap-ins.
- Select Certificates.
- Choose Computer Account → Local Computer → Finish.
-
Configure Worker1 Certificate:
- Locate
Worker1
under Personal > Certificates. - Right-click the certificate → Select Manage Private Keys.
- Add
Worker1
user → Click OK.
- Locate
-
Repeat these steps for
Worker2
andLoadBalancer
.
Run:
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
- Open the Developer Command Prompt for VS 2022.
- Build the project using the following command:
msbuild Smart_Meter.sln /p:Configuration=Debug /p:Platform=x64
- Navigate to the
Project_OIB_Smart_Meter
folder. - Right-click on the
Smart_Meter
folder → Select Properties. - Go to the Security tab and add all created users with Full Control permissions.
- 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.
-
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.
- Navigate to:
-
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.
- Navigate to:
-
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.
- Navigate to:
-
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
- Navigate to: