FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
lhttps/src/Config.php at dev · madeny/lhttps · GitHub
madeny
/
lhttps
Public
Notifications
You must be signed in to change notification settings
Fork
17
Star
176
Code
Issues
0
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
lhttps
/
src
/
Config.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
69 lines (56 loc) · 1.18 KB
Breadcrumbs
lhttps
/
src
/
Config.php
Copy path
File metadata and controls
69 lines (56 loc) · 1.18 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?php
namespace
Madeny
\
lhttps
;
use
Symfony
\
Component
\
Dotenv
\
Dotenv
;
class
Config
{
public
function
__construct
(
$
domain
)
{
$
path
=
$
this
->
path
();
$
this
->
v3
(
$
path
,
$
domain
);
$
this
->
openssl
(
$
path
);
}
private
function
v3
(
$
path
,
$
domain
)
{
$
v3
= [
'
authorityKeyIdentifier=keyid,issuer
'
,
'
basicConstraints=CA:FALSE
'
,
'
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
'
,
'
subjectAltName = @alt_names
'
,
"
[alt_names]
"
,
"
DNS.1 =
{
$
domain
}"
];
$
str
=
implode
(
"\n"
,
$
v3
);
file_put_contents
(
$
path
.
'
/cnf/v3.ext
'
,
$
str
);
return
$
str
;
}
private
function
openssl
(
$
path
)
{
$
dotenv
=
new
Dotenv
();
$
dotenv
->
load
(
realpath
(
__DIR__
.
'
/../.env
'
));
$
arr
= [
$
_ENV
[
'
R
'
],
$
_ENV
[
'
D
'
],
$
_ENV
[
'
P
'
],
$
_ENV
[
'
DM
'
],
$
_ENV
[
'
DN
'
],
$
_ENV
[
'
D2
'
],
$
_ENV
[
'
COUNTRY
'
],
$
_ENV
[
'
STATE
'
],
$
_ENV
[
'
LOCALITY
'
],
$
_ENV
[
'
ORGANIZATION
'
],
$
_ENV
[
'
ORGANIZATION_UNIT
'
],
$
_ENV
[
'
EMAILADDRESS
'
],
$
_ENV
[
'
COMMONNAME
'
]];
$
str
=
implode
(
"\n"
,
$
arr
);
file_put_contents
(
$
path
.
'
/cnf/openssl.cnf
'
,
$
str
);
return
$
str
;
}
public
static
function
path
()
{
$
dir
=
__DIR__
.
'
/../cert
'
;
if
(!
file_exists
(
$
dir
)) {
mkdir
(
$
dir
);
}
return
$
dir
;
}
}
Back
|
FazBrowse Home
|
New Git URL