Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
Install PaperCut SSL Cert
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open-source
Install PaperCut SSL Cert
Commits
343034e4
Commit
343034e4
authored
Jun 02, 2019
by
Tim Coates
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Open source version of file
parents
Pipeline
#158
failed with stages
in 1 minute and 20 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
Install-PapercutSSL.ps1
Install-PapercutSSL.ps1
+58
-0
No files found.
Install-PapercutSSL.ps1
0 → 100644
View file @
343034e4
# PaperCut MF App Path
$PCAppPath
=
"C:\Program Files\PaperCut MF"
# Directories
$KeyToolPath
=
Join-Path
-Path
$PCAppPath
-ChildPath
'runtime\jre\bin\'
$KeyStorePath
=
Join-path
-Path
$PCAppPath
-ChildPath
'server\custom\'
$PCWinBinPath
=
Join-path
-Path
$PCAppPath
-ChildPath
'server\bin\win'
# Get available certificates
$certsStoreRoot
=
"\\server\Certs
$
\"
$certsStore
=
Get-ChildItem
-Path
$certsStoreRoot
-Filter
"domainFolder*"
-Directory
|
Sort-Object
-Property
LastWriteTime
-Descending
|
Select-Object
-First
1
$certsStoreFolder
=
$certsStore
.
FullName
$certsTempFolder
=
$
(
Join-Path
-Path
$KeyStorePath
-ChildPath
'temp'
)
Function
Write-Log
(
$msg
){
Write-Host
$msg
$now
=
[
string
]
$
(
Get-Date
-format
s
)
Add-Content
-Path
"C:\Scripts\Logs\Install-SSLPapercut.log"
-Value
$
(
$now
+
" - "
+
$msg
)
}
Try
{
# Test that we can access the certs folder found above
Test-Path
$certsStoreFolder
# Create temp dir
Write-Log
"Creating temp certs folder"
if
(
!
(
Test-Path
$certsTempFolder
)){
mkdir
$certsTempFolder
}
# Copy certs to local temp dir
Write-Log
"Creating temp certs folder"
Copy-Item
-Path
$certsStoreFolder
-Destination
$certsTempFolder
-Recurse
$localCertsFolder
=
Join-Path
-Path
$certsTempFolder
-ChildPath
$certsStore
.
Name
# Archive old keystore
Write-Log
"Archiving old keystore"
$archiveDate
=
Get-Date
$
(
Get-ChildItem
-Path
$
(
Join-Path
-Path
$KeyStorePath
-ChildPath
'my-ssl-keystore'
))
.
LastWriteTime
-UFormat
"%Y-%m-%d"
Move-Item
-Path
$
(
Join-Path
-Path
$KeyStorePath
-ChildPath
'my-ssl-keystore'
)
-Destination
$
(
Join-Path
-Path
$KeyStorePath
-ChildPath
"my-ssl-keystore-
$archiveDate
"
)
# Create new keystore from pfx
Write-Log
"Creating new keystore"
cd
$PCWinBinPath
.
\create-ssl-keystore.exe
-f
-p12
$
(
'"'
+
$
(
Join-Path
-Path
$localCertsFolder
-ChildPath
$
(
$
(
$certsStore
.
Name
)
+
".pfx"
))
+
'"'
)
-p12pass
PASSWORD
!
-k
$
(
'"'
+
$
(
Join-Path
-Path
$KeyStorePath
-ChildPath
'my-ssl-keystore'
)
+
'"'
)
# Restart PaperCut App Server
Write-Log
"Restarting PaperCut"
Restart-Service
PCAppServer
Write-Log
"Cleaning up temp files"
Remove-Item
-Path
$localCertsFolder
-Recurse
-Force
Write-Log
"Done"
}
catch
{
Write-Log
$
(
"ERROR: "
+
$_
.
Exception
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment