SlideShare a Scribd company logo
1 of 32
Download to read offline
Accessing data on a Simatic S7-1200/1500 using Python
Accessing data securely by configuring the integrated OPC UA Server
www.spektrum-engineering.de Spektrum Engineering 1
1. Enabling and setting up OPC UA in TIA Project
a) Setting up security mechanisms based on X.509 certificates to enable authentication and encryption in TIA Portal
b) Setting up general PLC security mechanisms
2. Installing python-opcua and opcua-client using pip (on Windows)
a) Install clients and test installation
b) Create client certificate in TIA Portal for Python client
3. Accessing data on the SIMATIC S7-1200/S7-1500
www.spektrum-engineering.de Spektrum Engineering 2
TOC
www.spektrum-engineering.de Spektrum Engineering 3
PLC Configuration in TIA Portal
www.spektrum-engineering.de Spektrum Engineering 4
Network Topology
OPC UA Client (Python):
IP Adresse: xxx.xxx.xxx.xxx
OPC UA Server:
IP Adresse: xxx.xxx.xxx.xxx
TCP/IP Ethernet
www.spektrum-engineering.de Spektrum Engineering 5
Enable OPC UA Server in TIA Project
Purchase OPC UA License from
Siemens Industry Mall and
activate it in your TIA project
www.spektrum-engineering.de Spektrum Engineering 6
Enable OPC UA Server in TIA Project
Activate OPC UA Server for
selected PLC in Device
Configuration.
Make sure to follow security
setup instructions on the
following slides to avoid
unrestricted OPC UA access!
www.spektrum-engineering.de Spektrum Engineering 7
Enable OPC UA Server in TIA Project
…user management via project
security settings is available only
in case the entire project is
protected!
→ protect your TIA project
www.spektrum-engineering.de Spektrum Engineering 8
Setting up OPC UA security mechanisms
Protect entire project to enable advanced
security mechanisms such as:
- project-wide user administration
- project-wide certificate manager
Defining project-wide security settings has the advantage,
that you can administer security settings globally for
multiple PLCs in your project.
In addition, when accessing your PLCs remotely using OPC
UA, it is more comfortable/securer to maintain your
certificates and users project-wide for all PLCs instead of
individually for every single PLC.
www.spektrum-engineering.de Spektrum Engineering 9
Setting up OPC UA security mechanisms
Mutual Authentication
OPC UA Client (Python):
IP Adresse: xxx.xxx.xxx.xxx
OPC UA Server:
IP Adresse: xxx.xxx.xxx.xxx
TCP/IP Ethernet
TCP/IP Ethernet
Client presents its certificate to
server
Server needs to „know“ the client‘s certificate and has to
have it marked as „trusted“ to accept the connection request.
Server presents its certificate to
the server.
Client needs to „know“ the server‘s certificate and has to have it
marked as „trusted“ to accept the connection request.
www.spektrum-engineering.de Spektrum Engineering 12
Setting up OPC UA security mechanisms
Enable project wide certificate manager for
selected PLC
→ All PLC-specific certificates will be lost!
(may cause trouble with OPC UA clients if your PLCs are currently used
in existing environments)
www.spektrum-engineering.de Spektrum Engineering 13
Setting up OPC UA security mechanisms
Server Certificate
In the PLC specific certificate manager create a new
certificate for the OPC Server!
(This creates a key pair)
For the Certificate Authority (CA) select one of the
suggested above (alternatively import your CA in the global
certificate manager, which is not part of this slide deck)
www.spektrum-engineering.de Spektrum Engineering 14
Setting up OPC UA security mechanisms
Server Certificate
Device specific certificate manager,
showing recently created certificate
→ Same certificate will be shown in
project wide certificate manager
www.spektrum-engineering.de Spektrum Engineering 15
Setting up OPC UA security mechanisms
Server Certificate
Global certificate manager showing
recently generated certificate
www.spektrum-engineering.de Spektrum Engineering 16
Add created certificate to OPC UA server
settings
Setting up OPC UA security mechanisms
Server Certificate
www.spektrum-engineering.de Spektrum Engineering 17
Configure supported authentication and
encryption schemes the PLC should
support!
Disable “No security” to enforce
cryptographic client authentication and
encrypted communication!
Setting up OPC UA security mechanisms
Server Certificate
www.spektrum-engineering.de Spektrum Engineering 18
Setting up OPC UA security mechanisms
Disable “Enable guest authentication” to
avoid anonymous access by anyone
without username and password!
Enable “Enable username and password
authentication”, define a username and
password which will be granted access to
the OPC UA Server
www.spektrum-engineering.de Spektrum Engineering 19
Setting up general PLC security mechanisms
Using OPC UA server means connecting
the PLC to a network at the same time.
Therefore, disable unprotected access to
the PLC in any case by disabling
anonymous access without username and
password. Especially for Online Access,
Programming Access and for HMI Access,
as well!
www.spektrum-engineering.de Spektrum Engineering 20
Setting up general PLC security mechanisms
Set a password for your PLC display when
“Enable write access” is activated (S7-
1500)!
www.spektrum-engineering.de Spektrum Engineering 21
Installing OPC UA Python client
www.spektrum-engineering.de Spektrum Engineering 22
Installing OPC UA Python library into a virtualenv
Create a python virtualenv and install opcua, opcua-client and PyQt5 into using pip:
• pip install opcua opcua-client PyQt5
opcua – client library – https://github.com/FreeOpcUa/python-opcua
opcua-client – demo application – https://github.com/FreeOpcUa/opcua-client-gui
PyQt5 – GUI framework required by opcua-client – https://pypi.org/project/PyQt5/
www.spektrum-engineering.de Spektrum Engineering 23
Installing OPC UA Python library into a virtualenv
Install optional libraries to support cryptographic schemes which we have set up in TIA project:
pip install crypto cryptography
www.spektrum-engineering.de Spektrum Engineering 24
Installing OPC UA Python library into a virtualenv
Install optional libraries to get full benefit using the opcua-client application
pip install pyqtgraph numpy
www.spektrum-engineering.de Spektrum Engineering 25
Installing OPC UA Python library into a virtualenv
Test your installation by starting the demo application from within your virtualenv: opcua-client
www.spektrum-engineering.de Spektrum Engineering 26
Create client certificate for Python in TIA Portal
Create second certificate for
client (this creates a key pair)
Use same CA for server and
client certificate!
In the field Subject Alternative Name, set
the string as seen on the left. This is
required by the OPC UA Python client
library which we will use later in the
project!
www.spektrum-engineering.de Spektrum Engineering 27
Create client certificate for Python in TIA Portal
In the global certificate manager, the newly
created client certificate is shown. Export the
certificate (in der format – seen on this slide)
and the belonging private key (in pem format –
seen on next slide). Export by secondary-click
on the certificate. This key-pair will be used to
authenticate the client to the server.
www.spektrum-engineering.de Spektrum Engineering 28
Create client certificate for Python in TIA Portal
Now export the private key and include the
certificate chain. We will be using this certificate
in our client application – which might run
unattended – therefore we will not protect the
private key with a password!
www.spektrum-engineering.de Spektrum Engineering 29
Limit access to clients on PLC
The PLC permits access to clients which provide
the recently created client certificate.
Add this certificate to the PLC “Trusted clients”
and disable “Automatically accept client
certificates during runtime” to prevent clients
from connecting which do not present a proper
certificate to the PLC.
Download the project to the PLC and set it to
Run Mode.
www.spektrum-engineering.de Spektrum Engineering 30
Connect to PLC using Python Client Library
Start the OPC UA Python client as described before.
In the address field type the URL in the following
format:
opc.tcp://<username>:<password>@<ip-address>:<port>
For example:
opc.tcp://OPCUser01:11223344Ki@192.168.1.232:4840
Click on “Connect options” and then on “Query
server capability” to get recommended connection
properties.
Set your client certificate and client private key!
www.spektrum-engineering.de Spektrum Engineering 31
Connect to PLC using Python Client Library
Close the “Connection Dialog” and click on
“Connect”.
You’ll be presented with the OPC UA XML tree
served by your SIMATIC PLC!
You can read/write only these variables/tags you
have granted access to in TIA portal!
www.spektrum-engineering.de Spektrum Engineering 32
Browse data blocks on PLC
You can access only the variables/tags you have allowed access to in TIA portal!
www.spektrum-engineering.de Spektrum Engineering 33
Spektrum Ingenieurgesellschaft mbH
Web: https://siincos-remote-connect.de
Mail: siincos@spektrum-engineering.de
linkedin.com/company/siincos/
instagram.com/spektrum.engineering/

More Related Content

What's hot

Plc and scada project ppt
Plc and scada project pptPlc and scada project ppt
Plc and scada project pptPriya Hada
 
PLC and SCADA training.
PLC and SCADA training.PLC and SCADA training.
PLC and SCADA training.Ishank Ranjan
 
Programmable Logic Controller(PLC)
Programmable Logic Controller(PLC)Programmable Logic Controller(PLC)
Programmable Logic Controller(PLC)Ahad Hossain
 
BOTTLE LINE SIMULLATION IN LOGIXPRO
BOTTLE LINE SIMULLATION IN LOGIXPROBOTTLE LINE SIMULLATION IN LOGIXPRO
BOTTLE LINE SIMULLATION IN LOGIXPROMohan Tangudu
 
Training report of PLC
Training report of PLCTraining report of PLC
Training report of PLCSumit Patidar
 
PLC: Programación y Automatización de PLC Siemens S7-200
PLC: Programación y Automatización de PLC Siemens S7-200PLC: Programación y Automatización de PLC Siemens S7-200
PLC: Programación y Automatización de PLC Siemens S7-200SANTIAGO PABLO ALBERTO
 
Industrial Networking - Profibus
Industrial Networking - ProfibusIndustrial Networking - Profibus
Industrial Networking - ProfibusYogesh Kumar
 
