Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get NC->NC working #41

Merged
merged 125 commits into from
Nov 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
cd49f1c
FTU_CLOSE_BUTTON, ref #32
michielbdejong Sep 22, 2021
51991d5
Corr
michielbdejong Sep 22, 2021
efdbf6b
select nextcloud.png file
michielbdejong Sep 22, 2021
41296d6
create public link
michielbdejong Sep 23, 2021
879b184
fix #33
michielbdejong Sep 23, 2021
06e01d0
docs
michielbdejong Sep 23, 2021
7a6a481
mention two more issues
michielbdejong Oct 5, 2021
7ae9ec1
Merge remote-tracking branch 'origin/main' into dev
michielbdejong Oct 5, 2021
e1cba07
Try Share-with flow
michielbdejong Oct 5, 2021
3ec035b
Call client.sendShares
michielbdejong Oct 7, 2021
43a4a74
Testing reva-client CreateOCMShare
michielbdejong Oct 7, 2021
f5796de
still getting error: bad request: can't find resource permissions
michielbdejong Oct 7, 2021
be30d73
reva user type basics
michielbdejong Oct 11, 2021
fbffa13
test.ts
michielbdejong Oct 11, 2021
edba52d
Move to TypeScript ocm.test.ts
michielbdejong Oct 11, 2021
a5c294c
Run jest on typescript
michielbdejong Oct 11, 2021
76b9025
Run jest on typescript
michielbdejong Oct 11, 2021
fa07e45
configure jest with ts
michielbdejong Oct 11, 2021
1704973
fix login
michielbdejong Oct 11, 2021
daed6c4
console.log statements
michielbdejong Oct 12, 2021
d50529b
testing concurrency slip that seems to be happening in jest
michielbdejong Oct 13, 2021
95055b1
name=%9D%A9%9E
michielbdejong Oct 14, 2021
096a185
Fix #42
michielbdejong Oct 14, 2021
d8f5dcd
shareWithDomain
michielbdejong Oct 15, 2021
e927629
Invite flow
michielbdejong Oct 19, 2021
11b1bde
Add cert
Oct 19, 2021
e7b26d0
revad as ubuntu
Oct 20, 2021
5d2052a
Build revad in ubuntu
Oct 20, 2021
e8f88e8
git and vim
Oct 20, 2021
41fc3f9
:443
Oct 20, 2021
77d0024
Add revad.crt as trusted
Oct 20, 2021
ee9ef61
next step in https://github.com/cs3org/reva/issues/1962#issuecomment-…
Oct 20, 2021
f530f9e
Merge remote-tracking branch 'dockerhost/main' into dev
michielbdejong Oct 20, 2021
5c152dc
Configure per host
Oct 21, 2021
1d59975
revad1.docker
Oct 21, 2021
7f30dc2
gatewaycertfile = "/etc/revad/tls/revad1.crt"
Oct 21, 2021
30f26d3
same in revad2.toml
Oct 21, 2021
6eb73e5
use revad1.docker everywhere
Oct 21, 2021
f649ed5
Use tls for http but not for grpc
Oct 21, 2021
cd7e07c
Same in revad2.toml
Oct 21, 2021
9670072
edit providers.demo.json
Oct 21, 2021
57d7649
params-docker.js
michielbdejong Oct 21, 2021
d1809c2
GRPC_PORT
michielbdejong Oct 21, 2021
12812d0
tester basics
michielbdejong Oct 21, 2021
70f86d2
More debugging
michielbdejong Oct 21, 2021
6d90d4a
tester code in jest
michielbdejong Oct 21, 2021
9db2b03
start to incorporate
michielbdejong Oct 21, 2021
ef95c0c
oops
michielbdejong Oct 21, 2021
a5704b8
use User class
michielbdejong Oct 21, 2021
3c8923c
method names
michielbdejong Oct 21, 2021
ab95265
debugging accept share
michielbdejong Oct 21, 2021
86c5b9e
comments
michielbdejong Oct 21, 2021
0d719a2
share with params[to].user
michielbdejong Oct 21, 2021
5d0cf0f
share with params[to].username
michielbdejong Oct 21, 2021
059cb4e
share with conso
michielbdejong Oct 21, 2021
c952177
reva->stub
michielbdejong Oct 21, 2021
5dc446a
stub with tls
Oct 22, 2021
92dcfda
run stubs in testnet
Oct 22, 2021
35fce65
Merge remote-tracking branch 'dockerhost/dev' into dev
michielbdejong Oct 22, 2021
38f93a2
already add certs in build.sh
Oct 22, 2021
42e4caa
Merge remote-tracking branch 'dockerhost/dev' into dev
michielbdejong Oct 22, 2021
1b6d655
revad1 in ocmd config for revad1
Oct 22, 2021
3792d10
Merge remote-tracking branch 'dockerhost/dev' into dev
michielbdejong Oct 22, 2021
0661855
live changes
Oct 22, 2021
8389709
changes on laptop
michielbdejong Oct 22, 2021
34a5035
Merge remote-tracking branch 'dockerhost/dev' into dev
michielbdejong Oct 22, 2021
67a42e6
Add testnet providers in whitelist
michielbdejong Oct 25, 2021
b71d7bb
Fix https://github.com/cs3org/ocm-test-suite/commit/34a5035347380d9ba…
michielbdejong Oct 25, 2021
ee4533e
fix trailing comma
michielbdejong Oct 25, 2021
28ae4e2
no --rm and domains in params-docker.js
michielbdejong Oct 25, 2021
8e854dd
endpoints in provider.demo.json
michielbdejong Oct 25, 2021
ddfefac
shareFromDomain
michielbdejong Oct 25, 2021
05a1dd7
IDPs in users.demo.json
michielbdejong Oct 25, 2021
4e7d0cd
Start working on #44
michielbdejong Oct 25, 2021
6f3abfe
Try Share-with flow, ref #44
michielbdejong Oct 25, 2021
af043ea
Tester for https://github.com/cs3org/ocm-test-suite/issues/44#issueco…
michielbdejong Oct 25, 2021
46b07f5
trying to set mask
michielbdejong Oct 25, 2021
fca2704
google-protobuf/google/protobuf/field_mask_pb
michielbdejong Oct 25, 2021
32a191b
share-with reva to reva
michielbdejong Oct 26, 2021
1f68481
list flow
michielbdejong Oct 26, 2021
9583bc2
from / to
michielbdejong Oct 26, 2021
98784f0
descr
michielbdejong Oct 26, 2021
273df2a
fix
michielbdejong Oct 26, 2021
22fea09
Move revad into servers/
michielbdejong Oct 28, 2021
d2e5fcc
use tls certs in nc image
michielbdejong Oct 28, 2021
58e14eb
skip openid config expose
michielbdejong Oct 28, 2021
b989620
Start increasing level of automation
michielbdejong Oct 28, 2021
6cca375
dockerfile edits
Oct 28, 2021
0f0ca4e
owncloud Dockerfile for oc1
Oct 28, 2021
921b35a
build more in docker
Oct 28, 2021
d802ea2
documenting
michielbdejong Oct 28, 2021
9f0d8b1
Merge remote-tracking branch 'dockerhost/dev' into dev
michielbdejong Oct 28, 2021
38349af
nc1, nc2
Oct 28, 2021
9769af7
params for oc
michielbdejong Oct 28, 2021
f03af3e
typo
michielbdejong Oct 28, 2021
9a62714
login page with apache-php docker image has index.php
michielbdejong Oct 28, 2021
9e01dca
run oc->oc
michielbdejong Oct 28, 2021
f583bcb
delay
michielbdejong Oct 28, 2021
04f5127
FTU closer on interval
michielbdejong Oct 28, 2021
b199b88
closeWizard
michielbdejong Oct 28, 2021
2ec24a3
habemus inheritance
michielbdejong Oct 28, 2021
4486932
puppeteer window size
michielbdejong Oct 29, 2021
727f47f
share-with oc->stub
michielbdejong Oct 29, 2021
3d765e5
checkFTU
michielbdejong Oct 29, 2021
a750d59
remove more duplicate code from nextcloud client
michielbdejong Oct 29, 2021
89a8e0c
oops
michielbdejong Oct 29, 2021
36861b2
span.icon-share
michielbdejong Oct 29, 2021
93fec95
debug this.go
michielbdejong Oct 29, 2021
12b126c
debug this.go
michielbdejong Oct 29, 2021
2ae9edf
debug this.go
michielbdejong Oct 29, 2021
c730c62
debug this.go
michielbdejong Oct 29, 2021
8007de0
debug this.go
michielbdejong Oct 29, 2021
c773cb4
debug this.go
michielbdejong Oct 29, 2021
8a72d33
debug this.go
michielbdejong Oct 29, 2021
5c9e810
typo
Oct 29, 2021
5f2eebb
Merge remote-tracking branch 'dockerhost/dev' into dev
michielbdejong Oct 29, 2021
2c10303
fix nc1, nc2 image
Oct 29, 2021
6e66414
configs and webroots
Oct 29, 2021
19356df
debugging
michielbdejong Oct 29, 2021
4fd1303
debugging
michielbdejong Oct 29, 2021
0a94369
debugging
michielbdejong Oct 29, 2021
a7bea2a
debugging
michielbdejong Oct 29, 2021
79427cf
debugging
michielbdejong Oct 29, 2021
d2f3286
ci Dockerfile
michielbdejong Nov 1, 2021
ce0d1eb
ci
michielbdejong Nov 1, 2021
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
15 changes: 15 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"presets": [
[
"@babel/preset-env",
{
"targets": {
"esmodules": true
}
}
],
"@babel/preset-typescript"
],
"plugins": [
]
}
6 changes: 3 additions & 3 deletions .github/workflows/jest.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Run jest
- name: Run testsuite
run: |
npm install
npm test
./build.sh
./ci.sh
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
ocm-stub
tls
6 changes: 5 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ RUN apt-get install -y git vim
ENV USER tester
ENV PASSWORD 1234
ENV VNC_PASSWORD 1234
ADD ./ubuntu-init-script.sh /ubuntu-init-script.sh
ADD ./ubuntu-init-script.sh /ubuntu-init-script.sh
# Trust all the certificates:
ADD tls /tls
RUN cp /tls/*.crt /usr/local/share/ca-certificates/
RUN update-ca-certificates
57 changes: 3 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,48 +10,12 @@ docker ps

git clone https://github.com/cs3org/ocm-test-suite
cd ocm-test-suite
git checkout add-reva

git clone https://github.com/michielbdejong/ocm-stub
cd ocm-stub
git checkout adapt-to-revad
cd ..
git clone https://github.com/michielbdejong/reva
cd reva
git checkout pass-ocm-test-suite
cd ..

./build.sh
docker network create testnet
docker run -d --network=testnet --rm --name=nc1.docker nextcloud
docker run -d --network=testnet --rm --name=nc2.docker nextcloud
docker run -d --network=testnet --rm --name=stub1.docker stub
docker run -d --network=testnet --rm --name=stub2.docker stub
docker run -d --network=testnet --rm --name=revad1.docker revad
docker run -d --network=testnet --rm --name=revad2.docker revad
docker run -p 6080:80 -p 5900:5900 -v /dev/shm:/dev/shm --network=testnet --name=tester -d --cap-add=SYS_ADMIN tester
git checkout dev

TESTER_IP_ADDR=`docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' tester`
echo $TESTER_IP_ADDR
# set up port forwarding from host to testnet for vnc:
sysctl net.ipv4.ip_forward=1
iptables -t nat -A PREROUTING -p tcp --dport 5900 -j DNAT --to-destination $TESTER_IP_ADDR:5900
/bin/bash ./build.sh
/bin/bash ./run.sh
```

While still on the host system, run maintenance:install and set trusted domains in the Nextcloud servers:
```sh
docker exec -it --user=www-data nc1.docker /bin/bash
```
And then:
```sh
export PHP_MEMORY_LIMIT="512M"
php console.php maintenance:install --admin-user alice --admin-pass alice123
php console.php status
vim config/config.php +24 # add nc1.docker as a trusted domain
exit
```
And same for `nc2.docker`.

Then from your laptop connect using VNC (e.g. open `vnc://dockerhost` in Safari), password 1234, you should see an Ubuntu desktop.
You can test that you made it into the testnet by opening Start->Internet->Firefox Web Browser and browsing to https://nc1.docker, once you
click 'accept the risk and continue', you should be able to log in to Nextcloud with 'alice'/'alice123'.
Expand All @@ -64,20 +28,6 @@ You can uncomment these in `./params-docker.js`.
What does not work yet is OCM between Nextcloud/ownCloud and Reva. We are currently discussing how to move forward
from this situation. Please join https://gitter.im/cs3org/OCM and ping @michielbdejong if you want more up-to-date info and guidance.

Here are some known issues we're working on:

1. Only NC->NC public-link (login after) is currently being tested, the rest is commented out
2. Reva has been added but is not passing the tests yet, due to a few open issues:
* https://github.com/cs3org/reva/issues/1752
* https://github.com/cs3org/reva/issues/1753
* https://github.com/cs3org/reva/issues/1962
* https://github.com/cs3org/reva/issues/1981
3. Due to https://github.com/cs3org/ocm-test-suite/issues/34:
* add `'allow_local_remote_servers' => true` to /var/www/html/config/config.php on nc1.docker.
* add `'verify' => false` to /var/www/html/lib/private/Http/Client/ClientService.php line 75 on nc1.docker.
* comment out line 79 of /var/www/html/lib/private/Http/Client/Client.php
* even then it doesn't seem to work consistently yet.

Now to run the tests, open a terminal (Start->System Tools->LXTerminal) and type (sudo password for user 'tester' is '1234'):
```sh
/bin/bash /ubuntu-init-script.sh
Expand All @@ -87,7 +37,6 @@ git checkout dev
npm run debug
```


It tests three flows:

### Public-link flow (login first)
Expand Down
55 changes: 43 additions & 12 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,53 @@
#!/bin/bash
mkdir -p tls
function createCert {
openssl req -new -x509 -days 365 -nodes \
-out ./tls/$1.crt \
-keyout ./tls/$1.key \
-subj "/C=RO/ST=Bucharest/L=Bucharest/O=IT/CN=$1" \
-addext "subjectAltName = DNS:localhost" \
-addext "subjectAltName = DNS:$1.docker"
}

createCert nc1
createCert nc2
createCert oc1
createCert oc2
createCert stub1
createCert stub2
createCert revad1
createCert revad2

docker build -t tester .

# git clone https://github.com/michielbdejong/ocm-stub
git clone https://github.com/michielbdejong/ocm-stub
cd ocm-stub
cp -r ../tls .
docker build -t stub .
cd ..
# rm -rf ocm-stub

# git clone https://github.com/michielbdejong/reva
cd reva
# git checkout pass-ocm-test-suite
docker build -t revadbase -f ./Dockerfile.revad .
cd ..
# rm -rf reva
cd revad
cd servers/revad
cp -r ../../tls .
docker build -t revad .

cd ../servers/nextcloud-server
cd ../apache-php
cp -r ../../tls .
docker build -t apache-php .

cd ../nextcloud
docker build -t nextcloud .
# cd ../owncloud-server
# docker-compose pull

cd ../nc1
docker build -t nc1 .

cd ../nc2
docker build -t nc2 .

cd ../owncloud
docker build -t owncloud .

cd ../oc1
docker build -t oc1 .

cd ../oc2
docker build -t oc2 .
13 changes: 13 additions & 0 deletions ci.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash
docker rm `docker ps -aq`
docker network remove testnet
docker network create testnet
docker run -d --network=testnet --rm --name=oc1.docker oc1
docker run -d --network=testnet --rm --name=oc2.docker oc2
docker run -d --network=testnet --rm --name=nc1.docker nc1
docker run -d --network=testnet --rm --name=nc2.docker nc2
docker run -d --network=testnet --rm --name=stub1.docker -e HOST=stub1 stub
docker run -d --network=testnet --rm --name=stub2.docker -e HOST=stub2 stub
docker run -d --network=testnet --rm --name=revad1.docker -e HOST=revad1 revad
docker run -d --network=testnet --rm --name=revad2.docker -e HOST=revad2 revad
docker run --network=testnet --name=tester -d --cap-add=SYS_ADMIN ci
21 changes: 21 additions & 0 deletions clients/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export abstract class Client {
guiType: string;
host: string
username: string
password: string
constructor({ host, username, password }) {
this.host = host;
this.username = username;
this.password = password;
}
abstract init(headless: boolean): Promise<void>
abstract login(fromCurrentPage: boolean): Promise<void>
abstract createPublicLink(): Promise<string>
abstract generateInvite(): Promise<string>
abstract forwardInvite(senderIdpName: string, tokenStr: string): Promise<void>
abstract shareWith(shareWithUser: string, shareWithHost: string, shareWithDomain: string, shareFromDomain: string): Promise<void>
abstract acceptPublicLink(url: string, remoteGuiType: string): Promise<void>
abstract acceptShare() : Promise<void>
abstract deleteAcceptedShare() : Promise<void>
abstract exit () : Promise<void>
}
54 changes: 54 additions & 0 deletions clients/nextcloud.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import puppeteer from "puppeteer";
import { GUI_TYPE_NEXTCLOUD } from "../guiTypes";
import { OwncloudClient } from './owncloud';

export class NextcloudClient extends OwncloudClient {
FTU_CLOSE_BUTTON: string = 'button.action-item.action-item--single.header-close.icon-close.undefined';
notificationDoneSelector: string = 'div.icon-notifications-dark';
contextMenuSelector: string = 'a.action-menu';
unshareSelector: string = 'li.action-delete-container';
loginButton:string = '#submit-form';
constructor({ host, username, password }) {
super({ host, username, password });
this.guiType = GUI_TYPE_NEXTCLOUD;
}

async createPublicLink() {
const filesUrl = `https://${this.host}/index.php/apps/files/?dir=/&openfile=15`; // select nextcloud.png file
await this.page.goto(filesUrl);

await this.page.waitForSelector('image.app-icon');
await this.go('a#sharing');
const CREATE_PUBLIC_LINK_BUTTON = 'button.new-share-link';
const elt = await this.page.$(CREATE_PUBLIC_LINK_BUTTON);
if (elt) {
await this.page.click(CREATE_PUBLIC_LINK_BUTTON);
}
// await this.go('button.action-item__menutoggle');
// await this.go('li.new-share-link');

await this.page.waitForSelector('a.sharing-entry__copy');
return this.page.evaluate("document.querySelector('a.sharing-entry__copy').getAttribute('href')");
}
async shareWith(shareWithUser, shareWithHost) {
const filesUrl = `https://${this.host}/index.php/apps/files`;
await this.page.goto(filesUrl);
await this.checkFTU();
// FIXME deal with first-time-use splash screen for Nextcloud Hub
await this.page.waitForSelector('image.app-icon');
await this.go('a.action-share');
// Careful that it types into the top multiselect input and not the bottom one:
// FIXME: Find a nicer way to do this:
await new Promise((resolve) => setTimeout(resolve, 1000));

await this.type('div.multiselect__tags input.multiselect__input', `${shareWithUser}@${shareWithHost}`);
await this.go('span.option__desc--lineone');
}
async acceptPublicLink(url, remoteGuiType) {
await this.page.goto(url);
await this.go('button.menutoggle');
await this.go('button#save-external-share');
await this.page.type('#remote_address', `${this.username}@${this.host}`);
await this.page.click('#save-button-confirm');
}
}
Loading