{"id":416905,"date":"2024-06-30T01:14:24","date_gmt":"2024-06-30T01:14:24","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=416905"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=416905","title":{"rendered":"<span>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 AWS SSO \u0441 AWS Client VPN<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u044d\u0442\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043c\u0443\u043b\u044c\u0442\u0438\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043d\u0430 AWS, \u0432\u043a\u043b\u044e\u0447\u0430\u044f <abbr title=\"Single sign-on\">SSO<\/abbr> \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f VPN \u043e\u0442 Amazon.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/getpro\/habr\/upload_files\/345\/524\/149\/345524149a59de96cef47ed6626046f4.jpeg\" alt=\"\" title=\"\" width=\"1400\" height=\"788\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/345\/524\/149\/345524149a59de96cef47ed6626046f4.jpeg\" data-blurred=\"true\"\/><figcaption><\/figcaption><\/figure>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u042f \u0440\u0430\u0437\u0431\u0438\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439:<\/p>\n<ul>\n<li>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0432 AWS \u0441 \u043d\u0443\u043b\u044f, \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432, \u0441\u0435\u0442\u0435\u0439, \u043f\u0438\u0440\u0438\u043d\u0433\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 AWS SSO: \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c, \u0433\u0440\u0443\u043f\u043f\u0430\u043c, <abbr title=\"Multifactor authentication\">MFA<\/abbr>, \u0438 \u0442.\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0440\u0435\u0442\u044c\u044f \u0447\u0430\u0441\u0442\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 AWS VPN \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e terraform \u0438 \u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c!<\/p>\n<h2>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 AWS-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432<\/h2>\n<p>\u041c\u0443\u043b\u044c\u0442\u0438\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f AWS \u0438\u043c\u0435\u0435\u0442 <a href=\"https:\/\/docs.aws.amazon.com\/whitepapers\/latest\/organizing-your-aws-environment\/benefits-of-using-multiple-aws-accounts.html\" rel=\"noopener noreferrer nofollow\">\u0440\u044f\u0434 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432<\/a>. \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043d\u0430 \u043d\u0438\u0445 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043a\u0430\u0436\u0443 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b14\/19d\/d26\/b1419dd26e0cfff3668c50b921ee6968.png\" alt=\"\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432\" title=\"\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432\" width=\"862\" height=\"314\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/b14\/19d\/d26\/b1419dd26e0cfff3668c50b921ee6968.png\"\/><figcaption>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432<\/figcaption><\/figure>\n<p>\u0410\u043a\u043a\u0430\u0443\u043d\u0442 <code>root<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0433\u043b\u0430\u0432\u043d\u044b\u043c \u0432 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 (\u043d\u0430 \u043d\u0435\u0433\u043e \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u0438\u043b\u043b\u0438\u043d\u0433), \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0434 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u044d\u0442\u043e\u0433\u043e \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430.<\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a \u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043f\u043e\u0447\u0442\u043e\u0432\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443, \u043d\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0435 \u0430\u043b\u0438\u0430\u0441\u044b \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0447\u0442\u043e\u0432\u043e\u0433\u043e \u044f\u0449\u0438\u043a\u0430.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>root<\/code> \u0438 <a href=\"https:\/\/console.aws.amazon.com\/organizations\/v2\/home\/accounts\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0435 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b<\/a> \u0432 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044e. \u041b\u043e\u0433\u0438\u043d\u0438\u043c\u0441\u044f \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c MFA \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u043d\u0430\u0448\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432 \u0432\u0435\u0440\u043d\u0430 \u0438 \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fac\/0c2\/95c\/fac0c295c8bf05119caa478a4b61646d.png\" alt=\"https:\/\/console.aws.amazon.com\/organizations\/v2\/home\/accounts\" title=\"https:\/\/console.aws.amazon.com\/organizations\/v2\/home\/accounts\" width=\"1400\" height=\"855\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fac\/0c2\/95c\/fac0c295c8bf05119caa478a4b61646d.png\"\/><figcaption>https:\/\/console.aws.amazon.com\/organizations\/v2\/home\/accounts<\/figcaption><\/figure>\n<p>\u042d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u043c\u043e\u0436\u0435\u043c \u0438\u0434\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h2>\u0421\u0435\u0442\u0435\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430<\/h2>\n<p>\u0412 \u043c\u043e\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b <code>dev<\/code>, <code>stage<\/code> \u0438 <code>prod<\/code> \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430.<\/p>\n<p>\u0410\u043a\u043a\u0430\u0443\u043d\u0442 <code>common<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u0449\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0430 CI\/CD, \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (S3-\u0431\u0430\u043a\u0435\u0442\u044b), \u0438 \u0442.\u0434. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 <code>common<\/code> \u0438 <code>dev<\/code>\/<code>stage<\/code>\/<code>prod<\/code> \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430\u043c, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c VPC-\u043f\u0438\u0440\u0438\u043d\u0433 (\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0435\u0442\u044f\u043c\u0438).<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e terraform \u0434\u043b\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432 <code>common<\/code> \u0438 <code>dev<\/code>.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c VPC:<\/p>\n<pre><code>data \"aws_availability_zones\" \"available\" {}  module \"vpc\" {   source  = \"terraform-aws-modules\/vpc\/aws\"   version = \"3.7.0\"    name = \"${var.env}-vpc\"   cidr = var.vpc_cidr   azs  = data.aws_availability_zones.available.names    private_subnets = var.vpc_private_subnets   public_subnets  = var.vpc_public_subnets    enable_nat_gateway   = true   single_nat_gateway   = true   enable_dns_hostnames = true }<\/code><\/pre>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u0444\u0430\u0439\u043b \u0441 \u0432\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 <code>terraform.tfvars<\/code>:<\/p>\n<pre><code>region = \"eu-central-1\" env    = \"common\"  # https:\/\/www.davidc.net\/sites\/default\/subnets\/subnets.html # \u043a\u0430\u0436\u0434\u0430\u044f \u043f\u043e\u0434\u0441\u0435\u0442\u044c ~8190 \u0445\u043e\u0441\u0442\u043e\u0432 # 10.0.192.0\/19 \u0437\u0430\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043f\u043e\u0434 VPN-\u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 vpc_cidr            = \"10.0.0.0\/16\" vpc_private_subnets = [\"10.0.0.0\/19\", \"10.0.32.0\/19\", \"10.0.64.0\/19\"] vpc_public_subnets  = [\"10.0.96.0\/19\", \"10.0.128.0\/19\", \"10.0.160.0\/19\"]<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0434\u043b\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 <code>dev<\/code>, \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 \u0438 \u0432\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0444\u0430\u0439\u043b \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0435\u0442\u0435\u0439 \u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u0435\u0439, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u043d\u0430 <code>10.1.0.0\/16<\/code> \u0438 \u0442.\u0434. <strong>\u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0438\u0445 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435 \u043f\u0438\u0440\u0438\u043d\u0433\u0430.<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0442\u0438:<\/p>\n<ul>\n<li>\n<p><code>common-vpc<\/code> \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 <code>common<\/code> \u0441 CIDR: <code>10.0.0.0\/16<\/code>, \u0442\u0440\u0435\u043c\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0438 \u0442\u0440\u0435\u043c\u044f \u0447\u0430\u0441\u0442\u043d\u044b\u043c\u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u044f\u043c\u0438<\/p>\n<\/li>\n<li>\n<p><code>dev-vpc<\/code> \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 <code>dev<\/code> \u0441 CIDR: <code>10.1.0.0\/16<\/code>, \u0442\u0440\u0435\u043c\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0438 \u0442\u0440\u0435\u043c\u044f \u0447\u0430\u0441\u0442\u043d\u044b\u043c\u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u044f\u043c\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u043c \u0438\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0438\u0440\u0438\u043d\u0433\u0430:<\/p>\n<pre><code>module \"common_dev_peering\" {   source  = \"grem11n\/vpc-peering\/aws\"   version = \"4.0.1\"    providers = {     aws.this = aws     aws.peer = aws.dev   }    this_vpc_id = module.vpc.vpc_id   peer_vpc_id = var.vpc_dev_accepter_id    auto_accept_peering = true }<\/code><\/pre>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u044c <code>vpc_dev_accepter_id<\/code>\u00a0\u0432 \u0444\u0430\u0439\u043b\u0435\u00a0<code>terraform.tfvars<\/code>:<\/p>\n<pre><code>... vpc_dev_accepter_id = \"vpc-12345678\"<\/code><\/pre>\n<p>\u0422\u0443 \u0436\u0435 \u0441\u0430\u043c\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0434\u043b\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432 <code>stage<\/code> \u0438 <code>prod<\/code>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/fe0\/e73\/5b6\/fe0e735b687b6b37e0fbbd06c95ff302.png\" alt=\"\u0421\u0445\u0435\u043c\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439\" title=\"\u0421\u0445\u0435\u043c\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439\" width=\"651\" height=\"312\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/fe0\/e73\/5b6\/fe0e735b687b6b37e0fbbd06c95ff302.png\"\/><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439<\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u0435\u0442\u044f\u0445 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u043a\u0443 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0442\u0438\u043f\u0430 <code>ping<\/code> \u0438\u043b\u0438 <code>traceroute<\/code>.<\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c SSO<\/h2>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 AWS \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 <code>root<\/code>, \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441 <a href=\"https:\/\/eu-central-1.console.aws.amazon.com\/singlesignon\/home?region=eu-central-1#\/groups\" rel=\"noopener noreferrer nofollow\">AWS SSO<\/a> \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0440\u0438 \u0433\u0440\u0443\u043f\u043f\u044b:<\/p>\n<ul>\n<li>\n<p><code>vpn-dev<\/code><\/p>\n<\/li>\n<li>\n<p><code>vpn-stage<\/code><\/p>\n<\/li>\n<li>\n<p><code>vpn-prod<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0434\u0435\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u0441\u0435\u0442\u044f\u043c \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f (<abbr title=\"Role-based access control\">RBAC<\/abbr>) \u0441 VPN.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/143\/1b2\/04e\/1431b204ef6d9be21225674d003c4b88.png\" alt=\"\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u0433\u0440\u0443\u043f\u043f\u044b\" title=\"\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u0433\u0440\u0443\u043f\u043f\u044b\" width=\"1280\" height=\"780\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/143\/1b2\/04e\/1431b204ef6d9be21225674d003c4b88.png\"\/><figcaption>\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u0433\u0440\u0443\u043f\u043f\u044b<\/figcaption><\/figure>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u0443\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 <code>amet-umerov<\/code>, \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0432\u043e \u0432\u0441\u0435 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0434\u043e\u0441\u0442\u0443\u043f \u0432\u043e \u0432\u0441\u0435 \u0441\u0435\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e VPN.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e8e\/4f8\/edd\/e8e4f8edd93be001c8f60cc6b0eabc4d.png\" alt=\"\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c MFA \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\" title=\"\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c MFA \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\" width=\"1400\" height=\"419\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e8e\/4f8\/edd\/e8e4f8edd93be001c8f60cc6b0eabc4d.png\"\/><figcaption>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c MFA \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/figcaption><\/figure>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u044b \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c <a href=\"https:\/\/eu-central-1.console.aws.amazon.com\/singlesignon\/home?region=eu-central-1#\/applications\" rel=\"noopener noreferrer nofollow\">\u043d\u043e\u0432\u043e\u0435 SSO-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/a> \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c VPN:<\/p>\n<ul>\n<li>\n<p>Add a custom SAML 2.0 application<\/p>\n<\/li>\n<li>\n<p><strong>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u00a0<\/strong><code>AWS SSO SAML metadata file<\/code><strong>, \u043e\u043d \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0437\u0436\u0435<\/strong><\/p>\n<\/li>\n<li>\n<p>Set session duration:\u00a0<code>12 hours<\/code><\/p>\n<\/li>\n<li>\n<p>Application ACS URL:\u00a0<code>http:\/\/127.0.0.1:35001<\/code><\/p>\n<\/li>\n<li>\n<p>Application SAML audience:\u00a0<code>urn:amazon:webservices:clientvpn<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u043d\u043e SSO-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c VPN Self-Service \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438, \u043a\u0440\u043e\u043c\u0435:<\/p>\n<ul>\n<li>\n<p>Application ACS URL:\u00a0<code>https:\/\/self-service.clientvpn.amazonaws.com\/api\/auth\/sso\/saml<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0430\u043f\u043f\u0438\u043d\u0433 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\n<p><code>Subject<\/code>\u00a0\u2014\u00a0<code>user:subject<\/code>\u00a0\u2014\u00a0<code>emailAddress<\/code><\/p>\n<\/li>\n<li>\n<p><code>NameID<\/code>\u00a0\u2014\u00a0<code>${user:email}<\/code>\u00a0\u2014\u00a0<code>unspecified<\/code><\/p>\n<\/li>\n<li>\n<p><code>FirstName<\/code>\u00a0\u2014\u00a0<code>${user:name}<\/code>\u00a0\u2014\u00a0<code>unspecified<\/code><\/p>\n<\/li>\n<li>\n<p><code>LastName<\/code>\u00a0\u2014\u00a0<code>${user:familyName}<\/code>\u00a0\u2014\u00a0<code>unspecified<\/code><\/p>\n<\/li>\n<li>\n<p><code>memberOf<\/code>\u00a0\u2014\u00a0<code>${user:groups}<\/code>\u00a0\u2014\u00a0<code>unspecified<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u043f\u0440\u0438\u0432\u044f\u0436\u0435\u043c \u043a \u043d\u0438\u043c \u0432\u0441\u0435 \u0442\u0440\u0438 \u0433\u0440\u0443\u043f\u043f\u044b (<code>vpn-dev<\/code>,\u00a0<code>vpn-stage<\/code>,\u00a0<code>vpn-prod<\/code>).<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/915\/40a\/bdd\/91540abdd0a2b2a020d695e24610bb12.png\" alt=\"\u0421\u043f\u0438\u0441\u043e\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439\" title=\"\u0421\u043f\u0438\u0441\u043e\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439\" width=\"1400\" height=\"382\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/915\/40a\/bdd\/91540abdd0a2b2a020d695e24610bb12.png\"\/><figcaption>\u0421\u043f\u0438\u0441\u043e\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/figcaption><\/figure>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u043e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/973\/d54\/a30\/973d54a3047513cf8e6e0c46bc67b3c2.png\" alt=\"\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0435\u0442\u044f\u043c\" title=\"\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0435\u0442\u044f\u043c\" width=\"788\" height=\"524\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/973\/d54\/a30\/973d54a3047513cf8e6e0c46bc67b3c2.png\"\/><figcaption>\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0435\u0442\u044f\u043c<\/figcaption><\/figure>\n<h2>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c VPN<\/h2>\n<p>\u041d\u0430\u0448\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <a href=\"https:\/\/eu-central-1.console.aws.amazon.com\/vpc\/home?region=eu-central-1#ClientVPNEndpoints:sort=clientVpnEndpointId\" rel=\"noopener noreferrer nofollow\">\u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0434\u043b\u044f VPN<\/a> \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 <code>common<\/code>. \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0438 \u043a\u043b\u044e\u0447\u0438.<\/p>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430:<\/p>\n<pre><code>$ git clone https:\/\/github.com\/OpenVPN\/easy-rsa.git $ cd easy-rsa\/easyrsa3  $ .\/easyrsa init-pki $ .\/easyrsa build-ca nopass ... Common Name (eg: your user, host, or server name) [Easy-RSA CA]:vpn.domain.org  $ .\/easyrsa build-server-full vpn-aws-server nopass $ .\/easyrsa build-client-full vpn-aws-client nopass<\/code><\/pre>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 <a href=\"https:\/\/eu-central-1.console.aws.amazon.com\/acm\/home?region=eu-central-1#\/\" rel=\"noopener noreferrer nofollow\">AWS ACM<\/a>:<\/p>\n<pre><code>$ mkdir ~\/.vpn-assets\/ $ cp pki\/ca.crt ~\/.vpn-assets\/ $ cp pki\/private\/ca.key ~\/.vpn-assets\/ $ cp pki\/issued\/vpn-aws-*.crt ~\/.vpn-assets\/ $ cp pki\/private\/vpn-aws-*.key ~\/.vpn-assets\/  $ aws --profile common \\     --region eu-central-1 \\     acm import-certificate \\     --certificate fileb:\/\/$HOME\/.vpn-assets\/vpn-aws-server.crt \\     --private-key fileb:\/\/$HOME\/.vpn-assets\/vpn-aws-server.key \\     --certificate-chain fileb:\/\/$HOME\/.vpn-assets\/ca.crt  # \u041d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e \u0432\u0441\u0435 \u0432 S3-\u0431\u0430\u043a\u0435\u0442 $ aws --profile=common s3 cp --recursive ~\/.vpn-assets\/ s3:\/\/my-bucket\/vpn\/<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0435 VPN-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e terraform:<\/p>\n<pre><code># SAML \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b \u0438\u0437 \u043c\u0435\u0442\u0430\u0434\u0430\u0442\u0430-\u0444\u0430\u0439\u043b\u043e\u0432, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u043d\u0430\u043c\u0438 \u0440\u0430\u043d\u0435\u0435 resource \"aws_iam_saml_provider\" \"vpn\" {   name                   = \"vpn\"   saml_metadata_document = file(\"${path.module}\/files\/VPN_ins-mymetadata-file.xml\") }  resource \"aws_iam_saml_provider\" \"vpn_self_service\" {   name                   = \"vpn-self-service\"   saml_metadata_document = file(\"${path.module}\/files\/VPN Self-Service_ins-mymetadata-file.xml\") }  # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0438 subnet_id data \"aws_acm_certificate\" \"vpn_aws_server_cert\" {   domain   = \"vpn-aws-server\"   statuses = [\"ISSUED\"] }  data \"aws_subnet\" \"vpn_subnet_id\" {   filter {     name   = \"tag:Name\"     values = [\"${var.env}-vpc-private\"]   }   availability_zone_id = \"euc1-az1\" }  # \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 CloudWatch \u0434\u043b\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f VPN resource \"aws_cloudwatch_log_group\" \"client_vpn\" {   name = \"vpn_endpoint_cloudwatch_log_group\" }  resource \"aws_cloudwatch_log_stream\" \"client_vpn\" {   name           = \"vpn_endpoint_cloudwatch_log_stream\"   log_group_name = aws_cloudwatch_log_group.client_vpn.name }  # \u0422\u043e\u0447\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 VPN resource \"aws_ec2_client_vpn_endpoint\" \"vpn\" {   description            = \"VPN client for AWS\"   server_certificate_arn = data.aws_acm_certificate.vpn_aws_server_cert.arn    client_cidr_block = var.vpn_client_cidr_block   dns_servers       = var.vpn_dns_servers    split_tunnel        = \"true\"   self_service_portal = \"enabled\"   transport_protocol  = \"udp\"    authentication_options {     type                           = \"federated-authentication\"     saml_provider_arn              = aws_iam_saml_provider.vpn.arn     self_service_saml_provider_arn = aws_iam_saml_provider.vpn_self_service.arn   }    connection_log_options {     enabled               = true     cloudwatch_log_group  = aws_cloudwatch_log_group.client_vpn.name     cloudwatch_log_stream = aws_cloudwatch_log_stream.client_vpn.name   } }  # \u0424\u0430\u0435\u0440\u0432\u043e\u043b\u044b \u0434\u043b\u044f VPN resource \"aws_security_group\" \"vpn_main\" {   name        = \"vpn_main\"   description = \"Allow VPN all traffic\"   vpc_id      = module.vpc.vpc_id    egress {     description = \"Allow all traffic for VPN\"     cidr_blocks = [\"0.0.0.0\/0\"]     from_port   = \"0\"     protocol    = \"-1\"     self        = \"false\"     to_port     = \"0\"   }    ingress {     description = \"Allow all traffic for VPN\"     cidr_blocks = [\"0.0.0.0\/0\"]     from_port   = \"0\"     protocol    = \"-1\"     self        = \"false\"     to_port     = \"0\"   } }  # \u0410\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u0443\u0435\u043c VPN-\u0442\u043e\u0447\u043a\u0443 \u0441 \u043f\u043e\u0434\u0441\u0435\u0442\u044c\u044e resource \"aws_ec2_client_vpn_network_association\" \"vpn\" {   client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.vpn.id   subnet_id              = data.aws_subnet.vpn_subnet_id.id   security_groups        = [aws_security_group.vpn_main.id] }  # \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b (access_group_id) \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u0443\u0442 (\u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 root): # https:\/\/eu-central-1.console.aws.amazon.com\/singlesignon\/home?region=eu-central-1#\/groups resource \"aws_ec2_client_vpn_authorization_rule\" \"vpn_dev\" {   client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.vpn.id   target_network_cidr    = \"10.10.0.0\/16\"   access_group_id        = \"1234-5678-...\"   description            = \"vpn-dev\" }  # \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u0432 \u0441\u0435\u0442\u044c common \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u044b vpn-dev resource \"aws_ec2_client_vpn_authorization_rule\" \"vpn_common\" {   client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.vpn.id   target_network_cidr    = \"10.0.0.0\/16\"   access_group_id        = \"1234-5678-...\"   description            = \"vpn-common\" }  # \u041c\u0430\u0440\u0448\u0440\u0443\u0442\u044b resource \"aws_ec2_client_vpn_route\" \"vpn_to_dev\" {   client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.vpn.id   destination_cidr_block = \"10.10.0.0\/16\"   target_vpc_subnet_id   = aws_ec2_client_vpn_network_association.vpn.subnet_id }<\/code><\/pre>\n<p>\u0418 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b\u00a0<code>terraform.tfvars<\/code>:<\/p>\n<pre><code>... vpn_client_cidr_block = \"10.0.192.0\/19\" vpn_dns_servers       = [\"1.1.1.1\", \"8.8.8.8\"]<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u0443\u044e \u0442\u043e\u0447\u043a\u0443 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a VPN \u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0440\u043e\u043b\u0435\u0439 (\u0433\u0440\u0443\u043f\u043f).<\/p>\n<p>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u043c.<\/p>\n<ul>\n<li>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u043f\u043e\u0440\u0442\u0430\u043b \u0441\u0430\u043c\u043e\u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u0441\u044b\u043b\u043a\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:\u00a0<code>https:\/\/self-service.clientvpn.amazonaws.com\/endpoints\/cvpn-endpoint-1234567890<\/code><\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c VPN-\u043a\u043b\u0438\u0435\u043d\u0442 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0439 \u041e\u0421, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e (\u0444\u0430\u0439\u043b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 <code>.ovpn<\/code>)<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7d1\/b3a\/c92\/7d1b3ac922a09bf6cc0a4e1d24498185.png\" alt=\"\u041f\u043e\u0440\u0442\u0430\u043b \u0441\u0430\u043c\u043e\u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f\" title=\"\u041f\u043e\u0440\u0442\u0430\u043b \u0441\u0430\u043c\u043e\u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f\" width=\"1400\" height=\"903\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/7d1\/b3a\/c92\/7d1b3ac922a09bf6cc0a4e1d24498185.png\"\/><figcaption>\u041f\u043e\u0440\u0442\u0430\u043b \u0441\u0430\u043c\u043e\u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u044f<\/figcaption><\/figure>\n<ul>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c VPN-\u043a\u043b\u0438\u0435\u043d\u0442, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0444\u0438\u043b\u044c \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e VPN<\/p>\n<\/li>\n<li>\n<p>\u0423\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u044b \u043a VPN<\/p>\n<\/li>\n<li>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>traceroute<\/code>\/<code>ping<\/code> \u0438 \u0432\u0441\u0435 \u0442\u0435\u0445 \u0436\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0432\u0441\u0435\u0445 \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0445 \u0440\u0430\u043d\u0435\u0435 \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u044f\u0446\u0438\u0439 \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0441\u0435\u0442\u044f\u043c \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432 <code>common<\/code> \u0438 <code>dev<\/code> \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e VPN .<\/p>\n<p>\u0414\u0430\u043d\u043d\u0430\u044f \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0434\u043b\u044f \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432 \u0441 \u0438\u043d\u044b\u043c\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u0430\u043c\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0438 \u043c\u0430\u0440\u0448\u0440\u0443\u0442\u0430\u043c\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c terraform-\u043a\u043e\u0434\u0435.<\/p>\n<h2>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438<\/h2>\n<ul>\n<li>\n<p><a href=\"https:\/\/docs.aws.amazon.com\/vpn\/latest\/clientvpn-admin\/client-authentication.html\" rel=\"noopener noreferrer nofollow\"><u>https:\/\/docs.aws.amazon.com\/vpn\/latest\/clientvpn-admin\/client-authentication.html<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/smartshift.com\/guide-setting-up-an-aws-vpc-client-vpn\/\" rel=\"noopener noreferrer nofollow\"><u>https:\/\/smartshift.com\/guide-setting-up-an-aws-vpc-client-vpn\/<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/aws.amazon.com\/blogs\/security\/authenticate-aws-client-vpn-users-with-aws-single-sign-on\/\" rel=\"noopener noreferrer nofollow\"><u>https:\/\/aws.amazon.com\/blogs\/security\/authenticate-aws-client-vpn-users-with-aws-single-sign-on\/<\/u><\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/medium.com\/trackit\/how-to-create-an-aws-client-vpn-endpoint-using-aws-sso-and-terraform-6902dff5b71b\" rel=\"noopener noreferrer nofollow\"><u>https:\/\/medium.com\/trackit\/how-to-create-an-aws-client-vpn-endpoint-using-aws-sso-and-terraform-6902dff5b71b<\/u><\/a><\/p>\n<\/li>\n<\/ul>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/585648\/\"> https:\/\/habr.com\/ru\/articles\/585648\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u044d\u0442\u043e\u043c \u0442\u0443\u0442\u043e\u0440\u0438\u0430\u043b\u0435 \u044f \u043e\u043f\u0438\u0448\u0443 \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u0443\u044e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 \u043c\u0443\u043b\u044c\u0442\u0438\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043d\u0430 AWS, \u0432\u043a\u043b\u044e\u0447\u0430\u044f <abbr title=\"Single sign-on\">SSO<\/abbr> \u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u043b\u044f VPN \u043e\u0442 Amazon.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h2>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>\u042f \u0440\u0430\u0437\u0431\u0438\u043b \u0441\u0442\u0430\u0442\u044c\u044e \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439:<\/p>\n<ul>\n<li>\n<p>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u044f \u043f\u043e\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0432 AWS \u0441 \u043d\u0443\u043b\u044f, \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432, \u0441\u0435\u0442\u0435\u0439, \u043f\u0438\u0440\u0438\u043d\u0433\u043e\u0432<\/p>\n<\/li>\n<li>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 AWS SSO: \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f\u043c, \u0433\u0440\u0443\u043f\u043f\u0430\u043c, <abbr title=\"Multifactor authentication\">MFA<\/abbr>, \u0438 \u0442.\u0434.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0440\u0435\u0442\u044c\u044f \u0447\u0430\u0441\u0442\u044c \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u0430 AWS VPN \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e terraform \u0438 \u0435\u0433\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0434\u043b\u044f \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c!<\/p>\n<h2>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 AWS-\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432<\/h2>\n<p>\u041c\u0443\u043b\u044c\u0442\u0438\u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043d\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0434\u043b\u044f AWS \u0438\u043c\u0435\u0435\u0442 <a href=\"https:\/\/docs.aws.amazon.com\/whitepapers\/latest\/organizing-your-aws-environment\/benefits-of-using-multiple-aws-accounts.html\" rel=\"noopener noreferrer nofollow\">\u0440\u044f\u0434 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432<\/a>. \u042f \u043d\u0435 \u0431\u0443\u0434\u0443 \u043d\u0430 \u043d\u0438\u0445 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043a\u0430\u0436\u0443 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<figure class=\"full-width\"><figcaption>\u0421\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432<\/figcaption><\/figure>\n<p>\u0410\u043a\u043a\u0430\u0443\u043d\u0442 <code>root<\/code> \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0433\u043b\u0430\u0432\u043d\u044b\u043c \u0432 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 (\u043d\u0430 \u043d\u0435\u0433\u043e \u043f\u0440\u0438\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0431\u0438\u043b\u043b\u0438\u043d\u0433), \u0432\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u0434 \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e \u044d\u0442\u043e\u0433\u043e \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430.<\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d \u043a \u0440\u0430\u0437\u043d\u043e\u043c\u0443 \u043f\u043e\u0447\u0442\u043e\u0432\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443, \u043d\u043e \u043e\u0431\u044b\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0447\u0442\u043e\u0432\u044b\u0435 \u0430\u043b\u0438\u0430\u0441\u044b \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u043e\u0447\u0442\u043e\u0432\u043e\u0433\u043e \u044f\u0449\u0438\u043a\u0430.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0430\u043a\u043a\u0430\u0443\u043d\u0442 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <code>root<\/code> \u0438 <a href=\"https:\/\/console.aws.amazon.com\/organizations\/v2\/home\/accounts\" rel=\"noopener noreferrer nofollow\">\u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043d\u043e\u0432\u044b\u0435 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b<\/a> \u0432 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u044e. \u041b\u043e\u0433\u0438\u043d\u0438\u043c\u0441\u044f \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b, \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c MFA \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439 \u0438 \u0443\u0434\u043e\u0441\u0442\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u0441\u044f, \u0447\u0442\u043e \u043d\u0430\u0448\u0430 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432 \u0432\u0435\u0440\u043d\u0430 \u0438 \u043c\u044b \u043d\u0430\u0445\u043e\u0434\u0438\u043c\u0441\u044f \u0432 \u043e\u0434\u043d\u043e\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438.<\/p>\n<figure class=\"full-width\"><figcaption>https:\/\/console.aws.amazon.com\/organizations\/v2\/home\/accounts<\/figcaption><\/figure>\n<p>\u042d\u0442\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u043c\u043e\u0436\u0435\u043c \u0438\u0434\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<h2>\u0421\u0435\u0442\u0435\u0432\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430<\/h2>\n<p>\u0412 \u043c\u043e\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u044b <code>dev<\/code>, <code>stage<\/code> \u0438 <code>prod<\/code> \u0438\u0437\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u044b \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430.<\/p>\n<p>\u0410\u043a\u043a\u0430\u0443\u043d\u0442 <code>common<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0431\u0449\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a \u0441\u0438\u0441\u0442\u0435\u043c\u0430 CI\/CD, \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 (S3-\u0431\u0430\u043a\u0435\u0442\u044b), \u0438 \u0442.\u0434. \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0434\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 <code>common<\/code> \u0438 <code>dev<\/code>\/<code>stage<\/code>\/<code>prod<\/code> \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430\u043c, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c VPC-\u043f\u0438\u0440\u0438\u043d\u0433 (\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0435\u0442\u044f\u043c\u0438).<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u044d\u0442\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e terraform \u0434\u043b\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432 <code>common<\/code> \u0438 <code>dev<\/code>.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c VPC:<\/p>\n<pre><code>data \"aws_availability_zones\" \"available\" {}  module \"vpc\" {   source  = \"terraform-aws-modules\/vpc\/aws\"   version = \"3.7.0\"    name = \"${var.env}-vpc\"   cidr = var.vpc_cidr   azs  = data.aws_availability_zones.available.names    private_subnets = var.vpc_private_subnets   public_subnets  = var.vpc_public_subnets    enable_nat_gateway   = true   single_nat_gateway   = true   enable_dns_hostnames = true }<\/code><\/pre>\n<p>\u0410 \u0442\u0430\u043a\u0436\u0435 \u0444\u0430\u0439\u043b \u0441 \u0432\u0445\u043e\u0434\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 <code>terraform.tfvars<\/code>:<\/p>\n<pre><code>region = \"eu-central-1\" env    = \"common\"  # https:\/\/www.davidc.net\/sites\/default\/subnets\/subnets.html # \u043a\u0430\u0436\u0434\u0430\u044f \u043f\u043e\u0434\u0441\u0435\u0442\u044c ~8190 \u0445\u043e\u0441\u0442\u043e\u0432 # 10.0.192.0\/19 \u0437\u0430\u0440\u0435\u0437\u0435\u0440\u0432\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u043f\u043e\u0434 VPN-\u043a\u043b\u0438\u0435\u043d\u0442\u043e\u0432 vpc_cidr            = \"10.0.0.0\/16\" vpc_private_subnets = [\"10.0.0.0\/19\", \"10.0.32.0\/19\", \"10.0.64.0\/19\"] vpc_public_subnets  = [\"10.0.96.0\/19\", \"10.0.128.0\/19\", \"10.0.160.0\/19\"]<\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u0434\u043b\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0430 <code>dev<\/code>, \u043f\u0440\u043e\u0441\u0442\u043e \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 \u0438 \u0432\u0441\u0442\u0430\u0432\u044c\u0442\u0435 \u0444\u0430\u0439\u043b \u0438 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u0435\u0442\u0435\u0439 \u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u0435\u0439, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u043d\u0430 <code>10.1.0.0\/16<\/code> \u0438 \u0442.\u0434. <strong>\u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u043f\u043e\u0434\u0441\u0435\u0442\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u043c\u0438, \u0447\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0435\u0436\u0430\u0442\u044c \u0438\u0445 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435 \u043f\u0438\u0440\u0438\u043d\u0433\u0430.<\/strong><\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043c\u044b \u0438\u043c\u0435\u0435\u043c \u043d\u043e\u0432\u044b\u0435 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0435 \u0441\u0435\u0442\u0438:<\/p>\n<ul>\n<li>\n<p><code>common-vpc<\/code> \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 <code>common<\/code> \u0441 CIDR: <code>10.0.0.0\/16<\/code>, \u0442\u0440\u0435\u043c\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0438 \u0442\u0440\u0435\u043c\u044f \u0447\u0430\u0441\u0442\u043d\u044b\u043c\u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u044f\u043c\u0438<\/p>\n<\/li>\n<li>\n<p><code>dev-vpc<\/code> \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 <code>dev<\/code> \u0441 CIDR: <code>10.1.0.0\/16<\/code>, \u0442\u0440\u0435\u043c\u044f \u043f\u0443\u0431\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0438 \u0442\u0440\u0435\u043c\u044f \u0447\u0430\u0441\u0442\u043d\u044b\u043c\u0438 \u043f\u043e\u0434\u0441\u0435\u0442\u044f\u043c\u0438<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u043c \u0438\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0438\u0440\u0438\u043d\u0433\u0430:<\/p>\n<pre><code>module \"common_dev_peering\" {   source  = \"grem11n\/vpc-peering\/aws\"   version = \"4.0.1\"    providers = {     aws.this = aws     aws.peer = aws.dev   }    this_vpc_id = module.vpc.vpc_id   peer_vpc_id = var.vpc_dev_accepter_id    auto_accept_peering = true }<\/code><\/pre>\n<p>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0443\u043a\u0430\u0437\u0430\u0442\u044c <code>vpc_dev_accepter_id<\/code>\u00a0\u0432 \u0444\u0430\u0439\u043b\u0435\u00a0<code>terraform.tfvars<\/code>:<\/p>\n<pre><code>... vpc_dev_accepter_id = \"vpc-12345678\"<\/code><\/pre>\n<p>\u0422\u0443 \u0436\u0435 \u0441\u0430\u043c\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0442\u044c, \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, \u0434\u043b\u044f \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u043e\u0432 <code>stage<\/code> \u0438 <code>prod<\/code>.<\/p>\n<figure class=\"full-width\"><figcaption>\u0421\u0445\u0435\u043c\u0430 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0447\u0430\u0441\u0442\u043d\u044b\u0445 \u0441\u0435\u0442\u0435\u0439<\/figcaption><\/figure>\n<p>\u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0435\u0442\u0435\u0432\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432 \u043e\u0431\u043e\u0438\u0445 \u0441\u0435\u0442\u044f\u0445 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u043a\u0443 \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043a\u0430\u043a\u0438\u043c-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u043c \u0442\u0438\u043f\u0430 <code>ping<\/code> \u0438\u043b\u0438 <code>traceroute<\/code>.<\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c SSO<\/h2>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 AWS \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442 <code>root<\/code>, \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0441\u0435\u0440\u0432\u0438\u0441 <a href=\"https:\/\/eu-central-1.console.aws.amazon.com\/singlesignon\/home?region=eu-central-1#\/groups\" rel=\"noopener noreferrer nofollow\">AWS SSO<\/a> \u0438 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0442\u0440\u0438 \u0433\u0440\u0443\u043f\u043f\u044b:<\/p>\n<ul>\n<li>\n<p><code>vpn-dev<\/code><\/p>\n<\/li>\n<li>\n<p><code>vpn-stage<\/code><\/p>\n<\/li>\n<li>\n<p><code>vpn-prod<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0418\u0434\u0435\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0440\u0430\u0437\u0434\u0435\u043b\u044f\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c \u0441\u0435\u0442\u044f\u043c \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0433\u0440\u0443\u043f\u043f (<abbr title=\"Role-based access control\">RBAC<\/abbr>) \u0441 VPN.<\/p>\n<figure class=\"full-width\"><figcaption>\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u0433\u0440\u0443\u043f\u043f\u044b<\/figcaption><\/figure>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043f\u0443\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 <code>amet-umerov<\/code>, \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0435\u0433\u043e \u0432\u043e \u0432\u0441\u0435 \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0435 \u0433\u0440\u0443\u043f\u043f\u044b, \u043c\u044b \u0445\u043e\u0442\u0438\u043c \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u0434\u043e\u0441\u0442\u0443\u043f \u0432\u043e \u0432\u0441\u0435 \u0441\u0435\u0442\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e VPN.<\/p>\n<figure class=\"full-width\"><figcaption>\u041d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0435\u043c \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c MFA \u0434\u043b\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f<\/figcaption><\/figure>\n<p>\u0418\u0442\u0430\u043a, \u043c\u044b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u044b \u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0441\u0430\u043c\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c <a href=\"https:\/\/eu-central-1.console.aws.amazon.com\/singlesignon\/home?region=eu-central-1#\/applications\" rel=\"noopener noreferrer nofollow\">\u043d\u043e\u0432\u043e\u0435 SSO-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/a> \u043f\u043e\u0434 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435\u043c VPN:<\/p>\n<ul>\n<li>\n<p>Add a custom SAML 2.0 application<\/p>\n<\/li>\n<li>\n<p><strong>\u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u00a0<\/strong><code>AWS SSO SAML metadata file<\/code><strong>, \u043e\u043d \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u043e\u0437\u0436\u0435<\/strong><\/p>\n<\/li>\n<li>\n<p>Set session duration:\u00a0<code>12 hours<\/code><\/p>\n<\/li>\n<li>\n<p>Application ACS URL:\u00a0<code>http:\/\/127.0.0.1:35001<\/code><\/p>\n<\/li>\n<li>\n<p>Application SAML audience:\u00a0<code>urn:amazon:webservices:clientvpn<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u043d\u043e SSO-\u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c VPN Self-Service \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438, \u043a\u0440\u043e\u043c\u0435:<\/p>\n<ul>\n<li>\n<p>Application ACS URL:\u00a0<code>https:\/\/self-service.clientvpn.amazonaws.com\/api\/auth\/sso\/saml<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043c\u0430\u043f\u043f\u0438\u043d\u0433 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u0432 \u0434\u043b\u044f \u044d\u0442\u0438\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439:<\/p>\n<ul>\n<li>\n<p><code>Subject<\/code>\u00a0\u2014\u00a0<code>user:subject<\/code>\u00a0\u2014\u00a0<code>emailAddress<\/code><\/p>\n<\/li>\n<li>\n<p><code>NameID<\/code>\u00a0\u2014\u00a0<code>${user:email}<\/code>\u00a0\u2014\u00a0<code>unspecified<\/code><\/p>\n<\/li>\n<li>\n<p><code>FirstName<\/code>\u00a0\u2014\u00a0<code>${user:name}<\/code>\u00a0\u2014\u00a0<code>unspecified<\/code><\/p>\n<\/li>\n<li>\n<p><code>LastName<\/code>\u00a0\u2014\u00a0<code>${user:familyName}<\/code>\u00a0\u2014\u00a0<code>unspecified<\/code><\/p>\n<\/li>\n<li>\n<p><code>memberOf<\/code>\u00a0\u2014\u00a0<code>${user:groups}<\/code>\u00a0\u2014\u00a0<code>unspecified<\/code><\/p>\n<\/li>\n<\/ul>\n<p>\u0418 \u043f\u0440\u0438\u0432\u044f\u0436\u0435\u043c \u043a \u043d\u0438\u043c \u0432\u0441\u0435 \u0442\u0440\u0438 \u0433\u0440\u0443\u043f\u043f\u044b (<code>vpn-dev<\/code>,\u00a0<code>vpn-stage<\/code>,\u00a0<code>vpn-prod<\/code>).<\/p>\n<figure class=\"full-width\"><figcaption>\u0421\u043f\u0438\u0441\u043e\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439<\/figcaption><\/figure>\n<p>\u0412\u043e\u0442 \u043a\u0430\u043a \u043e\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442:<\/p>\n<figure class=\"full-width\"><figcaption>\u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0441\u0435\u0442\u044f\u043c<\/figcaption><\/figure>\n<h2>\u041d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c VPN<\/h2>\n<p>\u041d\u0430\u0448\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0435 <a href=\"https:\/\/eu-central-1.console.aws.amazon.com\/vpc\/home?region=eu-central-1#ClientVPNEndpoints:sort=clientVpnEndpointId\" rel=\"noopener noreferrer nofollow\">\u043a\u043b\u0438\u0435\u043d\u0442\u0441\u043a\u043e\u0439 \u0442\u043e\u0447\u043a\u0438 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u0434\u043b\u044f VPN<\/a> \u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 <code>common<\/code>. \u041d\u043e \u043f\u0435\u0440\u0435\u0434 \u044d\u0442\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0438 \u043a\u043b\u044e\u0447\u0438.<\/p>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0438 \u043a\u043b\u0438\u0435\u043d\u0442\u0430:<\/p>\n<pre><code>$ git clone https:\/\/github.com\/OpenVPN\/easy-rsa.git $ cd easy-rsa\/easyrsa3  $ .\/easyrsa init-pki $ .\/easyrsa build-ca nopass ... Common Name (eg: your user, host, or server name) [Easy-RSA CA]:vpn.domain.org  $ .\/easyrsa build-server-full vpn-aws-server nopass $ .\/easyrsa build-client-full vpn-aws-client nopass<\/code><\/pre>\n<p>\u041a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u044b \u0432 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0438 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0434\u043b\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0432 <a href=\"https:\/\/eu-central-1.console.aws.amazon.com\/acm\/home?region=eu-central-1#\/\" rel=\"noopener noreferrer nofollow\">AWS ACM<\/a>:<\/p>\n<pre><code>$ mkdir ~\/.vpn-assets\/ $ cp pki\/ca.crt ~\/.vpn-assets\/ $ cp pki\/private\/ca.key ~\/.vpn-assets\/ $ cp pki\/issued\/vpn-aws-*.crt ~\/.vpn-assets\/ $ cp pki\/private\/vpn-aws-*.key ~\/.vpn-assets\/  $ aws --profile common \\     --region eu-central-1 \\     acm import-certificate \\     --certificate fileb:\/\/$HOME\/.vpn-assets\/vpn-aws-server.crt \\     --private-key fileb:\/\/$HOME\/.vpn-assets\/vpn-aws-server.key \\     --certificate-chain fileb:\/\/$HOME\/.vpn-assets\/ca.crt  # \u041d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u044d\u0442\u043e \u0432\u0441\u0435 \u0432 S3-\u0431\u0430\u043a\u0435\u0442 $ aws --profile=common s3 cp --recursive ~\/.vpn-assets\/ s3:\/\/my-bucket\/vpn\/<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u043e\u0432\u043e\u0435 VPN-\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e terraform:<\/p>\n<pre><code># SAML \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u044b \u0438\u0437 \u043c\u0435\u0442\u0430\u0434\u0430\u0442\u0430-\u0444\u0430\u0439\u043b\u043e\u0432, \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0445 \u043d\u0430\u043c\u0438 \u0440\u0430\u043d\u0435\u0435 resource \"aws_iam_saml_provider\" \"vpn\" {   name                   = \"vpn\"   saml_metadata_document = file(\"${path.module}\/files\/VPN_ins-mymetadata-file.xml\") }  resource \"aws_iam_saml_provider\" \"vpn_self_service\" {   name                   = \"vpn-self-service\"   saml_metadata_document = file(\"${path.module}\/files\/VPN Self-Service_ins-mymetadata-file.xml\") }  # \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430\u043c\u0438 \u0441\u0435\u0440\u0442\u0438\u0444\u0438\u043a\u0430\u0442 \u0438 subnet_id data \"aws_acm_certificate\" \"vpn_aws_server_cert\" {   domain   = \"vpn-aws-server\"   statuses = [\"ISSUED\"] }  data \"aws_subnet\" \"vpn_subnet_id\" {   filter {     name   = \"tag:Name\"     values = [\"${var.env}-vpc-private\"]   }   availability_zone_id = \"euc1-az1\" }  # \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 CloudWatch \u0434\u043b\u044f \u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f VPN resource \"aws_cloudwatch_log_group\" \"client_vpn\" {   name = \"vpn_endpoint_cloudwatch_log_group\" }  resource \"aws_cloudwatch_log_stream\" \"client_vpn\" {   name           = \"vpn_endpoint_cloudwatch_log_stream\"   log_group_name = aws_cloudwatch_log_group.client_vpn.name }  # \u0422\u043e\u0447\u043a\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 VPN resource \"aws_ec2_client_vpn_endpoint\" \"vpn\" {   description            = \"VPN client for AWS\"   server_certificate_arn = data.aws_acm_certificate.vpn_aws_server_cert.arn    client_cidr_block = var.vpn_client_cidr_block   dns_servers       = var.vpn_dns_servers    split_tunnel        = \"true\"   self_service_portal = \"enabled\"   transport_protocol  = \"udp\"    authentication_options {     type                           = \"federated-authentication\"     saml_provider_arn              = aws_iam_saml_provider.vpn.arn     self_service_saml_provider_arn = aws_iam_saml_provider.vpn_self_service.arn   }    connection_log_options {     enabled               = true     cloudwatch_log_group  = aws_cloudwatch_log_group.client_vpn.name     cloudwatch_log_stream = aws_cloudwatch_log_stream.client_vpn.name   } }  # \u0424\u0430\u0435\u0440\u0432\u043e\u043b\u044b \u0434\u043b\u044f VPN resource \"aws_security_group\" \"vpn_main\" {   name        = \"vpn_main\"   description = \"Allow VPN all traffic\"   vpc_id      = module.vpc.vpc_id    egress {     description = \"Allow all traffic for VPN\"     cidr_blocks = [\"0.0.0.0\/0\"]     from_port   = \"0\"     protocol    = \"-1\"     self        = \"false\"     to_port     = \"0\"   }    ingress {     description = \"Allow all traffic for VPN\"     cidr_blocks = [\"0.0.0.0\/0\"]     from_port   = \"0\"     protocol    = \"-1\"     self        = \"false\"     to_port     = \"0\"   } }  # \u0410\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u0443\u0435\u043c VPN-\u0442\u043e\u0447\u043a\u0443 \u0441 \u043f\u043e\u0434\u0441\u0435\u0442\u044c\u044e resource \"aws_ec2_client_vpn_network_association\" \"vpn\" {   client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.vpn.id   subnet_id              = data.aws_subnet.vpn_subnet_id.id   security_groups        = [aws_security_group.vpn_main.id] }  # \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b (access_group_id) \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0442\u0443\u0442 (\u0432 \u0430\u043a\u043a\u0430\u0443\u043d\u0442\u0435 root): # https:\/\/eu-central-1.console.aws.amazon.com\/singlesignon\/home?region=eu-central-1#\/groups resource \"aws_ec2_client_vpn_authorization_rule\" \"vpn_dev\" {   client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.vpn.id   target_network_cidr    = \"10.10.0.0\/16\"   access_group_id        = \"1234-5678-...\"   description            = \"vpn-dev\" }  # \u0420\u0430\u0437\u0440\u0435\u0448\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u0432 \u0441\u0435\u0442\u044c common \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f\u044b vpn-dev resource \"aws_ec2_client_vpn_authorization_rule\" \"vpn_common\" {   client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.vpn.id   target_network_cidr    = \"10.0.0.0\/16\"   access_group_id        = \"1234-5678-...\"   description            = \"vpn-common\" }  # \u041c\u0430\u0440\u0448\u0440\u0443\u0442\u044b resource \"aws_ec2_client_vpn_route\" \"vpn_to_dev\" {   client_vpn_endpoint_id = aws_ec2_client_vpn_endpoint.vpn.id   destination_cidr_block = \"10.10.0.0\/16\"   target_vpc_subnet_id   = aws_ec2_client_vpn_network_association.vpn.subnet_id }<\/code><\/pre>\n<p>\u0418 \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b\u00a0<code><\/code><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-416905","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/416905","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=416905"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/416905\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=416905"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=416905"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=416905"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}