PLC: Controladores lógicos programables, folleto de apuntes y ejercicios
PLC: Controladores lógicos programables, folleto de apuntes y ejerciciosPLC: Controladores lógicos programables, folleto de apuntes y ejercicios
PLC: Controladores lógicos programables, folleto de apuntes y ejerciciosSANTIAGO PABLO ALBERTO
 
PLC and SCADA summer training report- government engineering college ajmer
PLC and SCADA summer training report- government engineering college ajmerPLC and SCADA summer training report- government engineering college ajmer
PLC and SCADA summer training report- government engineering college ajmerNemichand sencha
 
Plc course presentation
Plc course presentationPlc course presentation
Plc course presentationOsama Wahdan
 
Training Report on PLC & SCADA
Training Report on PLC & SCADATraining Report on PLC & SCADA
Training Report on PLC & SCADABhavya Bakshi
 
Plc presentation
Plc presentationPlc presentation
Plc presentationAkshay Modi
 
Esquemas abb
Esquemas abbEsquemas abb
Esquemas abbChajita
 

What's hot (20)

Plc and scada project ppt
Plc and scada project pptPlc and scada project ppt
Plc and scada project ppt
 
SIEMENS S7-300c.ppt
SIEMENS S7-300c.pptSIEMENS S7-300c.ppt
SIEMENS S7-300c.ppt
 
PLC and SCADA training.
PLC and SCADA training.PLC and SCADA training.
PLC and SCADA training.
 
Programmable Logic Controller(PLC)
Programmable Logic Controller(PLC)Programmable Logic Controller(PLC)
Programmable Logic Controller(PLC)
 
BOTTLE LINE SIMULLATION IN LOGIXPRO
BOTTLE LINE SIMULLATION IN LOGIXPROBOTTLE LINE SIMULLATION IN LOGIXPRO
BOTTLE LINE SIMULLATION IN LOGIXPRO
 
Training report of PLC
Training report of PLCTraining report of PLC
Training report of PLC
 
PLC: Programación y Automatización de PLC Siemens S7-200
PLC: Programación y Automatización de PLC Siemens S7-200PLC: Programación y Automatización de PLC Siemens S7-200
PLC: Programación y Automatización de PLC Siemens S7-200
 
Industrial Networking - Profibus
Industrial Networking - ProfibusIndustrial Networking - Profibus
Industrial Networking - Profibus
 
Basic plc
Basic plcBasic plc
Basic plc
 
PLC: Controladores lógicos programables, folleto de apuntes y ejercicios
PLC: Controladores lógicos programables, folleto de apuntes y ejerciciosPLC: Controladores lógicos programables, folleto de apuntes y ejercicios
PLC: Controladores lógicos programables, folleto de apuntes y ejercicios
 
ORCAD pcb design
ORCAD pcb designORCAD pcb design
ORCAD pcb design
 
Programmable logic controllers
Programmable logic controllersProgrammable logic controllers
Programmable logic controllers
 
Presentaton on Plc & Scada
Presentaton on Plc & ScadaPresentaton on Plc & Scada
Presentaton on Plc & Scada
 
PLC and SCADA summer training report- government engineering college ajmer
PLC and SCADA summer training report- government engineering college ajmerPLC and SCADA summer training report- government engineering college ajmer
PLC and SCADA summer training report- government engineering college ajmer
 
Plc course presentation
Plc course presentationPlc course presentation
Plc course presentation
 
Industrial Automation
Industrial AutomationIndustrial Automation
Industrial Automation
 
Training Report on PLC & SCADA
Training Report on PLC & SCADATraining Report on PLC & SCADA
Training Report on PLC & SCADA
 
Plc presentation
Plc presentationPlc presentation
Plc presentation
 
Sensor
SensorSensor
Sensor
 
Esquemas abb
Esquemas abbEsquemas abb
Esquemas abb
 

Similar to OPC UA mit der SIMATIC S7-1200/1500 und Python

Self-commissioning Industrial IoT Systems
Self-commissioning Industrial IoT SystemsSelf-commissioning Industrial IoT Systems
Self-commissioning Industrial IoT SystemsHeiko Koziolek
 
Python programming course
Python programming coursePython programming course
Python programming coursetcpipguru
 
Create your own OPC UA information model
Create your own OPC UA information modelCreate your own OPC UA information model
Create your own OPC UA information modelStephane Potier
 
Integrating Ansible Tower with security orchestration and cloud management
Integrating Ansible Tower with security orchestration and cloud managementIntegrating Ansible Tower with security orchestration and cloud management
Integrating Ansible Tower with security orchestration and cloud managementJoel W. King
 
Cayenne mydevices presentation
Cayenne  mydevices presentation Cayenne  mydevices presentation
Cayenne mydevices presentation Telexine
 
practical-guide-to-opcua.pdf
practical-guide-to-opcua.pdfpractical-guide-to-opcua.pdf
practical-guide-to-opcua.pdfssuser357595
 
Licensing on Cisco 2960, 3560X and 3750X...
Licensing on Cisco 2960, 3560X and 3750X...Licensing on Cisco 2960, 3560X and 3750X...
Licensing on Cisco 2960, 3560X and 3750X...IT Tech
 
Certificate Based VPN Remote Access - 1. OpenCA Workshop 2004 / OpenXPKI
Certificate Based VPN Remote Access - 1. OpenCA Workshop 2004 / OpenXPKICertificate Based VPN Remote Access - 1. OpenCA Workshop 2004 / OpenXPKI
Certificate Based VPN Remote Access - 1. OpenCA Workshop 2004 / OpenXPKIIves Laaf
 
Securing MQTT - BuildingIoT 2016 slides
Securing MQTT - BuildingIoT 2016 slidesSecuring MQTT - BuildingIoT 2016 slides
Securing MQTT - BuildingIoT 2016 slidesDominik Obermaier
 
OPC UA Inside Out Part 4 - OPC Tunneller
OPC UA Inside Out Part 4 - OPC TunnellerOPC UA Inside Out Part 4 - OPC Tunneller
OPC UA Inside Out Part 4 - OPC TunnellerSadatulla Zishan
 
An Overview of OPC UA Security
An Overview of OPC UA SecurityAn Overview of OPC UA Security
An Overview of OPC UA SecuritySadatulla Zishan
 
The Fundamentals of Internet of Everything Connectivity
The Fundamentals of Internet of Everything ConnectivityThe Fundamentals of Internet of Everything Connectivity
The Fundamentals of Internet of Everything ConnectivityQualcomm Developer Network
 
Hyperledger Composer architecture
Hyperledger Composer architectureHyperledger Composer architecture
Hyperledger Composer architectureSimon Stone
 
presentation_4102_1493726768.pdf
presentation_4102_1493726768.pdfpresentation_4102_1493726768.pdf
presentation_4102_1493726768.pdfssuserf0e32f
 
ICS/SCADA/PLC Google/Shodanhq Cheat Sheet
ICS/SCADA/PLC Google/Shodanhq Cheat SheetICS/SCADA/PLC Google/Shodanhq Cheat Sheet
ICS/SCADA/PLC Google/Shodanhq Cheat Sheetqqlan
 
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...confluent
 

Similar to OPC UA mit der SIMATIC S7-1200/1500 und Python (20)

