Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .holo/branches/fixtures/_laddr.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[holomapping]
root = "fixtures"
files = "**/*.sql"
62 changes: 62 additions & 0 deletions docs/operations/update-saml2-certificate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Update SAML2 Certificate

The OpenSSL certificate used by Laddr's Single Sign-On (SSO) integration with Slack needs to be refreshed occasionally when it nears or passes its expiration date

## Generate a new certificate

On any computer with the `openssl` command installed (readily available on macOS and Linux), you can generate the new key+certificate pair before installing it to your Slack and Laddr instances:

1. Generate private key:

```bash
openssl genrsa \
-out ./laddr-slack-private-key.pem \
1024
```

2. Generate public certificate:

```bash
openssl req -new -x509 \
-days 1095 \
-key ./laddr-slack-private-key.pem \
-out ./laddr-slack-public-cert.pem
```

*Fill out the prompts with appropriate information about your organization. These values don't really matter for anything*

3. If your Laddr instance is hosted on Kubernetes, encode the two generated files into a `Secret` manifest (you only need the `kubectl` command installed on your local system for this, it does *not* need to be connected to any cluster):

```bash
kubectl create secret generic saml2 \
--output=yaml \
--dry-run \
--from-file=SAML2_PRIVATE_KEY=./laddr-slack-private-key.pem \
--from-file=SAML2_CERTIFICATE=./laddr-slack-public-cert.pem \
> ./saml2.secret.yaml
```

4. If your cluster uses [sealed secrets](http://civic-cloud.phl.io/development/features/sealed-secrets/), seal the newly-created secret:

```bash
export SEALED_SECRETS_CERT=https://sealed-secrets.live.k8s.phl.io/v1/cert.pem
kubeseal \
--namespace "my-project" \
-f ./saml2.secret.yaml \
-w ./saml2.sealed-secret.yaml
```

*Be sure to replace `my-project` with the namespace your instance is deployed within*

5. Deploy the sealed secret to your cluster

*In Code for Philly's case, that means updating [`saml2.yaml`](https://github.com/CodeForPhilly/cfp-live-cluster/blob/main/code-for-philly.secrets/saml2.yaml) with the new content and then merging the generated deploy PR. After the deploy, you may need to delete the existing secret in order for the `sealed-secrets` operator to replace it with the updated secret*

6. Finally, visit <https://my-org.slack.com/admin/auth/saml?sudo=1> and edit the **Public Certificate**, pasting the contents of `./laddr-slack-public-cert.pem`:

```bash
cat ./laddr-slack-public-cert.pem
# paste output to Slack admin webpage
```

*Slack will not let you save the new public certificate until it's been successfully applied to the host*
21 changes: 21 additions & 0 deletions fixtures/project_buzz.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40101 SET character_set_client = utf8 */;

CREATE TABLE `project_buzz` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Class` enum('Laddr\\ProjectBuzz') NOT NULL,
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`CreatorID` int(11) DEFAULT NULL,
`ProjectID` int(10) unsigned NOT NULL,
`Handle` varchar(255) NOT NULL,
`Headline` varchar(255) NOT NULL,
`URL` varchar(255) NOT NULL,
`Published` timestamp NOT NULL,
`ImageID` int(10) unsigned DEFAULT NULL,
`Summary` text,
PRIMARY KEY (`ID`),
UNIQUE KEY `Handle` (`Handle`),
KEY `ProjectID` (`ProjectID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `project_buzz` VALUES (1,'Laddr\\ProjectBuzz','2022-10-05 00:42:40',2,1,'laddr_v3.1.1_released','Laddr v3.1.1 released!','https://github.com/CodeForPhilly/laddr/releases/tag/v3.1.1','2022-08-06 19:15:00',NULL,'## Technical\r\n\r\n- chore(deps): bump emergence-slack to v1.0.2 @themightychris');
16 changes: 16 additions & 0 deletions fixtures/project_members.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40101 SET character_set_client = utf8 */;

CREATE TABLE `project_members` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Class` enum('Laddr\\ProjectMember') NOT NULL,
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`CreatorID` int(11) DEFAULT NULL,
`ProjectID` int(10) unsigned NOT NULL,
`MemberID` int(10) unsigned NOT NULL,
`Role` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `ProjectMember` (`ProjectID`,`MemberID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `project_members` VALUES (1,'Laddr\\ProjectMember','2022-10-05 00:41:02',2,1,2,'Founder');
36 changes: 36 additions & 0 deletions fixtures/project_updates.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40101 SET character_set_client = utf8 */;

CREATE TABLE `project_updates` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Class` enum('Laddr\\ProjectUpdate') NOT NULL,
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`CreatorID` int(11) DEFAULT NULL,
`Modified` timestamp NULL DEFAULT NULL,
`ModifierID` int(10) unsigned DEFAULT NULL,
`ProjectID` int(10) unsigned NOT NULL,
`Number` int(10) unsigned NOT NULL,
`Body` text NOT NULL,
PRIMARY KEY (`ID`),
KEY `ProjectID` (`ProjectID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `project_updates` VALUES (1,'Laddr\\ProjectUpdate','2022-10-05 00:41:20',2,NULL,NULL,1,1,'Today we set up sample data to add to the project repository');


CREATE TABLE `history_project_updates` (
`RevisionID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ID` int(10) unsigned NOT NULL,
`Class` enum('Laddr\\ProjectUpdate') NOT NULL,
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`CreatorID` int(11) DEFAULT NULL,
`Modified` timestamp NULL DEFAULT NULL,
`ModifierID` int(10) unsigned DEFAULT NULL,
`ProjectID` int(10) unsigned NOT NULL,
`Number` int(10) unsigned NOT NULL,
`Body` text NOT NULL,
PRIMARY KEY (`RevisionID`),
KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `history_project_updates` SELECT NULL AS RevisionID, project_updates.* FROM `project_updates`;
48 changes: 48 additions & 0 deletions fixtures/projects.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40101 SET character_set_client = utf8 */;

CREATE TABLE `projects` (
`ID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Class` enum('Laddr\\Project') NOT NULL,
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`CreatorID` int(11) DEFAULT NULL,
`Modified` timestamp NULL DEFAULT NULL,
`ModifierID` int(10) unsigned DEFAULT NULL,
`Title` varchar(255) NOT NULL,
`Handle` varchar(255) NOT NULL,
`MaintainerID` int(10) unsigned DEFAULT NULL,
`UsersUrl` varchar(255) DEFAULT NULL,
`DevelopersUrl` varchar(255) DEFAULT NULL,
`README` text,
`NextUpdate` int(10) unsigned NOT NULL DEFAULT '1',
`Stage` enum('Commenting','Bootstrapping','Prototyping','Testing','Maintaining','Drifting','Hibernating') NOT NULL DEFAULT 'Commenting',
`ChatChannel` varchar(255) DEFAULT NULL,
PRIMARY KEY (`ID`),
UNIQUE KEY `Handle` (`Handle`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `projects` VALUES (1,'Laddr\\Project','2022-10-05 00:41:02',2,'2022-10-05 00:41:20',2,'Laddr','laddr',2,'http://codeforphilly.github.io/laddr/','https://github.com/CodeForPhilly/laddr',NULL,2,'Maintaining','laddr');


CREATE TABLE `history_projects` (
`RevisionID` int(10) unsigned NOT NULL AUTO_INCREMENT,
`ID` int(10) unsigned NOT NULL,
`Class` enum('Laddr\\Project') NOT NULL,
`Created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`CreatorID` int(11) DEFAULT NULL,
`Modified` timestamp NULL DEFAULT NULL,
`ModifierID` int(10) unsigned DEFAULT NULL,
`Title` varchar(255) NOT NULL,
`Handle` varchar(255) NOT NULL,
`MaintainerID` int(10) unsigned DEFAULT NULL,
`UsersUrl` varchar(255) DEFAULT NULL,
`DevelopersUrl` varchar(255) DEFAULT NULL,
`README` text,
`NextUpdate` int(10) unsigned NOT NULL DEFAULT '1',
`Stage` enum('Commenting','Bootstrapping','Prototyping','Testing','Maintaining','Drifting','Hibernating') NOT NULL DEFAULT 'Commenting',
`ChatChannel` varchar(255) DEFAULT NULL,
PRIMARY KEY (`RevisionID`),
KEY `ID` (`ID`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `history_projects` SELECT NULL AS RevisionID, projects.* FROM `projects`;
2 changes: 1 addition & 1 deletion html-templates/project-buzz/projectBuzzSaved.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{block title}{_ 'Buzz Saved'} &mdash; {$dwoo.parent}{/block}

{block content}
{capture assign=buzzHeadlineLink}<a href="{$data->getURL()}">{$data->Headline|escape}</a> {tif $data->isNew ? {_ posted} : {_ updated}}{/capture}
{capture assign=buzzHeadlineLink}<a href="{$data->getURL()}">{$data->Headline|escape}</a> {tif $data->isNew ? _('posted') : _('updated')}{/capture}
{capture assign=projectNameLink}{projectLink $data->Project}{/capture}
<p>{sprintf(_("%s for %s"), $buzzHeadlineLink, $projectNameLink)}</p>
{/block}