Self-commissioning Industrial IoT Systems
Self-commissioning Industrial IoT SystemsSelf-commissioning Industrial IoT Systems
Self-commissioning Industrial IoT Systems
 
Python programming course
Python programming coursePython programming course
Python programming course
 
Create your own OPC UA information model
Create your own OPC UA information modelCreate your own OPC UA information model
Create your own OPC UA information model
 
Integrating Ansible Tower with security orchestration and cloud management
Integrating Ansible Tower with security orchestration and cloud managementIntegrating Ansible Tower with security orchestration and cloud management
Integrating Ansible Tower with security orchestration and cloud management
 
RemoteAdmin.pptx
RemoteAdmin.pptxRemoteAdmin.pptx
RemoteAdmin.pptx
 
Cayenne mydevices presentation
Cayenne  mydevices presentation Cayenne  mydevices presentation
Cayenne mydevices presentation
 
practical-guide-to-opcua.pdf
practical-guide-to-opcua.pdfpractical-guide-to-opcua.pdf
practical-guide-to-opcua.pdf
 
Licensing on Cisco 2960, 3560X and 3750X...
Licensing on Cisco 2960, 3560X and 3750X...Licensing on Cisco 2960, 3560X and 3750X...
Licensing on Cisco 2960, 3560X and 3750X...
 
Certificate Based VPN Remote Access - 1. OpenCA Workshop 2004 / OpenXPKI
Certificate Based VPN Remote Access - 1. OpenCA Workshop 2004 / OpenXPKICertificate Based VPN Remote Access - 1. OpenCA Workshop 2004 / OpenXPKI
Certificate Based VPN Remote Access - 1. OpenCA Workshop 2004 / OpenXPKI
 
Securing MQTT - BuildingIoT 2016 slides
Securing MQTT - BuildingIoT 2016 slidesSecuring MQTT - BuildingIoT 2016 slides
Securing MQTT - BuildingIoT 2016 slides
 
OPC UA Inside Out Part 4 - OPC Tunneller
OPC UA Inside Out Part 4 - OPC TunnellerOPC UA Inside Out Part 4 - OPC Tunneller
OPC UA Inside Out Part 4 - OPC Tunneller
 
An Overview of OPC UA Security
An Overview of OPC UA SecurityAn Overview of OPC UA Security
An Overview of OPC UA Security
 
The Fundamentals of Internet of Everything Connectivity
The Fundamentals of Internet of Everything ConnectivityThe Fundamentals of Internet of Everything Connectivity
The Fundamentals of Internet of Everything Connectivity
 
Hyperledger Composer architecture
Hyperledger Composer architectureHyperledger Composer architecture
Hyperledger Composer architecture
 
presentation_4102_1493726768.pdf
presentation_4102_1493726768.pdfpresentation_4102_1493726768.pdf
presentation_4102_1493726768.pdf
 
Mahesh Gadade CV
Mahesh Gadade CVMahesh Gadade CV
Mahesh Gadade CV
 
ICS/SCADA/PLC Google/Shodanhq Cheat Sheet
ICS/SCADA/PLC Google/Shodanhq Cheat SheetICS/SCADA/PLC Google/Shodanhq Cheat Sheet
ICS/SCADA/PLC Google/Shodanhq Cheat Sheet
 
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
Industry 4.0: Building the Unified Namespace with Confluent, HiveMQ and Spark...
 
Resume
ResumeResume
Resume
 
Iot in-production
Iot in-productionIot in-production
Iot in-production
 

Recently uploaded

Dubai Call Girls O528786472 Call Girls In Dubai Wisteria
Dubai Call Girls O528786472 Call Girls In Dubai WisteriaDubai Call Girls O528786472 Call Girls In Dubai Wisteria
Dubai Call Girls O528786472 Call Girls In Dubai WisteriaUnited Arab Emirates
 
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...Pooja Nehwal
 
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...Suhani Kapoor
 
WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service - Bandra F...
WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service -  Bandra F...WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service -  Bandra F...
WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service - Bandra F...Pooja Nehwal
 
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一ga6c6bdl
 
Russian Call Girls Kolkata Chhaya 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Chhaya 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls Kolkata Chhaya 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Chhaya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Service
(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Service(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Service
(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...Pooja Nehwal
 
《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...
《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...
《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...ur8mqw8e
 
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样qaffana
 
FULL ENJOY - 8264348440 Call Girls in Hauz Khas | Delhi
FULL ENJOY - 8264348440 Call Girls in Hauz Khas | DelhiFULL ENJOY - 8264348440 Call Girls in Hauz Khas | Delhi
FULL ENJOY - 8264348440 Call Girls in Hauz Khas | Delhisoniya singh
 
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...Pooja Nehwal
 
Alambagh Call Girl 9548273370 , Call Girls Service Lucknow
Alambagh Call Girl 9548273370 , Call Girls Service LucknowAlambagh Call Girl 9548273370 , Call Girls Service Lucknow
Alambagh Call Girl 9548273370 , Call Girls Service Lucknowmakika9823
 
VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...
VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...
VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...Call Girls in Nagpur High Profile
 
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...Suhani Kapoor
 
如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查
如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查
如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查awo24iot
 
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...ranjana rawat
 
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Call Girls in Nagpur High Profile
 
Top Rated Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated  Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...Top Rated  Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...Call Girls in Nagpur High Profile
 
Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...
Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...
Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...nagunakhan
 

Recently uploaded (20)

Dubai Call Girls O528786472 Call Girls In Dubai Wisteria
Dubai Call Girls O528786472 Call Girls In Dubai WisteriaDubai Call Girls O528786472 Call Girls In Dubai Wisteria
Dubai Call Girls O528786472 Call Girls In Dubai Wisteria
 
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
Call Girls in Thane 9892124323, Vashi cAll girls Serivces Juhu Escorts, powai...
 
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
VIP Call Girls Hitech City ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With R...
 
WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service - Bandra F...
WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service -  Bandra F...WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service -  Bandra F...
WhatsApp 9892124323 ✓Call Girls In Khar ( Mumbai ) secure service - Bandra F...
 
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
如何办理(NUS毕业证书)新加坡国立大学毕业证成绩单留信学历认证原版一比一
 
Russian Call Girls Kolkata Chhaya 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Chhaya 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls Kolkata Chhaya 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls Kolkata Chhaya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Service
(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Service(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Service
(ZARA) Call Girls Jejuri ( 7001035870 ) HI-Fi Pune Escorts Service
 
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
9892124323, Call Girl in Juhu Call Girls Services (Rate ₹8.5K) 24×7 with Hote...
 
《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...
《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...
《伯明翰城市大学毕业证成绩单购买》学历证书学位证书区别《复刻原版1:1伯明翰城市大学毕业证书|修改BCU成绩单PDF版》Q微信741003700《BCU学...
 
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
哪里办理美国宾夕法尼亚州立大学毕业证(本硕)psu成绩单原版一模一样
 
FULL ENJOY - 8264348440 Call Girls in Hauz Khas | Delhi
FULL ENJOY - 8264348440 Call Girls in Hauz Khas | DelhiFULL ENJOY - 8264348440 Call Girls in Hauz Khas | Delhi
FULL ENJOY - 8264348440 Call Girls in Hauz Khas | Delhi
 
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
9892124323 Pooja Nehwal Call Girls Services Call Girls service in Santacruz A...
 
Alambagh Call Girl 9548273370 , Call Girls Service Lucknow
Alambagh Call Girl 9548273370 , Call Girls Service LucknowAlambagh Call Girl 9548273370 , Call Girls Service Lucknow
Alambagh Call Girl 9548273370 , Call Girls Service Lucknow
 
VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...
VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...
VVIP Pune Call Girls Balaji Nagar (7001035870) Pune Escorts Nearby with Compl...
 
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
VIP Call Girls Kavuri Hills ( Hyderabad ) Phone 8250192130 | ₹5k To 25k With ...
 
如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查
如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查
如何办理(Adelaide毕业证)阿德莱德大学毕业证成绩单Adelaide学历认证真实可查
 
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
Book Paid Lohegaon Call Girls Pune 8250192130Low Budget Full Independent High...
 
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Katraj ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
Top Rated Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated  Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...Top Rated  Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
Top Rated Pune Call Girls Shirwal ⟟ 6297143586 ⟟ Call Me For Genuine Sex Ser...
 
Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...
Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...
Russian Escorts in lucknow 💗 9719455033 💥 Lovely Lasses: Radiant Beauties Shi...
 

OPC UA mit der SIMATIC S7-1200/1500 und Python

  • 1. Accessing data on a Simatic S7-1200/1500 using Python Accessing data securely by configuring the integrated OPC UA Server www.spektrum-engineering.de Spektrum Engineering 1
  • 2. 1. Enabling and setting up OPC UA in TIA Project a) Setting up security mechanisms based on X.509 certificates to enable authentication and encryption in TIA Portal b) Setting up general PLC security mechanisms 2. Installing python-opcua and opcua-client using pip (on Windows) a) Install clients and test installation b) Create client certificate in TIA Portal for Python client 3. Accessing data on the SIMATIC S7-1200/S7-1500 www.spektrum-engineering.de Spektrum Engineering 2 TOC
  • 3. www.spektrum-engineering.de Spektrum Engineering 3 PLC Configuration in TIA Portal
  • 4. www.spektrum-engineering.de Spektrum Engineering 4 Network Topology OPC UA Client (Python): IP Adresse: xxx.xxx.xxx.xxx OPC UA Server: IP Adresse: xxx.xxx.xxx.xxx TCP/IP Ethernet
  • 5. www.spektrum-engineering.de Spektrum Engineering 5 Enable OPC UA Server in TIA Project Purchase OPC UA License from Siemens Industry Mall and activate it in your TIA project
  • 6. www.spektrum-engineering.de Spektrum Engineering 6 Enable OPC UA Server in TIA Project Activate OPC UA Server for selected PLC in Device Configuration. Make sure to follow security setup instructions on the following slides to avoid unrestricted OPC UA access!
  • 7. www.spektrum-engineering.de Spektrum Engineering 7 Enable OPC UA Server in TIA Project …user management via project security settings is available only in case the entire project is protected! → protect your TIA project
  • 8. www.spektrum-engineering.de Spektrum Engineering 8 Setting up OPC UA security mechanisms Protect entire project to enable advanced security mechanisms such as: - project-wide user administration - project-wide certificate manager Defining project-wide security settings has the advantage, that you can administer security settings globally for multiple PLCs in your project. In addition, when accessing your PLCs remotely using OPC UA, it is more comfortable/securer to maintain your certificates and users project-wide for all PLCs instead of individually for every single PLC.
  • 9. www.spektrum-engineering.de Spektrum Engineering 9 Setting up OPC UA security mechanisms Mutual Authentication OPC UA Client (Python): IP Adresse: xxx.xxx.xxx.xxx OPC UA Server: IP Adresse: xxx.xxx.xxx.xxx TCP/IP Ethernet
  • 10. TCP/IP Ethernet Client presents its certificate to server Server needs to „know“ the client‘s certificate and has to have it marked as „trusted“ to accept the connection request. Server presents its certificate to the server. Client needs to „know“ the server‘s certificate and has to have it marked as „trusted“ to accept the connection request.
  • 11. www.spektrum-engineering.de Spektrum Engineering 12 Setting up OPC UA security mechanisms Enable project wide certificate manager for selected PLC → All PLC-specific certificates will be lost! (may cause trouble with OPC UA clients if your PLCs are currently used in existing environments)
  • 12. www.spektrum-engineering.de Spektrum Engineering 13 Setting up OPC UA security mechanisms Server Certificate In the PLC specific certificate manager create a new certificate for the OPC Server! (This creates a key pair) For the Certificate Authority (CA) select one of the suggested above (alternatively import your CA in the global certificate manager, which is not part of this slide deck)
  • 13. www.spektrum-engineering.de Spektrum Engineering 14 Setting up OPC UA security mechanisms Server Certificate Device specific certificate manager, showing recently created certificate → Same certificate will be shown in project wide certificate manager
  • 14. www.spektrum-engineering.de Spektrum Engineering 15 Setting up OPC UA security mechanisms Server Certificate Global certificate manager showing recently generated certificate
  • 15. www.spektrum-engineering.de Spektrum Engineering 16 Add created certificate to OPC UA server settings Setting up OPC UA security mechanisms Server Certificate
  • 16. www.spektrum-engineering.de Spektrum Engineering 17 Configure supported authentication and encryption schemes the PLC should support! Disable “No security” to enforce cryptographic client authentication and encrypted communication! Setting up OPC UA security mechanisms Server Certificate
  • 17. www.spektrum-engineering.de Spektrum Engineering 18 Setting up OPC UA security mechanisms Disable “Enable guest authentication” to avoid anonymous access by anyone without username and password! Enable “Enable username and password authentication”, define a username and password which will be granted access to the OPC UA Server
  • 18. www.spektrum-engineering.de Spektrum Engineering 19 Setting up general PLC security mechanisms Using OPC UA server means connecting the PLC to a network at the same time. Therefore, disable unprotected access to the PLC in any case by disabling anonymous access without username and password. Especially for Online Access, Programming Access and for HMI Access, as well!
  • 19. www.spektrum-engineering.de Spektrum Engineering 20 Setting up general PLC security mechanisms Set a password for your PLC display when “Enable write access” is activated (S7- 1500)!
  • 20. www.spektrum-engineering.de Spektrum Engineering 21 Installing OPC UA Python client
  • 21. www.spektrum-engineering.de Spektrum Engineering 22 Installing OPC UA Python library into a virtualenv Create a python virtualenv and install opcua, opcua-client and PyQt5 into using pip: • pip install opcua opcua-client PyQt5 opcua – client library – https://github.com/FreeOpcUa/python-opcua opcua-client – demo application – https://github.com/FreeOpcUa/opcua-client-gui PyQt5 – GUI framework required by opcua-client – https://pypi.org/project/PyQt5/
  • 22. www.spektrum-engineering.de Spektrum Engineering 23 Installing OPC UA Python library into a virtualenv Install optional libraries to support cryptographic schemes which we have set up in TIA project: pip install crypto cryptography
  • 23. www.spektrum-engineering.de Spektrum Engineering 24 Installing OPC UA Python library into a virtualenv Install optional libraries to get full benefit using the opcua-client application pip install pyqtgraph numpy
  • 24. www.spektrum-engineering.de Spektrum Engineering 25 Installing OPC UA Python library into a virtualenv Test your installation by starting the demo application from within your virtualenv: opcua-client
  • 25. www.spektrum-engineering.de Spektrum Engineering 26 Create client certificate for Python in TIA Portal Create second certificate for client (this creates a key pair) Use same CA for server and client certificate! In the field Subject Alternative Name, set the string as seen on the left. This is required by the OPC UA Python client library which we will use later in the project!
  • 26. www.spektrum-engineering.de Spektrum Engineering 27 Create client certificate for Python in TIA Portal In the global certificate manager, the newly created client certificate is shown. Export the certificate (in der format – seen on this slide) and the belonging private key (in pem format – seen on next slide). Export by secondary-click on the certificate. This key-pair will be used to authenticate the client to the server.
  • 27. www.spektrum-engineering.de Spektrum Engineering 28 Create client certificate for Python in TIA Portal Now export the private key and include the certificate chain. We will be using this certificate in our client application – which might run unattended – therefore we will not protect the private key with a password!
  • 28. www.spektrum-engineering.de Spektrum Engineering 29 Limit access to clients on PLC The PLC permits access to clients which provide the recently created client certificate. Add this certificate to the PLC “Trusted clients” and disable “Automatically accept client certificates during runtime” to prevent clients from connecting which do not present a proper certificate to the PLC. Download the project to the PLC and set it to Run Mode.
  • 29. www.spektrum-engineering.de Spektrum Engineering 30 Connect to PLC using Python Client Library Start the OPC UA Python client as described before. In the address field type the URL in the following format: opc.tcp://<username>:<password>@<ip-address>:<port> For example: opc.tcp://OPCUser01:11223344Ki@192.168.1.232:4840 Click on “Connect options” and then on “Query server capability” to get recommended connection properties. Set your client certificate and client private key!
  • 30. www.spektrum-engineering.de Spektrum Engineering 31 Connect to PLC using Python Client Library Close the “Connection Dialog” and click on “Connect”. You’ll be presented with the OPC UA XML tree served by your SIMATIC PLC! You can read/write only these variables/tags you have granted access to in TIA portal!
  • 31. www.spektrum-engineering.de Spektrum Engineering 32 Browse data blocks on PLC You can access only the variables/tags you have allowed access to in TIA portal!
  • 32. www.spektrum-engineering.de Spektrum Engineering 33 Spektrum Ingenieurgesellschaft mbH Web: https://siincos-remote-connect.de Mail: siincos@spektrum-engineering.de linkedin.com/company/siincos/ instagram.com/spektrum.engineering/